boolean (PsiElement @NotNull [] elements) { if (elements.length != 1) { return false; } final PsiElement element = elements[0]; final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class, false); return containingMethod != null; }