PsiElement (PsiElement element) { PsiElement elem = element instanceof GrMethodCall ? ((GrMethodCall)element).getInvokedExpression() : element; final PsiReference ref = elem.getReference(); return ref == null ? null : ref.resolve(); }