void (Editor editor) { final Project project = editor.getProject(); final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (psiFile == null) { return; } InputExpressionDialog.Context input; XmlElement contextNode = null; final Config cfg = XPathAppComponent.getInstance().getConfig(); do { RangeHighlighter contextHighlighter = null; if (cfg.isUseContextAtCursor()) { // find out current context node contextNode = MyPsiUtil.findContextNode(psiFile, editor); if (contextNode != null) { contextHighlighter = HighlighterUtil.highlightNode(editor, contextNode, cfg.getContextAttributes(), cfg); } } if (contextNode == null) { // in XPath data model, / is the document itself, including comments, PIs and the root element contextNode = ((XmlFile)psiFile).getDocument(); if (contextNode == null) { FileViewProvider fileViewProvider = psiFile.getViewProvider(); if (fileViewProvider instanceof TemplateLanguageFileViewProvider) { Language dataLanguage = ((TemplateLanguageFileViewProvider)fileViewProvider).getTemplateDataLanguage(); PsiFile templateDataFile = fileViewProvider.getPsi(dataLanguage); if (templateDataFile instanceof XmlFile) contextNode = ((XmlFile)templateDataFile).getDocument(); } } } input = inputXPathExpression(project, contextNode); if (contextHighlighter != null) { contextHighlighter.dispose(); } if (input == null) { return; } HighlighterUtil.clearHighlighters(editor); } while (contextNode != null && evaluateExpression(input, contextNode, editor, cfg)); }