void (@NotNull PsiElement toSelect, @Nullable TextRange selectRangeInEditor) { if (selectRangeInEditor != null) { int start = selectRangeInEditor.getStartOffset(); int end = selectRangeInEditor.getEndOffset(); clearSelection(); if (end <= myEditor.getDocument().getTextLength()) { myHighlighter = myEditor.getMarkupModel() .addRangeHighlighter(start, end, HighlighterLayer.LAST, myAttributes, HighlighterTargetArea.EXACT_RANGE); myEditor.getCaretModel().moveToOffset(start); myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); } } updateReferences(toSelect); if (!myPsiTree.hasFocus()) { selectElement(toSelect); } }