void (Project project, Editor editor, PsiCodeBlock finallyBlock) { Document document = editor.getDocument(); PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(document); TextRange finallyBlockRange = finallyBlock.getTextRange(); int newLineOffset = finallyBlockRange.getStartOffset() + 2; editor.getCaretModel().moveToOffset(newLineOffset); editor.getSelectionModel().removeSelection(); CodeStyleManager.getInstance(project).adjustLineIndent(document, newLineOffset); PsiDocumentManager.getInstance(project).commitDocument(document); }