void (@NotNull PsiReferenceRegistrar registrar) { final XmlAttributeValuePattern attributeValueInFxml = XmlPatterns.xmlAttributeValue().inVirtualFile( virtualFile().withExtension(JavaFxFileTypeFactory.FXML_EXTENSION)); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.FX_CONTROLLER)) .and(attributeValueInFxml), CLASS_REFERENCE_PROVIDER); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue() .withParent(XmlPatterns.xmlAttribute().withName("type") .withParent(XmlPatterns.xmlTag().withName(FxmlConstants.FX_ROOT))) .and(attributeValueInFxml), new MyJavaClassReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlTag().inVirtualFile(virtualFile().withExtension(JavaFxFileTypeFactory.FXML_EXTENSION)), new MyJavaClassReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.FX_ID)) .and(attributeValueInFxml), new JavaFxFieldIdReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.SOURCE) .withParent(XmlPatterns.xmlTag() .withName(FxmlConstants.FX_INCLUDE))) .and(attributeValueInFxml), new JavaFxSourceReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.SOURCE) .withParent(XmlPatterns.xmlTag() .withName(FxmlConstants.FX_SCRIPT))) .and(attributeValueInFxml), new JavaFxSourceReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.SOURCE) .withParent(XmlPatterns.xmlTag() .withName(string().oneOf(FxmlConstants.FX_REFERENCE, FxmlConstants.FX_COPY)))) .and(attributeValueInFxml), new JavaFxComponentIdReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.FX_FACTORY)) .and(attributeValueInFxml), new JavaFxFactoryReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withValue(string().startsWith("#")) .and(attributeValueInFxml), new JavaFxEventHandlerReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withValue(string().startsWith("@")) .withParent(StandardPatterns.not(XmlPatterns.xmlAttribute().withName(FxmlConstants.STYLESHEETS))) .and(attributeValueInFxml), new JavaFxLocationReferenceProvider(), PsiReferenceRegistrar.LOWER_PRIORITY); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withValue(string().startsWith("$")) .withParent(XmlPatterns.xmlAttribute() .andNot(XmlPatterns.xmlAttribute().withName(FxmlConstants.FX_VALUE))) .and(attributeValueInFxml), new JavaFxComponentIdReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue() .withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.URL_ATTR)) .andNot(XmlPatterns.xmlAttributeValue().withValue(string().matches("^https?://.*"))) .and(attributeValueInFxml), new JavaFxLocationReferenceProvider(false, "png", "jpg", "gif", "bmp")); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.STYLESHEETS)).and(attributeValueInFxml), new JavaFxLocationReferenceProvider(true, "css")); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withValue(string().startsWith("@")) .withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.VALUE) .withParent(XmlPatterns.xmlTag().withName(FxmlConstants.URL_TAG) .withParent(XmlPatterns.xmlTag().withName(FxmlConstants.STYLESHEETS)))) .and(attributeValueInFxml), new JavaFxLocationReferenceProvider(false, "css")); registrar.registerReferenceProvider(PlatformPatterns.psiElement(XmlProcessingInstruction.class).inVirtualFile(virtualFile().withExtension(JavaFxFileTypeFactory.FXML_EXTENSION)), new ImportReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().and(attributeValueInFxml), new JavaFxColorReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue() .withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.FX_VALUE) .withParent(XmlPatterns.xmlTag().withParent(XmlPatterns.xmlTag().withName(FxmlConstants.STYLESHEETS)))) .and(attributeValueInFxml), new JavaFxLocationReferenceProvider(false, "css")); registrar.registerReferenceProvider(XmlPatterns.xmlAttribute().withLocalName(string().contains(".")) .inVirtualFile(virtualFile().withExtension(JavaFxFileTypeFactory.FXML_EXTENSION)), new JavaFxStaticPropertyReferenceProvider()); }