public class PatternFilter
extends org.eclipse.jface.viewers.ViewerFilter
FilteredTree
. In order to determine if a node should be filtered it
uses the content and label provider of the tree to do pattern matching on its children. This causes the entire tree
structure to be realized. Note that the label provider must implement ILabelProvider.FilteredTree
Constructor and Description |
---|
PatternFilter() |
Modifier and Type | Method and Description |
---|---|
void |
clearCaches()
Clears the caches used for optimizing this filter.
|
java.lang.Object[] |
filter(org.eclipse.jface.viewers.Viewer viewer,
java.lang.Object parent,
java.lang.Object[] elements) |
boolean |
isElementSelectable(java.lang.Object element)
Answers whether the given element is a valid selection in the filtered tree.
|
boolean |
isElementVisible(org.eclipse.jface.viewers.Viewer viewer,
java.lang.Object element)
Answers whether the given element in the given viewer matches the filter pattern.
|
boolean |
isLeafMatch(org.eclipse.jface.viewers.Viewer viewer,
java.lang.Object element)
Check if the current (leaf) element is a match with the filter text.
|
protected boolean |
isParentMatch(org.eclipse.jface.viewers.Viewer viewer,
java.lang.Object element)
Check if the parent (category) is a match to the filter text.
|
boolean |
select(org.eclipse.jface.viewers.Viewer viewer,
java.lang.Object parentElement,
java.lang.Object element) |
void |
setIncludeLeadingWildcard(boolean includeLeadingWildcard)
Sets whether a leading wildcard should be attached to each pattern string.
|
void |
setPattern(java.lang.String patternString)
The pattern string for which this filter should select elements in the viewer.
|
void |
setUseCache(boolean useCache)
Can be called by the filtered tree to turn on caching.
|
protected boolean |
wordMatches(java.lang.String text)
Return whether or not if any of the words in text satisfy the match critera.
|
public final java.lang.Object[] filter(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object parent, java.lang.Object[] elements)
filter
in class org.eclipse.jface.viewers.ViewerFilter
ViewerFilter.filter(org.eclipse.jface.viewers.Viewer, java.lang.Object,
java.lang.Object[])
public final boolean select(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object parentElement, java.lang.Object element)
select
in class org.eclipse.jface.viewers.ViewerFilter
ViewerFilter.select(org.eclipse.jface.viewers.Viewer, java.lang.Object,
java.lang.Object)
public final void setIncludeLeadingWildcard(boolean includeLeadingWildcard)
includeLeadingWildcard
- Whether a leading wildcard should be added.public void setPattern(java.lang.String patternString)
patternString
- public void clearCaches()
public boolean isElementSelectable(java.lang.Object element)
element
- public boolean isElementVisible(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object element)
viewer
- the tree viewer in which the element resideselement
- the element in the tree to check for a matchprotected boolean isParentMatch(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object element)
viewer
- the viewer that contains the elementelement
- the tree element to checkpublic boolean isLeafMatch(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object element)
viewer
- the viewer that contains the elementelement
- the tree element to checkprotected boolean wordMatches(java.lang.String text)
text
- the text to matchtrue
if one of the words in text satisifes the match criteria.public void setUseCache(boolean useCache)
useCache
- The useCache to set.