boolean (@NotNull Project project, Editor editor, PsiFile file) { if (!XsltSupport.isXsltFile(file)) return false; final int offset = editor.getCaretModel().getOffset(); final PsiElement element = file.findElementAt(offset); if (element == null) return false; final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class); if (tag == null || tag.getParentTag() == null) return false; if (!tag.getLocalName().equals("if") || !XsltSupport.isXsltTag(tag)) return false; if (tag.getAttributeValue("test") == null) return false; final ASTNode node = tag.getNode(); if (node == null) return false; final ASTNode child = XmlChildRole.START_TAG_NAME_FINDER.findChild(node); return child != null && child.getTextRange().contains(offset); }