List<HighlightInfo> () { clearLineMarkers(myEditor); int count = myPairsToHighlight.size(); List<HighlightInfo> highlightInfos = new ArrayList<>(count * 2); MarkupModel markupModel = myEditor.getMarkupModel(); Color[] baseColors = XmlTagTreeHighlightingUtil.getBaseColors(); Color[] colorsForEditor = count > 1 ? toColorsForEditor(baseColors) : new Color[] {myEditor.getColorsScheme().getAttributes(XmlHighlighterColors.MATCHED_TAG_NAME).getBackgroundColor()}; Color[] colorsForLineMarkers = toColorsForLineMarkers(baseColors); List<RangeHighlighter> newHighlighters = new ArrayList<>(); assert colorsForEditor.length > 0; for (int i = 0; i < count && i < baseColors.length; i++) { Pair<TextRange, TextRange> pair = myPairsToHighlight.get(i); if (pair.first == null && pair.second == null) { continue; } Color color = colorsForEditor[i]; if (color == null) { continue; } if (pair.first != null && !pair.first.isEmpty()) { highlightInfos.add(createHighlightInfo(color, pair.first)); } if (pair.second != null && !pair.second.isEmpty()) { highlightInfos.add(createHighlightInfo(color, pair.second)); } int start = pair.first != null ? pair.first.getStartOffset() : pair.second.getStartOffset(); int end = pair.second != null ? pair.second.getEndOffset() : pair.first.getEndOffset(); Color lineMarkerColor = colorsForLineMarkers[i]; if (count > 1 && lineMarkerColor != null && start != end) { RangeHighlighter highlighter = createHighlighter(markupModel, new TextRange(start, end), lineMarkerColor); newHighlighters.add(highlighter); } } myEditor.putUserData(TAG_TREE_HIGHLIGHTERS_IN_EDITOR_KEY, newHighlighters); return highlightInfos; }