PsiCall (final PsiElement ref) { if (ref instanceof PsiCall call) { return call; } PsiElement parent = ref.getParent(); if (parent instanceof PsiCall call) { return call; } else if (parent instanceof PsiAnonymousClass) { return (PsiCall) parent.getParent(); } return null; }