void () { ThreadingAssertions.assertEventDispatchThread(); if (isDisposed()) return; Editor editor = getEditor(); Document document = editor.getDocument(); int documentTextLength = document.getTextLength(); if (documentTextLength > 0) { DocumentUtil.executeInBulk(document, () -> document.deleteString(0, documentTextLength)); } synchronized (LOCK) { clearHyperlinkAndFoldings(); } MarkupModel model = DocumentMarkupModel.forDocument(editor.getDocument(), getProject(), true); model.removeAllHighlighters(); // remove all empty highlighters leftovers if any editor.getInlayModel().getInlineElementsInRange(0, 0).forEach(Disposer::dispose); // remove inlays if any }