void (final PsiClass aClass, final UsageInfo[] usages, final MyClassInstanceReferenceVisitor instanceReferenceVisitor) { ClassReferenceScanner referenceScanner = new ClassReferenceScanner(aClass) { @Override public PsiReference[] findReferences() { ArrayList<PsiReference> result = new ArrayList<>(); for (UsageInfo usage : usages) { if (usage instanceof MoveRenameUsageInfo && ((MoveRenameUsageInfo)usage).getReferencedElement() == aClass) { final PsiReference reference = usage.getReference(); if (reference != null) { result.add(reference); } } } return result.toArray(PsiReference.EMPTY_ARRAY); } }; referenceScanner.processReferences(new ClassInstanceScanner(aClass, instanceReferenceVisitor)); }