PsiElementVisitor (final @NotNull ProblemsHolder holder, final 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); if (FxmlConstants.FX_ID.equals(attribute.getName())) { final XmlAttributeValue valueElement = attribute.getValueElement(); if (valueElement != null && valueElement.getTextLength() > 0) { final PsiClass controllerClass = JavaFxPsiUtil.getControllerClass(attribute.getContainingFile()); if (controllerClass != null) { final PsiReference reference = valueElement.getReference(); if (reference instanceof JavaFxFieldIdReferenceProvider.JavaFxControllerFieldRef && ((JavaFxFieldIdReferenceProvider.JavaFxControllerFieldRef)reference).isUnresolved()) { final PsiClass fieldClass = checkContext(((JavaFxFieldIdReferenceProvider.JavaFxControllerFieldRef)reference).getXmlAttributeValue()); if (fieldClass != null) { final String text = reference.getCanonicalText(); boolean validName = LanguageNamesValidation.isIdentifier(fieldClass.getLanguage(), text, fieldClass.getProject()); holder.registerProblem(reference.getElement(), reference.getRangeInElement(), JavaFXBundle.message("inspection.javafx.unresolved.fx.id.reference.problem"), isOnTheFly && validName ? createFixes((JavaFxFieldIdReferenceProvider.JavaFxControllerFieldRef)reference, holder.getFile()) : LocalQuickFix.EMPTY_ARRAY); } } } } } } }; }