@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(); }
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; }
public String toString(@Nullable AntDomElement antDomElement, ConvertContext context) { return antDomElement != null ? antDomElement.getId().getRawText() : null; }