PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { if (!JavaFxFileTypeFactory.isFxml(session.getFile())) return PsiElementVisitor.EMPTY_VISITOR; return new XmlElementVisitor() { @Override public void visitXmlAttribute(@NotNull XmlAttribute attribute) { super.visitXmlAttribute(attribute); final XmlAttributeDescriptor descriptor = attribute.getDescriptor(); if (!(descriptor instanceof JavaFxPropertyAttributeDescriptor)) return; final String attributeName = attribute.getName(); final String attributeValue = attribute.getValue(); if (attributeValue == null || attributeValue.startsWith("$") || attributeValue.startsWith("#") || attributeValue.startsWith("%") || FxmlConstants.FX_ID.equals(attributeName) || FxmlConstants.FX_VALUE.equals(attributeName) || FxmlConstants.FX_CONSTANT.equals(attributeName) || FxmlConstants.FX_CONTROLLER.equals(attributeName)) { return; } final PsiClass tagClass = JavaFxPsiUtil.getTagClass(attribute.getParent()); final String defaultValue = getDefaultValue(attributeName, tagClass); if (defaultValue == null) return; if (isEqualValue(tagClass, attributeValue, defaultValue, descriptor.getDeclaration())) { holder.registerProblem(attribute, JavaFXBundle.message("inspection.javafx.redundant.property.values.problem"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new RemoveAttributeIntentionFix(attributeName)); } } @Override public void visitXmlTag(@NotNull XmlTag tag) { super.visitXmlTag(tag); final XmlElementDescriptor descriptor = tag.getDescriptor(); if (!(descriptor instanceof JavaFxPropertyTagDescriptor)) { return; } if (tag.getSubTags().length != 0) return; final String tagText = tag.getValue().getTrimmedText(); if (tagText.startsWith("$") || tagText.startsWith("#") || tagText.startsWith("%")) { return; } final XmlTag parentTag = tag.getParentTag(); if (parentTag == null) return; final PsiClass tagClass = JavaFxPsiUtil.getTagClass(parentTag); final String defaultValue = getDefaultValue(tag.getName(), tagClass); if (defaultValue == null) return; if (isEqualValue(tagClass, tagText, defaultValue, descriptor.getDeclaration())) { holder.registerProblem(tag, JavaFXBundle.message("inspection.javafx.redundant.property.values.redundant.tag.problem"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new RemoveTagIntentionFix(tag.getName(), tag)); } } }; }