当前位置: 首页>>代码示例>>Java>>正文


Java SearchPattern.setPattern方法代码示例

本文整理汇总了Java中org.eclipse.ui.dialogs.SearchPattern.setPattern方法的典型用法代码示例。如果您正苦于以下问题:Java SearchPattern.setPattern方法的具体用法?Java SearchPattern.setPattern怎么用?Java SearchPattern.setPattern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.dialogs.SearchPattern的用法示例。


在下文中一共展示了SearchPattern.setPattern方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
		}
	};
}
 
开发者ID:cplutte,项目名称:bts,代码行数:24,代码来源:IXtextEObjectSearch.java

示例2: ModuleItemsFilter

import org.eclipse.ui.dialogs.SearchPattern; //导入方法依赖的package包/类
public ModuleItemsFilter() {
  super(new ModuleSearchPattern());

  /*
   * If there is no filter pattern present, initialize the pattern to '*'.
   * This has the nice property of pre-populating the dialog list with all
   * possible matches when it is first shown.
   */
  if (patternMatcher.getPattern() == null
      || patternMatcher.getPattern().length() == 0) {
    patternMatcher.setPattern("*");
  }

  // If a package pattern is present in the filter text, then set up
  // a packageMatcher to do matching based on the module's package.
  String stringPackage = ((ModuleSearchPattern) patternMatcher).getPackagePattern();
  if (stringPackage != null) {
    packageMatcher = new SearchPattern();
    packageMatcher.setPattern(stringPackage);
  } else {
    packageMatcher = null;
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:ModuleSelectionDialog.java

示例3: TypeItemsFilter

import org.eclipse.ui.dialogs.SearchPattern; //导入方法依赖的package包/类
/**
 * Creates instance of TypeItemsFilter
 * 
 * @param scope
 * @param elementKind
 * @param extension
 */
public TypeItemsFilter(IDLTKSearchScope scope, int elementKind,
        ITypeInfoFilterExtension extension) {
    super(new TypeSearchPattern());
    fScope = scope;
    fIsWorkspaceScope = scope == null ? false : scope
            .equals(SearchEngine.createWorkspaceScope(fToolkit));
    fElemKind = elementKind;
    fFilterExt = extension;
    String stringPackage = ((TypeSearchPattern) patternMatcher)
            .getPackagePattern();
    if (stringPackage != null) {
        fPackageMatcher = new SearchPattern();
        fPackageMatcher.setPattern(stringPackage);
    } else {
        fPackageMatcher = null;
    }
}
 
开发者ID:UndefinedOffset,项目名称:eclipse-silverstripedt,代码行数:25,代码来源:FilteredTypesSelectionDialog.java

示例4: 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);
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:8,代码来源:SearchNodeContext.java

示例5: 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);
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:8,代码来源:SchemaRegistryView.java

示例6: 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());
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:42,代码来源:MatchHelper.java

示例7: checkPatternSubparts

import org.eclipse.ui.dialogs.SearchPattern; //导入方法依赖的package包/类
private static boolean checkPatternSubparts(String thisPattern, String otherPattern,
        ICallback2<Boolean, SearchPattern, SearchPattern> check) {
    boolean thisEndsWithPoint = thisPattern.endsWith(".");
    boolean otherEndsWithPoint = otherPattern.endsWith(".");
    if (thisEndsWithPoint != otherEndsWithPoint) {
        return false;
    }

    List<String> thisSplit = StringUtils.splitAndRemoveEmptyNotTrimmed(thisPattern, '.');
    List<String> otherSplit = StringUtils.splitAndRemoveEmptyNotTrimmed(otherPattern, '.');

    if (thisEndsWithPoint) {
        thisSplit.add("");
    }
    if (otherEndsWithPoint) {
        otherSplit.add("");
    }

    if (thisSplit.size() != otherSplit.size()) {
        return false;
    }

    for (int i = 0; i < thisSplit.size(); i++) {
        String thisStr = thisSplit.get(i);
        String otherStr = otherSplit.get(i);
        SearchPattern thisP = new SearchPattern();
        thisP.setPattern(thisStr);

        SearchPattern otherP = new SearchPattern();
        otherP.setPattern(otherStr);
        if (!check.call(thisP, otherP)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:37,代码来源:MatchHelper.java

示例8: testPatternMatch

import org.eclipse.ui.dialogs.SearchPattern; //导入方法依赖的package包/类
public void testPatternMatch() throws Exception {
    SearchPattern patternMatcher = new SearchPattern();
    patternMatcher.setPattern("aa");

    assertTrue(MatchHelper.matchItem(patternMatcher, new ClassInfo("aa", null, null, null)));

    assertTrue(MatchHelper.matchItem(patternMatcher, new ClassInfo("aaa", null, null, null)));

    assertFalse(MatchHelper.matchItem(patternMatcher, new ClassInfo("baaa", null, null, null)));

    assertTrue(MatchHelper.matchItem(patternMatcher, new ClassInfo("aaa", "coi.foo", null, null)));

    patternMatcher.setPattern("xx.aa");
    assertFalse(MatchHelper.matchItem(patternMatcher, new ClassInfo("aaa", "invalid.foo", null, null)));

    assertTrue(MatchHelper.matchItem(patternMatcher, new ClassInfo("aaa", "xx.foo", null, null)));

    patternMatcher.setPattern("xx.foo.aa");
    assertTrue(MatchHelper.matchItem(patternMatcher, new ClassInfo("aaa", "xx.foo.bar", null, null)));

    patternMatcher.setPattern("xx.foo.bar.aa");
    assertTrue(MatchHelper.matchItem(patternMatcher, new ClassInfo("aaa", "xx.foo.bar", null, null)));

    patternMatcher.setPattern("xx.foo.bar.aa.aa");
    assertFalse(MatchHelper.matchItem(patternMatcher, new ClassInfo("aaa", "xx.foo.bar", null, null)));

    patternMatcher.setPattern("xx.foo.ba.aa");
    assertTrue(MatchHelper.matchItem(patternMatcher, new ClassInfo("aaa", "xx.foo.bar", null, null)));

    patternMatcher.setPattern("xx.fo*o.ba.aa");
    assertTrue(MatchHelper.matchItem(patternMatcher, new ClassInfo("aaa", "xx.foo.bar", null, null)));

    patternMatcher.setPattern("coi*.intersection");
    assertTrue(MatchHelper.matchItem(patternMatcher,
            new ClassInfo("Intersection", "coilib50.basic.native", null, null)));

    patternMatcher.setPattern("coilib50.intersection");
    assertTrue(MatchHelper.matchItem(patternMatcher,
            new ClassInfo("Intersection", "coilib50.basic.native", null, null)));

    patternMatcher.setPattern("coilib50.");
    assertTrue(MatchHelper.matchItem(patternMatcher,
            new ClassInfo("Intersection", "coilib50.basic.native", null, null)));
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:45,代码来源:GlobalsTwoPanelElementSelector2Test.java


注:本文中的org.eclipse.ui.dialogs.SearchPattern.setPattern方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。