void (@NotNull ListSelectionEvent e) { clearSelection(); updateDialectsCombo(null); updateExtensionsCombo(); int ind = myRefs.getSelectedIndex(); PsiElement element = getPsiElement(); if (ind > -1 && element != null) { PsiReference[] references = element.getReferences(); if (ind < references.length) { TextRange textRange = references[ind].getRangeInElement(); TextRange range = InjectedLanguageManager.getInstance(myProject).injectedToHost(element, element.getTextRange()); int start = range.getStartOffset(); PsiElement rootPsiElement = myTreeStructure.getRootPsiElement(); if (rootPsiElement != null) { int baseOffset = rootPsiElement.getTextRange().getStartOffset(); start -= baseOffset; } start += textRange.getStartOffset(); int end = start + textRange.getLength(); //todo[kb] probably move highlight color to the editor color scheme? TextAttributes highlightReferenceTextRange = new TextAttributes(null, null, JBColor.namedColor("PsiViewer.referenceHighlightColor", 0xA8C023), EffectType.BOLD_DOTTED_LINE, Font.PLAIN); myListenerHighlighter = myEditor.getMarkupModel() .addRangeHighlighter(start, end, HighlighterLayer.LAST, highlightReferenceTextRange, HighlighterTargetArea.EXACT_RANGE); } } }