PsiMethod (PsiElement element) { final PsiElement container = PsiTreeUtil.getParentOfType(element, PsiMethod.class, PsiClass.class, PsiLambdaExpression.class); return container instanceof PsiMethod ? (PsiMethod)container : null; }