Collection<PsiReference> (SearchScope referencesSearchScope) { Query<PsiReference> search = ReferencesSearch.search(myElementToRename, referencesSearchScope, false); CommonProcessors.CollectProcessor<PsiReference> processor = new CommonProcessors.CollectProcessor<>() { @Override protected boolean accept(PsiReference reference) { ProgressManager.checkCanceled(); return acceptReference(reference); } }; search.forEach(processor); return processor.getResults(); }