boolean (PsiElement parent, PsiElement element) { if (element == null) { return false; } if (parent instanceof PsiIfStatement) { return (((PsiIfStatement)parent).getThenBranch() == element || ((PsiIfStatement)parent).getElseBranch() == element); } if (parent instanceof PsiLoopStatement) { return ((PsiLoopStatement)parent).getBody() == element; } return false; }