Skip to content

Commit

Permalink
Implemented filter for empty and inconclusive results. Solves #3074
Browse files Browse the repository at this point in the history
  • Loading branch information
olas committed Sep 10, 2012
1 parent be0cbd0 commit 0b84ac1
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/net.bioclipse.ds.ui/icons/emptyShown.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -149,6 +149,7 @@ public class DSView extends ViewPart implements IPartListener2, IPropertyChangeL
private JChemPaintEditor lastJCP;

private Action filterOutErrorAction;
private Action filterOutEmptyAction;

private static DSView instance;

Expand Down Expand Up @@ -537,6 +538,7 @@ private void fillLocalToolBar(IToolBarManager manager) {
manager.add(runAction);
manager.add(clearAction);
manager.add(filterOutErrorAction);
manager.add(filterOutEmptyAction);
manager.add(new Separator());
manager.add(includeAction);
manager.add(excludeAction);
Expand Down Expand Up @@ -633,6 +635,30 @@ public void run() {
filterOutErrorAction.setToolTipText("Turns on/off if results with errors should be displayed");
filterOutErrorAction.setImageDescriptor(Activator.getImageDecriptor( "icons/errorsShown.png" ));

filterOutEmptyAction = new Action() {
public void run() {

ViewerFilter ef=null;
for (int i = 0; i<viewer.getFilters().length;i++){
if (viewer.getFilters()[i] instanceof HideEmptyFilter) {
ef = (HideEmptyFilter) viewer.getFilters()[i];
}
}

if (ef==null){
viewer.addFilter(new HideEmptyFilter());
filterOutEmptyAction.setImageDescriptor(Activator.getImageDecriptor( "icons/emptyHidden.png" ));
}else{
viewer.removeFilter(ef);
filterOutEmptyAction.setImageDescriptor(Activator.getImageDecriptor( "icons/emptyShown.png" ));
}

}
};
filterOutEmptyAction.setText("Toggle Show Empty results");
filterOutEmptyAction.setToolTipText("Turns on/off if empty or inclonclusive results should be displayed");
filterOutEmptyAction.setImageDescriptor(Activator.getImageDecriptor( "icons/emptyShown.png" ));

clearAction = new Action() {
public void run() {
doClearAllTests();
Expand Down
@@ -0,0 +1,29 @@
package net.bioclipse.ds.ui.views;

import net.bioclipse.ds.model.ITestResult;
import net.bioclipse.ds.model.TestRun;

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

/**
* A filter to hide testresults which has no results
* @author ola
*
*/
public class HideEmptyFilter extends ViewerFilter {

@Override
public boolean select( Viewer viewer, Object parentElement, Object element ) {

if ( element instanceof TestRun ) {
TestRun tr = (TestRun)element;
if (tr.getStatus()==TestRun.FINISHED && tr.getConsensusStatus()==ITestResult.EMPTY)
return false;
if (tr.getStatus()==TestRun.FINISHED && tr.getConsensusStatus()==ITestResult.INCONCLUSIVE)
return false;
}
return true;
}

}

0 comments on commit 0b84ac1

Please sign in to comment.