List<HighlightData> (final EditorEx editor, final String attrKey, final SyntaxHighlighter highlighter, final boolean show, final Alarm alarm, final int count, final ColorSettingsPage page) { if (show && count <= 0) return Collections.emptyList(); removeDecorations(); boolean found = false; List<HighlightData> highlights = new ArrayList<>(); List<HighlightData> matchingHighlights = new ArrayList<>(); for (HighlightData highlightData : myHighlightData) { boolean highlight = show && (highlightData.getHighlightType().equals(attrKey) || highlightData.getAdditionalColorKey() != null && highlightData.getAdditionalColorKey().getExternalName().equals(attrKey)); highlightData.addToCollection(highlights, highlight); if (highlight) { matchingHighlights.add(highlightData); found = true; } } if (show && !found && highlighter != null) { HighlighterIterator iterator = editor.getHighlighter().createIterator(0); do { IElementType tokenType = iterator.getTokenType(); TextAttributesKey[] tokenHighlights = highlighter.getTokenHighlights(tokenType); for (final TextAttributesKey tokenHighlight : tokenHighlights) { String type = tokenHighlight.getExternalName(); if (type.equals(attrKey)) { HighlightData highlightData = new HighlightData(iterator.getStart(), iterator.getEnd(), CodeInsightColors.BLINKING_HIGHLIGHTS_ATTRIBUTES); highlights.add(highlightData); matchingHighlights.add(highlightData); } } iterator.advance(); } while (!iterator.atEnd()); } final Map<TextAttributesKey, String> displayText = ColorSettingsUtil.keyToDisplayTextMap(page); // sort highlights to avoid overlappings highlights.sort(Comparator.comparingInt(HighlightData::getStartOffset)); for (int i = highlights.size() - 1; i >= 0; i--) { HighlightData highlightData = highlights.get(i); int startOffset = highlightData.getStartOffset(); HighlightData prevHighlightData = i == 0 ? null : highlights.get(i - 1); if (prevHighlightData != null && startOffset <= prevHighlightData.getEndOffset() && highlightData.getHighlightType().equals(prevHighlightData.getHighlightType())) { prevHighlightData.setEndOffset(highlightData.getEndOffset()); } else { highlightData.addHighlToView(editor, myEditor.getColorsScheme(), displayText); } } if (myCustomizer != null) { TextRange range = myCustomizer.addCustomizations(myEditor, show ? attrKey : null); if (range != null) { matchingHighlights.add(new HighlightData(range.getStartOffset(), range.getEndOffset(), null)); } } alarm.cancelAllRequests(); alarm.addComponentRequest(() -> startBlinkingHighlights(editor, attrKey, highlighter, !show, alarm, count - 1, page), 400); return matchingHighlights; }