public class PatternFilter extends ViewerFilter
FilteredTree. In order to
determine if a node should be filtered it uses the content provider of the
tree to do pattern matching on its children. This causes the entire tree
structure to be realized.FilteredTree| Constructor and Description |
|---|
PatternFilter() |
| Modifier and Type | Method and Description |
|---|---|
Object[] |
filter(Viewer viewer,
Object parent,
Object[] elements)
Filters the given elements for the given viewer.
|
boolean |
isElementSelectable(Object element)
Answers whether the given element is a valid selection in
the filtered tree.
|
boolean |
isElementVisible(Viewer viewer,
Object element)
Answers whether the given element in the given viewer matches
the filter pattern.
|
protected boolean |
isLeafMatch(Viewer viewer,
Object element)
Check if the current (leaf) element is a match with the filter text.
|
protected boolean |
isParentMatch(Viewer viewer,
Object element)
Check if the parent (category) is a match to the filter text.
|
boolean |
select(Viewer viewer,
Object parentElement,
Object element)
Returns whether the given element makes it through this filter.
|
void |
setIncludeLeadingWildcard(boolean includeLeadingWildcard)
Sets whether a leading wildcard should be attached to each pattern
string.
|
void |
setPattern(String patternString)
The pattern string for which this filter should select
elements in the viewer.
|
protected boolean |
wordMatches(String text)
Return whether or not if any of the words in text satisfy the
match critera.
|
filter, isFilterPropertypublic final Object[] filter(Viewer viewer, Object parent, Object[] elements)
ViewerFilter
The default implementation of this method calls
select on each element in the array,
and returns only those elements for which select
returns true.
filter in class ViewerFilterviewer - the viewerparent - the parent elementelements - the elements to filterpublic final boolean select(Viewer viewer, Object parentElement, Object element)
ViewerFilterselect in class ViewerFilterviewer - the viewerparentElement - the parent elementelement - the elementtrue if element is included in the
filtered set, and false if excludedpublic final void setIncludeLeadingWildcard(boolean includeLeadingWildcard)
includeLeadingWildcard - Whether a leading wildcard should be added.public void setPattern(String patternString)
patternString - public boolean isElementSelectable(Object element)
element - public boolean isElementVisible(Viewer viewer, Object element)
viewer - the tree viewer in which the element resideselement - the element in the tree to check for a matchprotected boolean isParentMatch(Viewer viewer, Object element)
viewer - the viewer that contains the elementelement - the tree element to checkprotected boolean isLeafMatch(Viewer viewer, Object element)
viewer - the viewer that contains the elementelement - the tree element to checkprotected boolean wordMatches(String text)
text - the text to matchtrue if one of the words in text
satisifes the match criteria.Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.