boolean (PsiElement element) { if (element instanceof PsiEnumConstant) { return JavaLanguage.INSTANCE.equals(element.getLanguage()); } if (!(element instanceof PsiJavaCodeReferenceElement)) return false; PsiElement parent = element.getParent(); if (parent instanceof PsiCall) { return true; } else if (parent instanceof PsiAnonymousClass) { return element.equals(((PsiAnonymousClass)parent).getBaseClassReference()); } return false; }