Package org.eclipse.jface.viewers
Class ViewerFilter
- java.lang.Object
-
- org.eclipse.jface.viewers.ViewerFilter
-
- Direct Known Subclasses:
PatternFilter,ResourcePatternFilter,ResourceWorkingSetFilter
public abstract class ViewerFilter extends Object
A viewer filter is used by a structured viewer to extract a subset of elements provided by its content provider.Subclasses must implement the
selectmethod and may implement theisFilterPropertymethod.- See Also:
IStructuredContentProvider,StructuredViewer
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedViewerFilter()Creates a new viewer filter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Object[]filter(Viewer viewer, Object parent, Object[] elements)Filters the given elements for the given viewer.Object[]filter(Viewer viewer, TreePath parentPath, Object[] elements)Filters the given elements for the given viewer.booleanisFilterProperty(Object element, String property)Returns whether this viewer filter would be affected by a change to the given property of the given element.abstract booleanselect(Viewer viewer, Object parentElement, Object element)Returns whether the given element makes it through this filter.
-
-
-
Method Detail
-
filter
public Object[] filter(Viewer viewer, Object parent, Object[] elements)
Filters the given elements for the given viewer. The input array is not modified.The default implementation of this method calls
selecton each element in the array, and returns only those elements for whichselectreturnstrue.- Parameters:
viewer- the viewerparent- the parent elementelements- the elements to filter- Returns:
- the filtered elements
-
filter
public Object[] filter(Viewer viewer, TreePath parentPath, Object[] elements)
Filters the given elements for the given viewer. The input array is not modified.The default implementation of this method calls
filter(Viewer, Object, Object[])with the parent from the path. Subclasses may override- Parameters:
viewer- the viewerparentPath- the path of the parent elementelements- the elements to filter- Returns:
- the filtered elements
- Since:
- 3.2
-
isFilterProperty
public boolean isFilterProperty(Object element, String property)
Returns whether this viewer filter would be affected by a change to the given property of the given element.The default implementation of this method returns
false. Subclasses should reimplement.- Parameters:
element- the elementproperty- the property- Returns:
trueif the filtering would be affected, andfalseif it would be unaffected
-
select
public abstract boolean select(Viewer viewer, Object parentElement, Object element)
Returns whether the given element makes it through this filter.- Parameters:
viewer- the viewerparentElement- the parent elementelement- the element- Returns:
trueif element is included in the filtered set, andfalseif excluded
-
-