コード例 #1
0
  @Nullable
  private static AntDomElement findElementById(
      AntDomElement from, final String id, final boolean skipCustomTags) {
    if (id.equals(from.getId().getRawText())) {
      return from;
    }
    final Ref<AntDomElement> result = new Ref<AntDomElement>(null);
    from.accept(
        new AntDomRecursiveVisitor() {
          public void visitAntDomCustomElement(AntDomCustomElement custom) {
            if (!skipCustomTags) {
              super.visitAntDomCustomElement(custom);
            }
          }

          public void visitAntDomElement(AntDomElement element) {
            if (result.get() != null) {
              return;
            }
            if (id.equals(element.getId().getRawText())) {
              result.set(element);
              return;
            }
            super.visitAntDomElement(element);
          }
        });

    return result.get();
  }
コード例 #2
0
 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;
 }
コード例 #3
0
 public String toString(@Nullable AntDomElement antDomElement, ConvertContext context) {
   return antDomElement != null ? antDomElement.getId().getRawText() : null;
 }