void (@NotNull ActionContext context, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final PsiIfStatement ifStatement = PsiTreeUtil.getParentOfType(element, PsiIfStatement.class); if (ifStatement == null) { return; } final PsiElementFactory factory = JavaPsiFacade.getElementFactory(context.project()); final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(context.project()); CommentTracker tracker = new CommentTracker(); final PsiStatement newIfStatement = create(factory, ifStatement, element, tracker); if (newIfStatement == null) { return; } codeStyleManager.reformat(tracker.replaceAndRestoreComments(ifStatement, newIfStatement)); }