PsiElement () { ExtensionPoint extensionPoint = myExtension.getExtensionPoint(); if (extensionPoint == null) { return null; } ExtensionLocator epAndIdLocator = locateExtensionsByExtensionPointAndId(extensionPoint, myReferencedId); List<ExtensionCandidate> candidates = epAndIdLocator.findCandidates(); if (candidates.isEmpty()) { return null; } XmlTag referencedElement = candidates.iterator().next().pointer.getElement(); if (referencedElement == null) { return null; } // return DOM target PSI for "Find Usages" to work DomManager domManager = DomManager.getDomManager(referencedElement.getProject()); DomElement domElement = domManager.getDomElement(referencedElement); if (domElement == null) { return referencedElement; // fallback } DomTarget target = DomTarget.getTarget(domElement); if (target == null) { return referencedElement; // fallback } return PomService.convertToPsi(target); }