本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor类的典型用法代码示例。如果您正苦于以下问题:Java CuCollectingSearchRequestor类的具体用法?Java CuCollectingSearchRequestor怎么用?Java CuCollectingSearchRequestor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CuCollectingSearchRequestor类属于org.eclipse.jdt.internal.corext.refactoring包,在下文中一共展示了CuCollectingSearchRequestor类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReferences
import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] getReferences(IProgressMonitor pm, RefactoringStatus status)
throws CoreException {
String binaryRefsDescription =
Messages.format(
RefactoringCoreMessages.ReferencesInBinaryContext_ref_in_binaries_description,
BasicElementLabels.getJavaElementName(getCurrentElementName()));
ReferencesInBinaryContext binaryRefs = new ReferencesInBinaryContext(binaryRefsDescription);
SearchResultGroup[] result =
RefactoringSearchEngine.search(
createSearchPattern(),
createRefactoringScope(),
new CuCollectingSearchRequestor(binaryRefs),
pm,
status);
binaryRefs.addErrorIfNecessary(status);
return result;
}
示例2: getReferencesToTypesInPackage
import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private List<SearchResultGroup> getReferencesToTypesInPackage(IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status) throws CoreException {
pm.beginTask("", 2); //$NON-NLS-1$
IJavaSearchScope referencedFromNamesakesScope= RefactoringScopeFactory.create(fPackage, true, false);
IPackageFragment[] namesakePackages= getNamesakePackages(referencedFromNamesakesScope, new SubProgressMonitor(pm, 1));
if (namesakePackages.length == 0) {
pm.done();
return new ArrayList<SearchResultGroup>(0);
}
IJavaSearchScope scope= SearchEngine.createJavaSearchScope(namesakePackages);
IType[] typesToSearch= getTypesInPackage(fPackage);
if (typesToSearch.length == 0) {
pm.done();
return new ArrayList<SearchResultGroup>(0);
}
SearchPattern pattern= RefactoringSearchEngine.createOrPattern(typesToSearch, IJavaSearchConstants.REFERENCES);
CollectingSearchRequestor requestor= new CuCollectingSearchRequestor(binaryRefs);
SearchResultGroup[] results= RefactoringSearchEngine.search(pattern, scope, requestor, new SubProgressMonitor(pm, 1), status);
pm.done();
return new ArrayList<SearchResultGroup>(Arrays.asList(results));
}
示例3: getReferences
import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] getReferences(
IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status)
throws CoreException {
IJavaSearchScope scope = RefactoringScopeFactory.create(fPackage, true, false);
SearchPattern pattern =
SearchPattern.createPattern(fPackage, IJavaSearchConstants.REFERENCES);
CollectingSearchRequestor requestor = new CuCollectingSearchRequestor(binaryRefs);
return RefactoringSearchEngine.search(pattern, scope, requestor, pm, status);
}
示例4: getReferencesToTypesInPackage
import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private List<SearchResultGroup> getReferencesToTypesInPackage(
IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status)
throws CoreException {
pm.beginTask("", 2); // $NON-NLS-1$
IJavaSearchScope referencedFromNamesakesScope =
RefactoringScopeFactory.create(fPackage, true, false);
IPackageFragment[] namesakePackages =
getNamesakePackages(referencedFromNamesakesScope, new SubProgressMonitor(pm, 1));
if (namesakePackages.length == 0) {
pm.done();
return new ArrayList<SearchResultGroup>(0);
}
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(namesakePackages);
IType[] typesToSearch = getTypesInPackage(fPackage);
if (typesToSearch.length == 0) {
pm.done();
return new ArrayList<SearchResultGroup>(0);
}
SearchPattern pattern =
RefactoringSearchEngine.createOrPattern(typesToSearch, IJavaSearchConstants.REFERENCES);
CollectingSearchRequestor requestor = new CuCollectingSearchRequestor(binaryRefs);
SearchResultGroup[] results =
RefactoringSearchEngine.search(
pattern, scope, requestor, new SubProgressMonitor(pm, 1), status);
pm.done();
return new ArrayList<SearchResultGroup>(Arrays.asList(results));
}
示例5: getReferences
import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] getReferences(IProgressMonitor pm, RefactoringStatus status) throws CoreException{
String binaryRefsDescription= Messages.format(RefactoringCoreMessages.ReferencesInBinaryContext_ref_in_binaries_description , BasicElementLabels.getJavaElementName(getCurrentElementName()));
ReferencesInBinaryContext binaryRefs= new ReferencesInBinaryContext(binaryRefsDescription);
SearchResultGroup[] result= RefactoringSearchEngine.search(createSearchPattern(), createRefactoringScope(),
new CuCollectingSearchRequestor(binaryRefs), pm, status);
binaryRefs.addErrorIfNecessary(status);
return result;
}
示例6: findOccurrences
import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] findOccurrences(
IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status)
throws JavaModelException {
final boolean isConstructor = fMethod.isConstructor();
CuCollectingSearchRequestor requestor =
new CuCollectingSearchRequestor(binaryRefs) {
@Override
protected void acceptSearchMatch(ICompilationUnit unit, SearchMatch match)
throws CoreException {
// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=27236 :
if (isConstructor && match instanceof MethodReferenceMatch) {
MethodReferenceMatch mrm = (MethodReferenceMatch) match;
if (mrm.isSynthetic()) {
return;
}
}
collectMatch(match);
}
};
SearchPattern pattern;
if (isConstructor) {
// // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=226151 : don't find
// binary refs for constructors for now
// return ConstructorReferenceFinder.getConstructorOccurrences(fMethod, pm, status);
// SearchPattern occPattern= SearchPattern.createPattern(fMethod,
// IJavaSearchConstants.ALL_OCCURRENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
SearchPattern declPattern =
SearchPattern.createPattern(
fMethod, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
SearchPattern refPattern =
SearchPattern.createPattern(
fMethod, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
// pattern= SearchPattern.createOrPattern(declPattern, refPattern);
// pattern= occPattern;
// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=226151 : do two searches
try {
SearchEngine engine = new SearchEngine();
engine.search(
declPattern,
SearchUtils.getDefaultSearchParticipants(),
createRefactoringScope(),
requestor,
new NullProgressMonitor());
engine.search(
refPattern,
SearchUtils.getDefaultSearchParticipants(),
createRefactoringScope(),
requestor,
pm);
} catch (CoreException e) {
throw new JavaModelException(e);
}
return RefactoringSearchEngine.groupByCu(requestor.getResults(), status);
} else {
pattern =
RefactoringSearchEngine.createOrPattern(
fRippleMethods, IJavaSearchConstants.ALL_OCCURRENCES);
}
return RefactoringSearchEngine.search(pattern, createRefactoringScope(), requestor, pm, status);
}
示例7: findOccurrences
import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] findOccurrences(IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status) throws JavaModelException{
final boolean isConstructor= fMethod.isConstructor();
CuCollectingSearchRequestor requestor= new CuCollectingSearchRequestor(binaryRefs) {
@Override
protected void acceptSearchMatch(ICompilationUnit unit, SearchMatch match) throws CoreException {
// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=27236 :
if (isConstructor && match instanceof MethodReferenceMatch) {
MethodReferenceMatch mrm= (MethodReferenceMatch) match;
if (mrm.isSynthetic()) {
return;
}
}
collectMatch(match);
}
};
SearchPattern pattern;
if (isConstructor) {
// // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=226151 : don't find binary refs for constructors for now
// return ConstructorReferenceFinder.getConstructorOccurrences(fMethod, pm, status);
// SearchPattern occPattern= SearchPattern.createPattern(fMethod, IJavaSearchConstants.ALL_OCCURRENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
SearchPattern declPattern= SearchPattern.createPattern(fMethod, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
SearchPattern refPattern= SearchPattern.createPattern(fMethod, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
// pattern= SearchPattern.createOrPattern(declPattern, refPattern);
// pattern= occPattern;
// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=226151 : do two searches
try {
SearchEngine engine= new SearchEngine();
engine.search(declPattern, SearchUtils.getDefaultSearchParticipants(), createRefactoringScope(), requestor, new NullProgressMonitor());
engine.search(refPattern, SearchUtils.getDefaultSearchParticipants(), createRefactoringScope(), requestor, pm);
} catch (CoreException e) {
throw new JavaModelException(e);
}
return RefactoringSearchEngine.groupByCu(requestor.getResults(), status);
} else {
pattern= RefactoringSearchEngine.createOrPattern(fRippleMethods, IJavaSearchConstants.ALL_OCCURRENCES);
}
return RefactoringSearchEngine.search(pattern, createRefactoringScope(), requestor, pm, status);
}
示例8: getReferences
import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] getReferences(IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status) throws CoreException {
IJavaSearchScope scope= RefactoringScopeFactory.create(fPackage, true, false);
SearchPattern pattern= SearchPattern.createPattern(fPackage, IJavaSearchConstants.REFERENCES);
CollectingSearchRequestor requestor= new CuCollectingSearchRequestor(binaryRefs);
return RefactoringSearchEngine.search(pattern, scope, requestor, pm, status);
}