public AntDomElement fromString(@Nullable @NonNls String s, ConvertContext context) {
   if (s != null) {
     final AntDomElement element = AntSupport.getInvocationAntDomElement(context);
     if (element != null) {
       return findElementById(
           element.getContextAntProject(),
           s,
           CustomAntElementsRegistry.ourIsBuildingClasspathForCustomTagLoading.get());
     }
   }
   return null;
 }
  @NotNull
  public PsiReference[] createReferences(
      final GenericDomValue<AntDomElement> genericDomValue,
      final PsiElement element,
      ConvertContext context) {
    final AntDomElement invocationElement = AntSupport.getInvocationAntDomElement(context);
    return new PsiReference[] {
      new AntDomReferenceBase(element, true) {
        public PsiElement resolve() {
          final AntDomElement value = genericDomValue.getValue();
          if (value == null) {
            return null;
          }
          final DomTarget target = DomTarget.getTarget(value, value.getId());
          if (target == null) {
            return null;
          }
          return PomService.convertToPsi(element.getProject(), target);
        }

        @NotNull
        public Object[] getVariants() {
          if (invocationElement == null) {
            return ArrayUtil.EMPTY_OBJECT_ARRAY;
          }
          final Set<String> variants = new LinkedHashSet<String>();
          invocationElement
              .getContextAntProject()
              .accept(
                  new AntDomRecursiveVisitor() {
                    public void visitAntDomElement(AntDomElement element) {
                      final String variant = element.getId().getRawText();
                      if (variant != null) {
                        variants.add(variant);
                      }
                      super.visitAntDomElement(element);
                    }
                  });
          return variants.size() > 0
              ? ArrayUtil.toObjectArray(variants)
              : ArrayUtil.EMPTY_OBJECT_ARRAY;
        }

        public String getUnresolvedMessagePattern() {
          return AntBundle.message("cannot.resolve.refid", getCanonicalText());
        }
      }
    };
  }