Set<RangeHighlighter> (@NotNull Editor editor, boolean toCreate) { if (editor instanceof EditorWindow) { editor = ((EditorWindow)editor).getDelegate(); } Set<RangeHighlighter> highlighters = editor.getUserData(HIGHLIGHTER_SET_KEY); if (highlighters == null && toCreate) { highlighters = ((UserDataHolderEx)editor).putUserDataIfAbsent(HIGHLIGHTER_SET_KEY, new HashSet<>()); } return highlighters; }