boolean (PsiStatement statement) { if (PsiTreeUtil.skipWhitespacesAndCommentsForward(statement) instanceof PsiStatement) { return true; } PsiElement parent = statement.getParent(); if (parent instanceof PsiCodeBlock) { PsiElement gParent = parent.getParent(); if (gParent instanceof PsiBlockStatement) { return shouldKeepBreak((PsiStatement)gParent); } } else if (parent instanceof PsiLabeledStatement || parent instanceof PsiIfStatement) { return shouldKeepBreak((PsiStatement)parent); } else if (parent instanceof PsiSwitchLabeledRuleStatement) { return false; } return true; }