void () { ThreadingAssertions.assertEventDispatchThread(); if (!myFlushAlarm.isEmpty()) { cancelAllFlushRequests(); flushDeferredText(); } Editor editor = getEditor(); FoldingModel model = editor.getFoldingModel(); model.runBatchFoldingOperation(() -> { for (FoldRegion region : model.getAllFoldRegions()) { model.removeFoldRegion(region); } }); updateFoldings(0, editor.getDocument().getLineCount() - 1); }