Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Check if only the default toplevel and/or endpoint exists hide them
  • Loading branch information
goglepox committed Jun 26, 2015
1 parent a9888e7 commit 94487fc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
Expand Up @@ -469,10 +469,34 @@ public void run() {
//Init viewer with available endpoints
IDSManager ds = net.bioclipse.ds.Activator.getDefault().getJavaManager();
try {
if (ds.getFullTopLevels().size()>1) //There is always the uncategorized...
viewer.setInput(ds.getFullTopLevels().toArray());
else if(ds.getFullTopLevels().size()==1 && ds.getFullEndpoints().size()>1) {
viewer.setInput( ds.getFullEndpoints() );
if (!ds.getFullTests().isEmpty()) {
List<TopLevel> toplevels = ds.getFullTopLevels();
boolean skipToplevels = true;
for(TopLevel toplevel:toplevels) {
if( !toplevel.getEndpoints().isEmpty() &&
!toplevel.getId().equals( "net.bioclipse.ds.toplevel.other" )) {
skipToplevels = false;
}
}
if(skipToplevels) {
List<Endpoint> endpoints = ds.getFullEndpoints();
boolean skipEndpoints = true;
for(Endpoint endpoint:endpoints) {
if( !endpoint.getTests().isEmpty() &&
!endpoint.getId().equals( "net.bioclipse.ds.uncategorized" ) ) {
skipEndpoints=false;
}
}

if(skipEndpoints) {
viewer.setInput( ds.getFullTests().toArray() );
} else {
viewer.setInput( ds.getFullEndpoints().toArray() );
}

} else {
viewer.setInput(ds.getFullTopLevels().toArray());
}
} else {
String[] msg = new String[2];
msg[0]=" No models available.";
Expand Down
Expand Up @@ -3,6 +3,7 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.help.IContext2;
Expand Down Expand Up @@ -83,7 +84,9 @@ public void setDescription( String description ) {


public List<IDSTest> getTests() {


if ( tests == null )
return Collections.emptyList();
return tests;
}

Expand Down
Expand Up @@ -3,6 +3,7 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.help.IContext2;
Expand Down Expand Up @@ -105,6 +106,9 @@ public String getPlugin() {


public List<Endpoint> getEndpoints() {

if ( endpoints == null )
return Collections.emptyList();
return endpoints;
}

Expand Down

0 comments on commit 94487fc

Please sign in to comment.