From 3ac4f199051dc3f094f7c25099c65ed22df142da Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 9 Sep 2019 15:35:19 +0300 Subject: [PATCH] rename class to avoid confusion with existing GitOrigin-RevId: 24493014b6440ce2015dd1ed1c7163fcd7ab2817 --- .../highlighting/HighlightManagerImpl.java | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java index 3f3dcc0de756..f3f0c5b67a1c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java @@ -50,12 +50,12 @@ public class HighlightManagerImpl extends HighlightManager { Document document = event.getDocument(); Editor[] editors = EditorFactory.getInstance().getEditors(document); for (Editor editor : editors) { - Map map = getHighlightInfoMap(editor, false); + Map map = getHighlightInfoMap(editor, false); if (map == null) return; ArrayList highlightersToRemove = new ArrayList<>(); for (RangeHighlighter highlighter : map.keySet()) { - HighlightInfo info = map.get(highlighter); + HighlightFlags info = map.get(highlighter); if (!info.editor.getDocument().equals(document)) continue; if (BitUtil.isSet(info.flags, HIDE_BY_TEXT_CHANGE)) { highlightersToRemove.add(highlighter); @@ -72,11 +72,11 @@ public class HighlightManagerImpl extends HighlightManager { } @Nullable - private Map getHighlightInfoMap(@NotNull Editor editor, boolean toCreate) { + private Map getHighlightInfoMap(@NotNull Editor editor, boolean toCreate) { if (editor instanceof EditorWindow) { editor = ((EditorWindow)editor).getDelegate(); } - Map map = editor.getUserData(HIGHLIGHT_INFO_MAP_KEY); + Map map = editor.getUserData(HIGHLIGHT_INFO_MAP_KEY); if (map == null && toCreate) { map = ((UserDataHolderEx)editor).putUserDataIfAbsent(HIGHLIGHT_INFO_MAP_KEY, new HashMap<>()); } @@ -85,11 +85,11 @@ public class HighlightManagerImpl extends HighlightManager { @NotNull public RangeHighlighter[] getHighlighters(@NotNull Editor editor) { - Map highlightersMap = getHighlightInfoMap(editor, false); + Map highlightersMap = getHighlightInfoMap(editor, false); if (highlightersMap == null) return RangeHighlighter.EMPTY_ARRAY; Set set = new HashSet<>(); - for (Map.Entry entry : highlightersMap.entrySet()) { - HighlightInfo info = entry.getValue(); + for (Map.Entry entry : highlightersMap.entrySet()) { + HighlightFlags info = entry.getValue(); if (info.editor.equals(editor)) set.add(entry.getKey()); } return set.toArray(RangeHighlighter.EMPTY_ARRAY); @@ -98,17 +98,17 @@ public class HighlightManagerImpl extends HighlightManager { private RangeHighlighter addSegmentHighlighter(@NotNull Editor editor, int startOffset, int endOffset, TextAttributes attributes, @HideFlags int flags) { RangeHighlighter highlighter = editor.getMarkupModel() .addRangeHighlighter(startOffset, endOffset, HighlighterLayer.SELECTION - 1, attributes, HighlighterTargetArea.EXACT_RANGE); - HighlightInfo info = new HighlightInfo(editor instanceof EditorWindow ? ((EditorWindow)editor).getDelegate() : editor, flags); - Map map = getHighlightInfoMap(editor, true); + HighlightFlags info = new HighlightFlags(editor instanceof EditorWindow ? ((EditorWindow)editor).getDelegate() : editor, flags); + Map map = getHighlightInfoMap(editor, true); map.put(highlighter, info); return highlighter; } @Override public boolean removeSegmentHighlighter(@NotNull Editor editor, @NotNull RangeHighlighter highlighter) { - Map map = getHighlightInfoMap(editor, false); + Map map = getHighlightInfoMap(editor, false); if (map == null) return false; - HighlightInfo info = map.get(highlighter); + HighlightFlags info = map.get(highlighter); if (info == null) return false; MarkupModel markupModel = info.editor.getMarkupModel(); if (((MarkupModelEx)markupModel).containsHighlighter(highlighter)) { @@ -246,13 +246,13 @@ public class HighlightManagerImpl extends HighlightManager { } public boolean hideHighlights(@NotNull Editor editor, @HideFlags int mask) { - Map map = getHighlightInfoMap(editor, false); + Map map = getHighlightInfoMap(editor, false); if (map == null) return false; boolean done = false; List highlightersToRemove = new ArrayList<>(); for (RangeHighlighter highlighter : map.keySet()) { - HighlightInfo info = map.get(highlighter); + HighlightFlags info = map.get(highlighter); if (!info.editor.equals(editor)) continue; if ((info.flags & mask) != 0) { highlightersToRemove.add(highlighter); @@ -268,9 +268,9 @@ public class HighlightManagerImpl extends HighlightManager { } boolean hasHideByEscapeHighlighters(@NotNull Editor editor) { - Map map = getHighlightInfoMap(editor, false); + Map map = getHighlightInfoMap(editor, false); if (map != null) { - for (HighlightInfo info : map.values()) { + for (HighlightFlags info : map.values()) { if (!info.editor.equals(editor)) continue; if ((info.flags & HIDE_BY_ESCAPE) != 0) { return true; @@ -299,13 +299,14 @@ public class HighlightManagerImpl extends HighlightManager { } - private final Key> HIGHLIGHT_INFO_MAP_KEY = Key.create("HIGHLIGHT_INFO_MAP_KEY"); + private final Key> HIGHLIGHT_INFO_MAP_KEY = Key.create("HIGHLIGHT_INFO_MAP_KEY"); - private static class HighlightInfo { + private static class HighlightFlags { + @NotNull final Editor editor; @HideFlags final int flags; - HighlightInfo(Editor editor, @HideFlags int flags) { + HighlightFlags(@NotNull Editor editor, @HideFlags int flags) { this.editor = editor; this.flags = flags; }