PsiCall (PsiElement ref) { if (ref instanceof PsiCall) return (PsiCall)ref; PsiElement parent = ref.getParent(); if (parent instanceof PsiMethodCallExpression) { return (PsiMethodCallExpression)parent; } else if (parent instanceof PsiNewExpression) { return (PsiNewExpression)parent; } else if (parent instanceof PsiAnonymousClass) { return (PsiNewExpression)parent.getParent(); } else { LOG.assertTrue(false); return null; } }