List<RangeHighlighter> (Project project, PsiElement[] occurrences, Editor editor) { ArrayList<RangeHighlighter> highlighters = new ArrayList<>(); HighlightManager highlightManager = HighlightManager.getInstance(project); if (occurrences.length > 1) { for (PsiElement occurrence : occurrences) { final RangeMarker rangeMarker = occurrence.getUserData(ElementToWorkOn.TEXT_RANGE); if (rangeMarker != null && rangeMarker.isValid()) { highlightManager.addRangeHighlight(editor, rangeMarker.getStartOffset(), rangeMarker.getEndOffset(), EditorColors.SEARCH_RESULT_ATTRIBUTES, true, highlighters); } else { final TextRange textRange = occurrence.getTextRange(); highlightManager.addRangeHighlight(editor, textRange.getStartOffset(), textRange.getEndOffset(), EditorColors.SEARCH_RESULT_ATTRIBUTES, true, highlighters); } } } return highlighters; }