void (PsiReferenceRegistrar registrar) { final XmlTagPattern.Capture templateTagCapture = xmlTag().withLocalName("template") .withParent(xmlTag().withLocalName("templateSet")) .with(new PatternCondition<>("pluginProject") { @Override public boolean accepts(@NotNull XmlTag tag, ProcessingContext context) { return PsiUtil.isPluginProject(tag.getProject()); } }); registrar.registerReferenceProvider(xmlAttributeValue("key").withSuperParent(2, templateTagCapture), new PropertyKeyReferenceProvider(tag -> tag.getAttributeValue("resource-bundle"))); registrar.registerReferenceProvider(xmlAttributeValue("resource-bundle").withSuperParent(2, templateTagCapture), new ResourceBundlePsiReferenceProvider()); }