void (int lineCount) { List<RangeMarker> markers = new ArrayList<>(); try { myIndicator.setText2(CodeInsightBundle.message("progress.text.converting.end.of.line.comments")); convertEndComments(lineCount); myIndicator.setText2(CodeInsightBundle.message("progress.text.removing.line.breaks")); int newCount = processRawJoiners(lineCount); DocumentUtil.executeInBulk(myDoc, newCount > 100, () -> removeLineBreaks(newCount, markers)); myIndicator.setText2(CodeInsightBundle.message("progress.text.postprocessing")); List<RangeMarker> unprocessed = processNonRawJoiners(markers); myIndicator.setText2(CodeInsightBundle.message("progress.text.adjusting.white.space")); adjustWhiteSpace(unprocessed); } finally { markers.forEach(RangeMarker::dispose); } }