Package org.eclipse.ui.dialogs
Class FilteredItemsSelectionDialog.ItemsFilter
java.lang.Object
org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter
- Direct Known Subclasses:
FilteredResourcesSelectionDialog.ResourceFilter
- Enclosing class:
- FilteredItemsSelectionDialog
Filters elements using SearchPattern by comparing the names of items with the
filter pattern.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreates new instance of ItemsFilter.ItemsFilter
(SearchPattern searchPattern) Creates new instance of ItemsFilter. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks whether the provided filter is equal to the current filter.int
Returns the rule to apply for matching keys.Returns the pattern string.boolean
Checks whether the pattern's match rule is camel case.abstract boolean
isConsistentItem
(Object item) Checks consistency of an item.boolean
Check if the given filter is a sub-filter of this filter.protected boolean
Matches text with filter.boolean
matchesRawNamePattern
(Object item) General method for matching raw name pattern.abstract boolean
Matches an item against filter conditions.
-
Field Details
-
patternMatcher
TheSearchPattern
.
-
-
Constructor Details
-
ItemsFilter
public ItemsFilter()Creates new instance of ItemsFilter. -
ItemsFilter
Creates new instance of ItemsFilter.- Parameters:
searchPattern
- the pattern to be used when filtering
-
-
Method Details
-
isSubFilter
Check if the given filter is a sub-filter of this filter. The default implementation checks if theSearchPattern
from the given filter is a sub-pattern of the one from this filter.WARNING: This method is not defined in reading order, i.e.
a.isSubFilter(b)
istrue
iffb
is a sub-filter ofa
, and not vice-versa.- Parameters:
filter
- the filter to be checked, ornull
- Returns:
true
if the given filter is sub-filter of this filter,false
if the given filter isn't a sub-filter or isnull
- See Also:
-
equalsFilter
Checks whether the provided filter is equal to the current filter. The default implementation checks ifSearchPattern
from current filter is equal to the one from provided filter.- Parameters:
filter
- filter to be checked, ornull
- Returns:
true
if the given filter is equal to current filter,false
if given filter isn't equal to current one or if it isnull
- See Also:
-
isCamelCasePattern
public boolean isCamelCasePattern()Checks whether the pattern's match rule is camel case.- Returns:
true
if pattern's match rule is camel case,false
otherwise
-
getPattern
Returns the pattern string.- Returns:
- pattern for this filter
- See Also:
-
getMatchRule
public int getMatchRule()Returns the rule to apply for matching keys.- Returns:
- an implementation-specific match rule
- See Also:
-
matches
Matches text with filter.- Parameters:
text
- the text to match with the filter- Returns:
true
if text matches with filter pattern,false
otherwise
-
matchesRawNamePattern
General method for matching raw name pattern. Checks whether current pattern is prefix of name provided item.- Parameters:
item
- item to check- Returns:
true
if current pattern is a prefix of name provided item,false
if item's name is shorter than prefix or sequences of characters don't match.
-
matchItem
Matches an item against filter conditions.- Parameters:
item
- the item to match- Returns:
true
if item matches against filter conditions,false
otherwise
-
isConsistentItem
Checks consistency of an item. Item is inconsistent if was changed or removed.- Parameters:
item
- the item to check.- Returns:
true
if item is consistent,false
if item is inconsistent
-