use of com.intellij.lang.ant.AntFilesProvider in project intellij-community by JetBrains.
the class AntDomDocumentationProvider method getAdditionalDocumentation.
@Nullable
private static String getAdditionalDocumentation(PsiElement elem) {
final XmlTag xmlTag = PsiTreeUtil.getParentOfType(elem, XmlTag.class);
if (xmlTag == null) {
return null;
}
final AntDomElement antElement = AntSupport.getAntDomElement(xmlTag);
if (antElement instanceof AntFilesProvider) {
final List<File> list = ((AntFilesProvider) antElement).getFiles(new HashSet<>());
if (list.size() > 0) {
@NonNls final StringBuilder builder = StringBuilderSpinAllocator.alloc();
try {
final XmlTag tag = antElement.getXmlTag();
if (tag != null) {
builder.append("<b>");
builder.append(tag.getName());
builder.append(":</b>");
}
for (File file : list) {
if (builder.length() > 0) {
builder.append("<br>");
}
builder.append(file.getPath());
}
return builder.toString();
} finally {
StringBuilderSpinAllocator.dispose(builder);
}
}
}
return null;
}
use of com.intellij.lang.ant.AntFilesProvider in project intellij-community by JetBrains.
the class CustomAntElementsRegistry method collectUrls.
public static List<URL> collectUrls(AntDomClasspathElement typedef) {
boolean cleanupNeeded = false;
if (!ourIsBuildingClasspathForCustomTagLoading.get()) {
ourIsBuildingClasspathForCustomTagLoading.set(Boolean.TRUE);
cleanupNeeded = true;
}
try {
final List<URL> urls = new ArrayList<>();
// check classpath attribute
final List<File> cpFiles = typedef.getClasspath().getValue();
if (cpFiles != null) {
for (File file : cpFiles) {
try {
urls.add(toLocalURL(file));
} catch (MalformedURLException ignored) {
LOG.info(ignored);
}
}
}
final HashSet<AntFilesProvider> processed = new HashSet<>();
final AntDomElement referencedPath = typedef.getClasspathRef().getValue();
if (referencedPath instanceof AntFilesProvider) {
for (File cpFile : ((AntFilesProvider) referencedPath).getFiles(processed)) {
try {
urls.add(toLocalURL(cpFile));
} catch (MalformedURLException ignored) {
LOG.info(ignored);
}
}
}
for (final Iterator<AntDomElement> it = typedef.getAntChildrenIterator(); it.hasNext(); ) {
AntDomElement child = it.next();
if (child instanceof AntFilesProvider) {
for (File cpFile : ((AntFilesProvider) child).getFiles(processed)) {
try {
urls.add(toLocalURL(cpFile));
} catch (MalformedURLException ignored) {
LOG.info(ignored);
}
}
}
}
return urls;
} finally {
if (cleanupNeeded) {
ourIsBuildingClasspathForCustomTagLoading.remove();
}
}
}
Aggregations