void (@NotNull Editor editor, @Nullable Caret caret, DataContext dataContext) { if (editor.getUserData(Holder.LISTENER_ADDED) != null) cleanup(editor); HighlighterIterator it = editor.getHighlighter().createIterator(0); while (!it.atEnd()) { RangeHighlighter h = editor.getMarkupModel().addRangeHighlighter(it.getStart(), it.getEnd(), 0, Holder.OUR_TEXT_ATTRIBUTES, HighlighterTargetArea.EXACT_RANGE); IElementType tokenType = it.getTokenType(); h.putUserData(Holder.TOKEN_NAME, String.valueOf(tokenType)); it.advance(); } editor.addEditorMouseMotionListener(Holder.MOUSE_MOTION_LISTENER); editor.putUserData(Holder.LISTENER_ADDED, true); if (!ourEscHandlerInstalled) { //noinspection AssignmentToStaticFieldFromInstanceMethod ourEscHandlerInstalled = true; EditorActionHandler currentHandler = EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_ESCAPE); EditorActionManager.getInstance().setActionHandler(IdeActions.ACTION_EDITOR_ESCAPE, new EscapeHandler(currentHandler)); } }