PsiElement (@NotNull PsiStatement statement, @NotNull PsiCodeBlock codeBlock) { PsiJavaToken lBrace = codeBlock.getLBrace(); PsiJavaToken rBrace = codeBlock.getRBrace(); if (lBrace == null || rBrace == null) return null; final PsiElement first = PsiTreeUtil.skipWhitespacesForward(lBrace); PsiElement added = null; if (first != rBrace) { assert first != null; added = statement.getParent().addRangeBefore(first, rBrace.getPrevSibling(), statement); final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(statement.getManager()); codeStyleManager.reformat(added); } statement.delete(); return added; }