Permalink
Browse files

Added a filter to filter out unwanted resources from a Viewer.

  • Loading branch information...
1 parent cec27a0 commit 45ae22370e7533b9772b27b6861c5b9b85a06ed7 @olas committed Jul 20, 2009
@@ -0,0 +1,32 @@
+package net.bioclipse.qsar.ui.wizards;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+
+public class ExistingResourcesFilter extends ViewerFilter {
+
+ private List<IResource> blacklist;
+
+ public ExistingResourcesFilter(List<IResource> blacklist) {
+ this.blacklist=blacklist;
+ }
+
+ @Override
+ public boolean select( Viewer viewer, Object parentElement, Object element ) {
+
+ //Only filter out IResource
+ if (!(element instanceof IResource)) {
+ return true;
+ }
+
+ //Filter out if in blacklist
+ IResource resource = (IResource) element;
+ if (blacklist.contains( resource )) return false;
+ else return true;
+ }
+
+}

0 comments on commit 45ae223

Please sign in to comment.