void (@NotNull final EditorHighlighter highlighter) { assertIsDispatchThread(); final Document document = getDocument(); Disposer.dispose(myHighlighterDisposable); document.addDocumentListener(highlighter); myHighlighter = highlighter; myHighlighterDisposable = new Disposable() { @Override public void dispose() { document.removeDocumentListener(highlighter); } }; Disposer.register(myDisposable, myHighlighterDisposable); highlighter.setEditor(this); highlighter.setText(document.getImmutableCharSequence()); EditorHighlighterCache.rememberEditorHighlighterForCachesOptimization(document, highlighter); if (myPanel != null) { reinitSettings(); } }