void (@NotNull Project project, @NotNull PsiElement startElement, @NotNull ModPsiUpdater updater) { PsiIfStatement ifStatement = tryCast(startElement.getParent(), PsiIfStatement.class); if (ifStatement == null || ifStatement.getElseBranch() != null) return; PsiStatement thenBranch = ifStatement.getThenBranch(); if (thenBranch == null) return; PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory(); PsiStatement breakStatement = factory.createStatementFromText("break;", null); PsiCodeBlock block = getBlock(thenBranch); if (block == null) return; block.addBefore(breakStatement, block.getLastChild()); CodeStyleManager.getInstance(project).reformat(ifStatement); }