PsiElement (@NotNull PsiReference psiReference, boolean incompleteCode) { final PsiElement element = psiReference.getElement(); final DomElement domElement = DomUtil.getDomElement(element); if (domElement == null) { return null; } final AntDomMacroDef macrodef = domElement.getParentOfType(AntDomMacroDef.class, false); if (macrodef == null) { return null; } final String name = AntStringResolver.computeString(domElement, psiReference.getCanonicalText()); for (AntDomMacrodefAttribute attribute : macrodef.getMacroAttributes()) { if (name.equals(attribute.getName().getStringValue())) { final DomTarget target = DomTarget.getTarget(attribute); return target != null? PomService.convertToPsi(target) : null; } } return null; }