PsiElement (PsiIfStatement ifStatement) { PsiElement e = PsiTreeUtil.getParentOfType(ifStatement, PsiMethod.class, PsiClassInitializer.class, PsiLambdaExpression.class); if (e instanceof PsiMethod) return ((PsiMethod) e).getBody(); if (e instanceof PsiLambdaExpression) return ((PsiLambdaExpression)e).getBody(); if (e instanceof PsiClassInitializer) return ((PsiClassInitializer) e).getBody(); return null; }