PsiElementVisitor (@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { if (!(holder.getFile() instanceof XmlFile)) return PsiElementVisitor.EMPTY_VISITOR; return new XmlElementVisitor() { @Override public void visitXmlTag(final @NotNull XmlTag tag) { final XmlAttribute nameAttr = tag.getAttribute("name", null); if (nameAttr == null || PsiTreeUtil.hasErrorElements(nameAttr)) return; if (XsltSupport.isVariableOrParam(tag)) { final XmlTag shadowedVariable = DeclarationChecker.getInstance((XmlFile)tag.getContainingFile()).getShadowedVariable(tag); if (shadowedVariable != null) { final LocalQuickFix fix1 = new RenameVariableFix(tag, XPathBundle.message("variable.place.local")).createQuickFix(isOnTheFly); final LocalQuickFix fix2 = new RenameVariableFix(shadowedVariable, XPathBundle.message("variable.place.outer")).createQuickFix(isOnTheFly); final PsiElement token = XsltSupport.getAttValueToken(nameAttr); if (token == null) return; final String message = XPathBundle.message("inspection.message.variable.shadows.variable", XsltSupport.isParam(tag) ? 0 : 1, nameAttr.getValue(), XsltSupport.isParam(shadowedVariable) ? 0 : 1); //noinspection DialogTitleCapitalization holder.registerProblem(token, message, AbstractFix.createFixes(fix1, fix2)); } } } }; }