本文整理汇总了Java中org.eclipse.ui.dialogs.SearchPattern.matches方法的典型用法代码示例。如果您正苦于以下问题:Java SearchPattern.matches方法的具体用法?Java SearchPattern.matches怎么用?Java SearchPattern.matches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.dialogs.SearchPattern
的用法示例。
在下文中一共展示了SearchPattern.matches方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSearchPredicate
import org.eclipse.ui.dialogs.SearchPattern; //导入方法依赖的package包/类
protected Predicate<IEObjectDescription> getSearchPredicate(final String stringPattern,
final String typeStringPattern) {
final Collection<String> namespaceDelimiters = IXtextSearchFilter.Registry.allNamespaceDelimiters();
final SearchPattern searchPattern = new SearchPattern();
searchPattern.setPattern(stringPattern);
final SearchPattern typeSearchPattern = new SearchPattern();
typeSearchPattern.setPattern(typeStringPattern);
final Collection<IXtextSearchFilter> registeredFilters = IXtextSearchFilter.Registry.allFilters();
return new Predicate<IEObjectDescription>() {
public boolean apply(IEObjectDescription input) {
if (isNameMatches(searchPattern, input, namespaceDelimiters)
&& typeSearchPattern.matches(input.getEClass().getName())) {
for (IXtextSearchFilter xtextSearchFilter : registeredFilters) {
if (xtextSearchFilter.reject(input)) {
return false;
}
}
return true;
}
return false;
}
};
}
示例2: isTextMatchingSearchPattern
import org.eclipse.ui.dialogs.SearchPattern; //导入方法依赖的package包/类
protected boolean isTextMatchingSearchPattern(String text, String searchPattern) {
SearchPattern matcher = new SearchPattern(SearchPattern.RULE_PATTERN_MATCH
| SearchPattern.RULE_EXACT_MATCH | SearchPattern.RULE_PREFIX_MATCH
| SearchPattern.RULE_BLANK_MATCH);
matcher.setPattern("*" + searchPattern);
return matcher.matches(text);
}
示例3: isTextMatchingSearchPattern
import org.eclipse.ui.dialogs.SearchPattern; //导入方法依赖的package包/类
protected boolean isTextMatchingSearchPattern(String text) {
SearchPattern matcher = new SearchPattern(SearchPattern.RULE_PATTERN_MATCH
| SearchPattern.RULE_EXACT_MATCH | SearchPattern.RULE_PREFIX_MATCH
| SearchPattern.RULE_BLANK_MATCH);
matcher.setPattern("*" + searchPattern);
return matcher.matches(text);
}
示例4: isNameMatches
import org.eclipse.ui.dialogs.SearchPattern; //导入方法依赖的package包/类
protected boolean isNameMatches(SearchPattern searchPattern, IEObjectDescription eObjectDescription, Collection<String> namespaceDelimiters) {
String qualifiedName = qualifiedNameConverter.toString(eObjectDescription.getQualifiedName());
if (qualifiedName!=null) {
if(searchPattern.matches(qualifiedName)) {
return true;
}
for(String namespaceDelimiter : namespaceDelimiters) {
int index = qualifiedName.lastIndexOf(namespaceDelimiter);
if(index!=-1 && searchPattern.matches(qualifiedName.substring(index+1))) {
return true;
}
}
}
return false;
}
示例5: matchItem
import org.eclipse.ui.dialogs.SearchPattern; //导入方法依赖的package包/类
/**
* Matches according to scopes.
*/
public static boolean matchItem(SearchPattern patternMatcher, IInfo info) {
//We want to match the package name in the beggining too...
String pattern = patternMatcher.getPattern();
List<String> split = StringUtils.splitAndRemoveEmptyTrimmed(pattern, '.');
if (split.size() <= 1) {
if (pattern.endsWith(".")) {
split.add("");
} else {
return patternMatcher.matches(info.getName());
}
}
//Otherwise, we have more things to match... We could match something like:
//django.AAA -- which should match all the modules that start with django and the tokens that have AAA.
String declaringModuleName = info.getDeclaringModuleName();
if (declaringModuleName == null || declaringModuleName.length() == 0) {
return false;
}
List<String> moduleParts = StringUtils.splitAndRemoveEmptyTrimmed(declaringModuleName, '.');
while (split.size() > 1) {
String head = split.remove(0);
SearchPattern headPattern = new SearchPattern();
headPattern.setPattern(head);
if (moduleParts.size() == 0) {
return false; //we cannot match it anymore
}
if (!headPattern.matches(moduleParts.remove(0))) {
return false;
}
}
//if it got here, we've matched the module correctly... let's go on and check the name.
SearchPattern tailPattern = new SearchPattern();
tailPattern.setPattern(split.get(0));
return tailPattern.matches(info.getName());
}