void (final Editor editor, final PsiFile file, final Document document, final Project project, RangeMarker range) { final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project); int line1 = editor.offsetToLogicalPosition(range.getStartOffset()).line; int line2 = editor.offsetToLogicalPosition(range.getEndOffset()).line; while (!lineContainsNonSpaces(document, line1) && line1 < line2) line1++; while (!lineContainsNonSpaces(document, line2) && line1 < line2) line2--; final FileViewProvider provider = file.getViewProvider(); PsiFile rootToAdjustIndentIn = provider.getPsi(provider.getBaseLanguage()); codeStyleManager.adjustLineIndent(rootToAdjustIndentIn, new TextRange(document.getLineStartOffset(line1), document.getLineStartOffset(line2))); }