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
protected abstract class FilteredItemsSelectionDialog.ItemsFilter extends Object
Filters elements using SearchPattern by comparing the names of items with the filter pattern.
-
-
Field Summary
Fields Modifier and Type Field Description protected SearchPatternpatternMatcherTheSearchPattern.
-
Constructor Summary
Constructors Constructor Description ItemsFilter()Creates new instance of ItemsFilter.ItemsFilter(SearchPattern searchPattern)Creates new instance of ItemsFilter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequalsFilter(FilteredItemsSelectionDialog.ItemsFilter filter)Checks whether the provided filter is equal to the current filter.intgetMatchRule()Returns the rule to apply for matching keys.StringgetPattern()Returns the pattern string.booleanisCamelCasePattern()Checks whether the pattern's match rule is camel case.abstract booleanisConsistentItem(Object item)Checks consistency of an item.booleanisSubFilter(FilteredItemsSelectionDialog.ItemsFilter filter)Check if the given filter is a sub-filter of this filter.protected booleanmatches(String text)Matches text with filter.booleanmatchesRawNamePattern(Object item)General method for matching raw name pattern.abstract booleanmatchItem(Object item)Matches an item against filter conditions.
-
-
-
Field Detail
-
patternMatcher
protected SearchPattern patternMatcher
TheSearchPattern.
-
-
Constructor Detail
-
ItemsFilter
public ItemsFilter()
Creates new instance of ItemsFilter.
-
ItemsFilter
public ItemsFilter(SearchPattern searchPattern)
Creates new instance of ItemsFilter.- Parameters:
searchPattern- the pattern to be used when filtering
-
-
Method Detail
-
isSubFilter
public boolean isSubFilter(FilteredItemsSelectionDialog.ItemsFilter filter)
Check if the given filter is a sub-filter of this filter. The default implementation checks if theSearchPatternfrom 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)istrueiffbis a sub-filter ofa, and not vice-versa.- Parameters:
filter- the filter to be checked, ornull- Returns:
trueif the given filter is sub-filter of this filter,falseif the given filter isn't a sub-filter or isnull- See Also:
SearchPattern.isSubPattern(org.eclipse.ui.dialogs.SearchPattern)
-
equalsFilter
public boolean equalsFilter(FilteredItemsSelectionDialog.ItemsFilter filter)
Checks whether the provided filter is equal to the current filter. The default implementation checks ifSearchPatternfrom current filter is equal to the one from provided filter.- Parameters:
filter- filter to be checked, ornull- Returns:
trueif the given filter is equal to current filter,falseif given filter isn't equal to current one or if it isnull- See Also:
SearchPattern.equalsPattern(org.eclipse.ui.dialogs.SearchPattern)
-
isCamelCasePattern
public boolean isCamelCasePattern()
Checks whether the pattern's match rule is camel case.- Returns:
trueif pattern's match rule is camel case,falseotherwise
-
getPattern
public String getPattern()
Returns the pattern string.- Returns:
- pattern for this filter
- See Also:
SearchPattern.getPattern()
-
getMatchRule
public int getMatchRule()
Returns the rule to apply for matching keys.- Returns:
- an implementation-specific match rule
- See Also:
for match rules returned by the default implementation
-
matches
protected boolean matches(String text)
Matches text with filter.- Parameters:
text- the text to match with the filter- Returns:
trueif text matches with filter pattern,falseotherwise
-
matchesRawNamePattern
public boolean matchesRawNamePattern(Object item)
General method for matching raw name pattern. Checks whether current pattern is prefix of name provided item.- Parameters:
item- item to check- Returns:
trueif current pattern is a prefix of name provided item,falseif item's name is shorter than prefix or sequences of characters don't match.
-
matchItem
public abstract boolean matchItem(Object item)
Matches an item against filter conditions.- Parameters:
item- the item to match- Returns:
trueif item matches against filter conditions,falseotherwise
-
isConsistentItem
public abstract boolean isConsistentItem(Object item)
Checks consistency of an item. Item is inconsistent if was changed or removed.- Parameters:
item- the item to check.- Returns:
trueif item is consistent,falseif item is inconsistent
-
-