@Override public void setHighlighter(@Nonnull final EditorHighlighter highlighter) { if (isReleased) return; // do not set highlighter to the released editor assertIsDispatchThread(); final Document document = getDocument(); Disposer.dispose(myHighlighterDisposable); document.addDocumentListener(highlighter); myHighlighter = highlighter; myHighlighterDisposable = () -> document.removeDocumentListener(highlighter); Disposer.register(myDisposable, myHighlighterDisposable); highlighter.setEditor(this); highlighter.setText(document.getImmutableCharSequence()); if (!(highlighter instanceof EmptyEditorHighlighter)) { EditorHighlighterCache.rememberEditorHighlighterForCachesOptimization(document, highlighter); } if (myPanel != null) { reinitSettings(); } }
@NotNull public static EditorHighlighter createEmptyEditorHighlighter() { return new EmptyEditorHighlighter(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(HighlighterColors.TEXT)); }
@Nonnull private static EditorHighlighter createEmptyEditorHighlighter() { return new EmptyEditorHighlighter(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(HighlighterColors.TEXT)); }