本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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);
}
}
}