boolean (@NotNull PsiElement element, int offsetInElement, @NotNull final Processor<? super PsiReference> consumer) { if (!myTarget.isValid()) { return false; } final List<PsiReference> references = PsiReferenceService.getService().getReferences(element, new PsiReferenceService.Hints(myTarget, offsetInElement)); //noinspection ForLoopReplaceableByForEach for (int i = 0; i < references.size(); i++) { PsiReference ref = references.get(i); ProgressManager.checkCanceled(); if (ReferenceRange.containsOffsetInElement(ref, offsetInElement) && ref.isReferenceTo(myTarget) && !consumer.process(ref)) { return false; } } return true; }