boolean (@Nullable PsiStatement statement) { if (statement instanceof PsiIfStatement) { final PsiStatement elseBranch = ((PsiIfStatement)statement).getElseBranch(); return elseBranch == null || hasShortIf(elseBranch); } if (statement instanceof PsiLabeledStatement) { return hasShortIf(((PsiLabeledStatement)statement).getStatement()); } if (statement instanceof PsiWhileStatement || statement instanceof PsiForStatement || statement instanceof PsiForeachStatement) { return hasShortIf(((PsiLoopStatement)statement).getBody()); } return false; }