use of org.eclipse.jdt.internal.corext.refactoring.CollectingSearchRequestor in project che by eclipse.
the class RenameFieldProcessor method getNewReferences.
private SearchResultGroup[] getNewReferences(IProgressMonitor pm, RefactoringStatus status, WorkingCopyOwner owner, ICompilationUnit[] newWorkingCopies) throws CoreException {
//$NON-NLS-1$
pm.beginTask("", 2);
ICompilationUnit declaringCuWorkingCopy = RenameAnalyzeUtil.findWorkingCopyForCu(newWorkingCopies, fField.getCompilationUnit());
if (declaringCuWorkingCopy == null)
return new SearchResultGroup[0];
IField field = getFieldInWorkingCopy(declaringCuWorkingCopy, getNewElementName());
if (field == null || !field.exists())
return new SearchResultGroup[0];
CollectingSearchRequestor requestor = null;
if (fDelegateUpdating && RefactoringAvailabilityTester.isDelegateCreationAvailable(getField())) {
// There will be two new matches inside the delegate (the invocation
// and the javadoc) which are OK and must not be reported.
final IField oldField = getFieldInWorkingCopy(declaringCuWorkingCopy, getCurrentElementName());
requestor = new CollectingSearchRequestor() {
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (!oldField.equals(match.getElement()))
super.acceptSearchMatch(match);
}
};
} else
requestor = new CollectingSearchRequestor();
SearchPattern newPattern = SearchPattern.createPattern(field, IJavaSearchConstants.REFERENCES);
IJavaSearchScope scope = RefactoringScopeFactory.create(fField, true, true);
return RefactoringSearchEngine.search(newPattern, owner, scope, requestor, new SubProgressMonitor(pm, 1), status);
}
use of org.eclipse.jdt.internal.corext.refactoring.CollectingSearchRequestor in project che by eclipse.
the class ReferenceFinderUtil method getTypeReferencesIn.
private static List<SearchMatch> getTypeReferencesIn(IJavaElement element, WorkingCopyOwner owner, IProgressMonitor pm) throws JavaModelException {
CollectingSearchRequestor requestor = new CollectingSearchRequestor();
SearchEngine engine = owner != null ? new SearchEngine(owner) : new SearchEngine();
engine.searchDeclarationsOfReferencedTypes(element, requestor, pm);
return requestor.getResults();
}
use of org.eclipse.jdt.internal.corext.refactoring.CollectingSearchRequestor in project che by eclipse.
the class ReferenceFinderUtil method getMethodReferencesIn.
private static List<SearchMatch> getMethodReferencesIn(IJavaElement element, WorkingCopyOwner owner, IProgressMonitor pm) throws JavaModelException {
CollectingSearchRequestor requestor = new CollectingSearchRequestor();
SearchEngine engine = owner != null ? new SearchEngine(owner) : new SearchEngine();
engine.searchDeclarationsOfSentMessages(element, requestor, pm);
return requestor.getResults();
}
use of org.eclipse.jdt.internal.corext.refactoring.CollectingSearchRequestor in project che by eclipse.
the class ReferenceFinderUtil method getFieldReferencesIn.
private static List<SearchMatch> getFieldReferencesIn(IJavaElement element, WorkingCopyOwner owner, IProgressMonitor pm) throws JavaModelException {
CollectingSearchRequestor requestor = new CollectingSearchRequestor();
SearchEngine engine = owner != null ? new SearchEngine(owner) : new SearchEngine();
engine.searchDeclarationsOfAccessedFields(element, requestor, pm);
return requestor.getResults();
}
Aggregations