PsiJavaCodeReferenceElement (PsiReferenceList refList, PsiClass aClass) { PsiJavaCodeReferenceElement[] refs = refList.getReferenceElements(); for (PsiJavaCodeReferenceElement ref : refs) { if (ref.isReferenceTo(aClass)) { return ref; } } return null; }