@Override @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlToken(final XmlToken token) { if (token.getTokenType() == XmlTokenType.XML_NAME) { PsiElement element = token.getPrevSibling(); while(element instanceof PsiWhiteSpace) element = element.getPrevSibling(); if (element instanceof XmlToken && ((XmlToken)element).getTokenType() == XmlTokenType.XML_START_TAG_START) { PsiElement parent = element.getParent(); if (parent instanceof XmlTag && !(token.getNextSibling() instanceof OuterLanguageElement)) { XmlTag tag = (XmlTag)parent; checkTag(tag, holder, isOnTheFly); } } } } @Override public void visitXmlAttribute(final XmlAttribute attribute) { checkAttribute(attribute, holder, isOnTheFly); } }; }
@NotNull @Override public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlAttributeValue(XmlAttributeValue value) { checkRefs(value, holder, isOnTheFly); } @Override public void visitXmlDoctype(XmlDoctype xmlDoctype) { checkRefs(xmlDoctype, holder, isOnTheFly); } @Override public void visitXmlTag(XmlTag tag) { checkRefs(tag, holder, isOnTheFly); } }; }
@Override @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlTag(final XmlTag tag) { if (!isTagWithEmptyEndNotAllowed(tag)) { return; } final ASTNode child = XmlChildRole.EMPTY_TAG_END_FINDER.findChild(tag.getNode()); if (child == null) { return; } final LocalQuickFix fix = new MyLocalQuickFix(); holder.registerProblem(tag, XmlBundle.message("html.inspections.check.empty.script.message"), tag.getContainingFile().getContext() != null ? ProblemHighlightType.INFORMATION: ProblemHighlightType.GENERIC_ERROR_OR_WARNING, fix); } }; }
@Override @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlTag(final XmlTag tag) { if (!CheckEmptyTagInspection.isTagWithEmptyEndNotAllowed(tag)) { final ASTNode child = XmlChildRole.START_TAG_END_FINDER.findChild(tag.getNode()); if (child != null) { final ASTNode node = child.getTreeNext(); if (node != null && node.getElementType() == XmlTokenType.XML_END_TAG_START) { final LocalQuickFix localQuickFix = new Fix(); holder.registerProblem( tag, XmlBundle.message("xml.inspections.tag.empty.body"), isCollapsibleTag(tag) ? localQuickFix : null ); } } } } }; }
@NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlTag(final XmlTag tag) { if (!isTagWithEmptyEndNotAllowed(tag)) { return; } final ASTNode child = XmlChildRole.EMPTY_TAG_END_FINDER.findChild(tag.getNode()); if (child == null) { return; } final LocalQuickFix fix = new MyLocalQuickFix(); holder.registerProblem(tag, XmlBundle.message("html.inspections.check.empty.script.message"), tag.getContainingFile().getContext() != null ? ProblemHighlightType.INFORMATION: ProblemHighlightType.GENERIC_ERROR_OR_WARNING, fix); } }; }
@NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlTag(final XmlTag tag) { if (!CheckEmptyTagInspection.isTagWithEmptyEndNotAllowed(tag)) { final ASTNode child = XmlChildRole.START_TAG_END_FINDER.findChild(tag.getNode()); if (child != null) { final ASTNode node = child.getTreeNext(); if (node != null && node.getElementType() == XmlTokenType.XML_END_TAG_START) { final LocalQuickFix localQuickFix = new ReplaceEmptyTagBodyByEmptyEndFix(); holder.registerProblem( tag, XmlBundle.message("xml.inspections.tag.empty.body"), isCollapsableTag(tag) ? localQuickFix : null ); } } } } }; }
@NotNull @Override public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { return new XmlElementVisitor() { @Override public void visitXmlTag(XmlTag tag) { if (tag.getValue().getTextElements().length > 0) { checkReferences(tag, holder); } } @Override public void visitXmlAttribute(XmlAttribute attribute) { checkReferences(attribute, holder); } @Override public void visitXmlAttributeValue(XmlAttributeValue value) { checkReferences(value, holder); } }; }
@Override @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlElement(final XmlElement element) { if (element instanceof XmlElementContentSpec || element instanceof XmlEntityRef ) { doCheckRefs(element, holder); } } }; }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlProlog(this); } else { visitor.visitElement(this); } }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlDecl(this); } else { visitor.visitElement(this); } }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlProcessingInstruction(this); } else { visitor.visitElement(this); } }
@Override public void accept(@NotNull final PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlElement(this); } else { visitor.visitElement(this); } }
@NotNull @Override public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { return new XmlElementVisitor() { @Override public void visitXmlTag(XmlTag tag) { DomElement element = DomUtil.getDomElement(tag); if (element instanceof Extension) { ExtensionPoint extensionPoint = ((Extension)element).getExtensionPoint(); if (extensionPoint != null && InheritanceUtil.isInheritor(extensionPoint.getBeanClass().getValue(), "com.intellij.codeInspection.InspectionEP")) { boolean key = tag.getAttribute("key") != null; boolean groupKey = tag.getAttribute("groupKey") != null; if (key) { if (tag.getAttribute("bundle") == null) { checkDefaultBundle(element, holder); } } else if (tag.getAttribute("displayName") == null) { registerProblem(element, holder, "displayName or key should be specified", "displayName", "key"); } if (groupKey) { if (tag.getAttribute("bundle") == null && tag.getAttribute("groupBundle") == null) { checkDefaultBundle(element, holder); } } else if (tag.getAttribute("groupName") == null) { registerProblem(element, holder, "groupName or groupKey should be specified", "groupName", "groupKey"); } } } } }; }
@NotNull @Override public PsiElementVisitor buildVisitor( @NotNull final ProblemsHolder holder, final boolean isOnTheFly ) { return new XmlElementVisitor() { @Override public void visitXmlAttributeValue( final XmlAttributeValue value ) { if( value.getTextRange().isEmpty() ) { return; } final PsiFile file = value.getContainingFile(); if( !(file instanceof XmlFile) ) { return; } PsiFile baseFile = PsiUtilCore.getTemplateLanguageFile( file ); if( baseFile != file && !(baseFile instanceof XmlFile) ) { return; } final XmlRefCountHolder refHolder = XmlRefCountHolder.getRefCountHolder( (XmlFile)file ); if( refHolder == null ) return; final PsiElement parent = value.getParent(); if( !(parent instanceof XmlAttribute) ) return; final XmlTag tag = (XmlTag)parent.getParent(); if( tag == null ) return; checkValue( value, (XmlFile)file, refHolder, tag, holder ); } }; }
public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlProlog(this); } else { visitor.visitElement(this); } }
public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlDecl(this); } else { visitor.visitElement(this); } }
public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlProcessingInstruction(this); } else { visitor.visitElement(this); } }
public void accept(@NotNull final PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlElement(this); } else { visitor.visitElement(this); } }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if(visitor instanceof XmlElementVisitor) { ((XmlElementVisitor) visitor).visitXmlProlog(this); } else { visitor.visitElement(this); } }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if(visitor instanceof XmlElementVisitor) { ((XmlElementVisitor) visitor).visitXmlAttribute(this); } else { visitor.visitElement(this); } }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlAttributeValue(this); } else { visitor.visitElement(this); } }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if(visitor instanceof XmlElementVisitor) { ((XmlElementVisitor) visitor).visitXmlText(this); } else { visitor.visitElement(this); } }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if(visitor instanceof XmlElementVisitor) { ((XmlElementVisitor) visitor).visitXmlElement(this); } else { visitor.visitElement(this); } }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if(visitor instanceof XmlElementVisitor) { ((XmlElementVisitor) visitor).visitXmlFile(this); } else { visitor.visitFile(this); } }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if(visitor instanceof XmlElementVisitor) { ((XmlElementVisitor) visitor).visitXmlDocument(this); } else { visitor.visitElement(this); } }
@Override public void accept(@NotNull PsiElementVisitor visitor) { if(visitor instanceof XmlElementVisitor) { ((XmlElementVisitor) visitor).visitXmlDoctype(this); } else { visitor.visitElement(this); } }