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


Java SearchMatch.A_ACCURATE属性代码示例

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


在下文中一共展示了SearchMatch.A_ACCURATE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rewriteCompilationUnit

protected void rewriteCompilationUnit(ICompilationUnit unit,
		Collection matches, CompilationUnit node, RefactoringStatus status,
		IProgressMonitor monitor) throws CoreException {
	final ASTRewrite astRewrite = ASTRewrite.create(node.getAST());
	final ImportRewrite importRewrite = ImportRewrite.create(node, true);

	for (final Iterator it = matches.iterator(); it.hasNext();) {
		final SearchMatch match = (SearchMatch) it.next();
		if (match.getAccuracy() == SearchMatch.A_ACCURATE
				&& !match.isInsideDocComment())
			if (this.matchToPurposeMap.get(match) == SearchMatchPurpose.ALTER_TYPE_DECLARATION
					|| this.matchToPurposeMap.get(match) == SearchMatchPurpose.ALTER_NAMESPACE_PREFIX)
				this.rewriteDeclarationsAndNamespaces(node, match, status,
						astRewrite, importRewrite);
			else if (this.matchToPurposeMap.get(match) == SearchMatchPurpose.ALTER_INFIX_EXPRESSION)
				this.rewriteExpressions(node, match, status, astRewrite,
						importRewrite);
	}

	this.rewriteAST(unit, astRewrite, importRewrite);
}
 
开发者ID:ponder-lab,项目名称:Constants-to-Enum-Eclipse-Plugin,代码行数:21,代码来源:ConvertConstantsToEnumRefactoring.java

示例2: findParameters

private void findParameters(final int paramNumber, SearchPattern pattern)
		throws CoreException {

	final SearchRequestor requestor = new SearchRequestor() {

		public void acceptSearchMatch(SearchMatch match)
				throws CoreException {
			if (match.getAccuracy() == SearchMatch.A_ACCURATE
					&& !match.isInsideDocComment()) {
				IJavaElement elem = (IJavaElement) match.getElement();
				ASTNode node = Util.getASTNode(elem,
						ASTNodeProcessor.this.monitor);
				ParameterProcessingVisitor visitor = new ParameterProcessingVisitor(
						paramNumber, match.getOffset());
				node.accept(visitor);
				ASTNodeProcessor.this.found.addAll(visitor.getElements());

				for (Iterator it = visitor.getExpressions().iterator(); it
						.hasNext();) {
					Expression exp = (Expression) it.next();
					ASTNodeProcessor.this.processExpression(exp);
				}
			}
		}
	};

	final SearchEngine searchEngine = new SearchEngine();
	searchEngine.search(pattern, new SearchParticipant[] { SearchEngine
			.getDefaultSearchParticipant() }, this.scope, requestor, null);
}
 
开发者ID:ponder-lab,项目名称:Constants-to-Enum-Eclipse-Plugin,代码行数:30,代码来源:ASTNodeProcessor.java

示例3: findNonPrimaryType

private IType findNonPrimaryType(
    String fullyQualifiedName, IProgressMonitor pm, RefactoringStatus status)
    throws JavaModelException {
  SearchPattern p =
      SearchPattern.createPattern(
          fullyQualifiedName,
          IJavaSearchConstants.TYPE,
          IJavaSearchConstants.DECLARATIONS,
          SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
  final RefactoringSearchEngine2 engine = new RefactoringSearchEngine2(p);

  engine.setFiltering(true, true);
  engine.setScope(RefactoringScopeFactory.create(fCtorBinding.getJavaElement().getJavaProject()));
  engine.setStatus(status);
  engine.searchPattern(new SubProgressMonitor(pm, 1));

  SearchResultGroup[] groups = (SearchResultGroup[]) engine.getResults();

  if (groups.length != 0) {
    for (int i = 0; i < groups.length; i++) {
      SearchMatch[] matches = groups[i].getSearchResults();
      for (int j = 0; j < matches.length; j++) {
        if (matches[j].getAccuracy() == SearchMatch.A_ACCURATE)
          return (IType) matches[j].getElement();
      }
    }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:IntroduceFactoryRefactoring.java

示例4: filterMatch

/**
 * Returns whether the given match should be filtered out. The default implementation filters out
 * matches in binaries iff {@link #CollectingSearchRequestor(ReferencesInBinaryContext)} has been
 * called with a non-<code>null</code> argument. Accurate binary matches are added to the {@link
 * ReferencesInBinaryContext}.
 *
 * @param match the match to test
 * @return <code>true</code> iff the given match should <em>not</em> be collected
 * @throws CoreException
 */
public boolean filterMatch(SearchMatch match) throws CoreException {
  if (fBinaryRefs == null) return false;

  if (match.getAccuracy() == SearchMatch.A_ACCURATE && isBinaryElement(match.getElement())) {
    // binary classpaths are often incomplete -> avoiding false positives from inaccurate matches
    fBinaryRefs.add(match);
    return true;
  }

  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:CollectingSearchRequestor.java

示例5: acceptSearchMatch

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
  if (match.getAccuracy() == SearchMatch.A_ACCURATE && !match.isInsideDocComment()) {
    Object element = match.getElement();
    if (element instanceof IType || element instanceof IMethod) {
      IMember member = (IMember) element;
      IType type =
          member.getElementType() == IJavaElement.TYPE
              ? (IType) member
              : member.getDeclaringType();
      addTypeAndSubtypes(type);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:AnnotationSearchRequestor.java


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