void (EditorEx editor) { editor.getColorsScheme().setAttributes(EditorColors.FOLDED_TEXT_ATTRIBUTES, null); editor.reinitSettings(); FoldingModelEx foldingModel = editor.getFoldingModel(); CharSequence text = editor.getDocument().getCharsSequence(); foldingModel.runBatchFoldingOperation(() -> { foldingModel.clearFoldRegions(); for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '\n') { foldingModel.createFoldRegion(i, i + 1, "\u23ce", null, true); } } }); }