void (Editor e, final XPathExpression expression) { final Editor editor = (e instanceof EditorWindow) ? ((EditorWindow)e).getDelegate() : e; final HighlightManager highlightManager = HighlightManager.getInstance(expression.getProject()); final Set<XPathExpression> matchingExpressions = RefactoringUtil.collectMatchingExpressions(expression); final List<XmlTag> otherMatches = new ArrayList<>(matchingExpressions.size()); final ArrayList<RangeHighlighter> highlighters = new ArrayList<>(matchingExpressions.size() + 1); if (matchingExpressions.size() > 0) { final SelectionModel selectionModel = editor.getSelectionModel(); highlightManager.addRangeHighlight(editor, selectionModel.getSelectionStart(), selectionModel.getSelectionEnd(), EditorColors.SEARCH_RESULT_ATTRIBUTES, false, highlighters); for (XPathExpression expr : matchingExpressions) { final TextRange range = XsltCodeInsightUtil.getRangeInsideHostingFile(expr); highlightManager.addRangeHighlight(editor, range.getStartOffset(), range.getEndOffset(), EditorColors.SEARCH_RESULT_ATTRIBUTES, false, highlighters); final XmlTag tag = PsiTreeUtil.getContextOfType(expr, XmlTag.class, true); assert tag != null; otherMatches.add(tag); } } final Settings dlg = getSettings(expression, matchingExpressions); if (dlg == null || dlg.isCanceled()) return; if (getCommandName() != null) { WriteCommandAction.writeCommandAction(e.getProject()).withName(getCommandName()).run(() -> { if (extractImpl(expression, matchingExpressions, otherMatches, dlg)) { for (RangeHighlighter highlighter : highlighters) { highlighter.dispose(); } }}); } else { extractImpl(expression, matchingExpressions, otherMatches, dlg); } }