1 11 package org.eclipse.jface.viewers; 12 13 import java.util.ArrayList ; 14 15 25 public abstract class ViewerFilter { 26 29 protected ViewerFilter() { 30 } 31 32 46 public Object [] filter(Viewer viewer, Object parent, Object [] elements) { 47 int size = elements.length; 48 ArrayList out = new ArrayList (size); 49 for (int i = 0; i < size; ++i) { 50 Object element = elements[i]; 51 if (select(viewer, parent, element)) { 52 out.add(element); 53 } 54 } 55 return out.toArray(); 56 } 57 58 72 public Object [] filter(Viewer viewer, TreePath parentPath, Object [] elements) { 73 return filter(viewer, parentPath.getLastSegment(), elements); 74 } 75 76 89 public boolean isFilterProperty(Object element, String property) { 90 return false; 91 } 92 93 102 public abstract boolean select(Viewer viewer, Object parentElement, 103 Object element); 104 } 105 | Popular Tags |