| java.lang.Object org.eclipse.ui.dialogs.SearchPattern
SearchPattern | public class SearchPattern (Code) | | A search pattern defines how search results are found.
This class is intended to be subclassed by clients. A default behavior is
provided for each of the methods above, that clients can ovveride if they
wish.
since: 3.3 |
Field Summary | |
final public static int | RULE_BLANK_MATCH Match rule: The search pattern is blank. | final public static int | RULE_CAMELCASE_MATCH Match rule: The search pattern contains a Camel Case expression. | final public static int | RULE_CASE_SENSITIVE Match rule: The search pattern matches the search result only if cases
are the same. | final public static int | RULE_EXACT_MATCH Match rule: The search pattern matches exactly the search result, that
is, the source of the search result equals the search pattern. | final public static int | RULE_PATTERN_MATCH Match rule: The search pattern contains one or more wild cards ('*' or
'?'). | final public static int | RULE_PREFIX_MATCH Match rule: The search pattern is a prefix of the search result. |
RULE_BLANK_MATCH | final public static int RULE_BLANK_MATCH(Code) | | Match rule: The search pattern is blank.
|
RULE_CAMELCASE_MATCH | final public static int RULE_CAMELCASE_MATCH(Code) | | Match rule: The search pattern contains a Camel Case expression.
Examples:
NPE type string pattern will match
NullPointerException and
NpPermissionException types,
NuPoEx type string pattern will only match
NullPointerException type.
Can be combined to
SearchPattern.RULE_PREFIX_MATCH match rule. For example,
when prefix match rule is combined with Camel Case match rule,
"nPE" pattern will match nPException .
Match rule
SearchPattern.RULE_PATTERN_MATCH may also be combined but both
rules will not be used simultaneously as they are mutually exclusive.
Used match rule depends on whether string pattern contains specific
pattern characters (e.g. '*' or '?') or not. If it does, then only
Pattern match rule will be used, otherwise only Camel Case match will be
used. For example, with "NPE" string pattern, search will
only use Camel Case match rule, but with N*P*E* string
pattern, it will use only Pattern match rule.
|
RULE_EXACT_MATCH | final public static int RULE_EXACT_MATCH(Code) | | Match rule: The search pattern matches exactly the search result, that
is, the source of the search result equals the search pattern. Search pattern
should start from lowerCase char.
|
RULE_PATTERN_MATCH | final public static int RULE_PATTERN_MATCH(Code) | | Match rule: The search pattern contains one or more wild cards ('*' or
'?'). A '*' wild-card can replace 0 or more characters in the search
result. A '?' wild-card replaces exactly 1 character in the search
result.
|
RULE_PREFIX_MATCH | final public static int RULE_PREFIX_MATCH(Code) | | Match rule: The search pattern is a prefix of the search result.
|
SearchPattern | public SearchPattern()(Code) | | Creates new instance of SearchPattern Default allowedRules for it is
result of belong logic operation: ( RULE_EXACT_MATCH | RULE_PREFIX_MATCH |
RULE_PATTERN_MATCH | RULE_CAMELCASE_MATCH )
|
equalsPattern | public boolean equalsPattern(SearchPattern pattern)(Code) | | Tells whether the given SearchPattern equals this pattern.
Parameters: pattern - pattern to be checked true if the given pattern equals this search pattern |
getMatchRule | final public int getMatchRule()(Code) | | Returns the rule to apply for matching keys. Can be exact match, prefix
match, pattern match or camelcase match. Rule can also be combined with a
case sensitivity flag.
one of RULE_EXACT_MATCH, RULE_PREFIX_MATCH, RULE_PATTERN_MATCH,RULE_CAMELCASE_MATCH, combined with RULE_CASE_SENSITIVE, e.g.RULE_EXACT_MATCH | RULE_CASE_SENSITIVE if an exact and casesensitive match is requested, or RULE_PREFIX_MATCH if a prefixnon case sensitive match is requested. |
getPattern | public String getPattern()(Code) | | Gets string pattern used by matcher
pattern |
isNameCharAllowed | protected boolean isNameCharAllowed(char nameChar)(Code) | | Checks character of element's name is allowed for specified set. It could
be override if you want change logic of camelCaseMatch methods.
Parameters: nameChar - -name of searched element if nameChar is in set of allowed characters for name of element |
isPatternCharAllowed | protected boolean isPatternCharAllowed(char patternChar)(Code) | | Checks pattern's character is allowed for specified set. It could be
override if you want change logic of camelCaseMatch methods.
Parameters: patternChar - true if patternChar is in set of allowed characters for pattern |
isSubPattern | public boolean isSubPattern(SearchPattern pattern)(Code) | | Tells whether the given SearchPattern is a subpattern of
this pattern.
Parameters: pattern - pattern to be checked true if the given pattern is a sub pattern of this search pattern |
isValidCamelCaseChar | protected boolean isValidCamelCaseChar(char ch)(Code) | | Check if character is valid camelCase character
Parameters: ch - character to be validated true if character is valid |
matches | public boolean matches(String text)(Code) | | Matches text with pattern. matching is determine by matchKind.
Parameters: text - true if search pattern was matched with text false in other way |
setPattern | public void setPattern(String stringPattern)(Code) | | Parameters: stringPattern - The stringPattern to set. |
|
|