@NotNull protected List<File> getFiles(@Nullable AntDomPattern pattern, Set<AntFilesProvider> processed) { assert pattern != null; final File singleFile = getCanonicalFile(getFile().getStringValue()); if (singleFile == null || pattern.hasIncludePatterns()) { // if singleFile is specified, there are no implicit includes final File root = getCanonicalFile(getDir().getStringValue()); if (root != null) { final ArrayList<File> files = new ArrayList<File>(); if (singleFile != null && singleFile.isDirectory()) { files.add(singleFile); } new FilesCollector().collectFiles(files, root, "", pattern); return files; } } if (singleFile != null && singleFile.isDirectory()) { return Collections.singletonList(singleFile); } return Collections.emptyList(); }
@NotNull protected List<File> getFiles(@Nullable AntDomPattern pattern, Set<AntFilesProvider> processed) { final File root = getCanonicalFile(getDir().getStringValue()); if (root == null) { return Collections.emptyList(); } final ArrayList<File> files = new ArrayList<File>(); final String filenames = getFilesString().getStringValue(); if (filenames != null) { final StringTokenizer tokenizer = new StringTokenizer(filenames, ", \t\n\r\f", false); while (tokenizer.hasMoreTokens()) { files.add(new File(root, tokenizer.nextToken())); } } for (AntDomNamedElement child : getFiles()) { final String fileName = child.getName().getStringValue(); if (fileName != null) { files.add(new File(root, fileName)); } } return files; }
@NotNull protected List<File> getFiles(@Nullable AntDomPattern pattern, Set<AntFilesProvider> processed) { assert pattern != null; final File singleFile = getCanonicalFile(getFile().getStringValue()); if (singleFile == null || pattern.hasIncludePatterns()) { // if singleFile is specified, there are no implicit includes final File root = getCanonicalFile(getDir().getStringValue()); if (root != null) { final ArrayList<File> files = new ArrayList<File>(); if (singleFile != null) { files.add(singleFile); } new FilesCollector().collectFiles(files, root, "", pattern); return files; } } if (singleFile != null) { return Collections.singletonList(singleFile); } return Collections.emptyList(); }
@NotNull protected List<File> getFiles(AntDomPattern pattern, Set<AntFilesProvider> processed) { final List<File> files = new ArrayList<File>(); final File baseDir = getCanonicalFile("."); addLocation(baseDir, files, getLocation().getStringValue()); final String pathString = getPath().getStringValue(); if (pathString != null) { final PathTokenizer tokenizer = new PathTokenizer(pathString); while (tokenizer.hasMoreTokens()) { addLocation(baseDir, files, tokenizer.nextToken()); } } return files; }
@NotNull protected List<File> getFiles(@Nullable AntDomPattern pattern, Set<AntFilesProvider> processed) { assert pattern != null; final File singleFile = getCanonicalFile(getFile().getStringValue()); if (singleFile == null || pattern.hasIncludePatterns()) { // if singleFile is specified, there are no implicit includes final File root = getCanonicalFile(getDir().getStringValue()); if (root != null) { final ArrayList<File> files = new ArrayList<File>(); if (singleFile != null && singleFile.isDirectory()) { files.add(singleFile); } new FilesCollector().collectFiles(files, root, "", pattern); return files; } } if (singleFile != null && singleFile.isDirectory()) { Collections.singletonList(singleFile); } return Collections.emptyList(); }
@NotNull protected List<File> getFiles(AntDomPattern pattern, Set<AntFilesProvider> processed) { final List<File> files = new ArrayList<File>(); final File baseDir = getCanonicalFile(""); addLocation(baseDir, files, getLocation().getStringValue()); final String pathString = getPath().getStringValue(); if (pathString != null) { final PathTokenizer tokenizer = new PathTokenizer(pathString); while (tokenizer.hasMoreTokens()) { addLocation(baseDir, files, tokenizer.nextToken()); } } return files; }
@NotNull public final List<File> getFiles(Set<AntFilesProvider> processed) { if (processed.contains(this)) { return Collections.emptyList(); } List<File> result = myCachedFiles; if (result == null) { myCachedFiles = result = getFilesImpl(processed); } return result; }
private List<File> getFilesImpl(final Set<AntFilesProvider> processed) { processed.add(this); try { final AntDomElement referenced = getRefId().getValue(); if (referenced instanceof AntFilesProvider) { return ((AntFilesProvider)referenced).getFiles(processed); } return getFiles(getAntPattern(), processed); } finally { processed.remove(this); } }
@NotNull protected List<File> getFiles(AntDomPattern pattern, Set<AntFilesProvider> processed) { final List<File> files = super.getFiles(pattern, processed); for (Iterator<AntDomElement> iterator = getAntChildrenIterator(); iterator.hasNext();) { AntDomElement child = iterator.next(); if (child instanceof AntFilesProvider) { files.addAll(((AntFilesProvider)child).getFiles(processed)); } } return files; }
@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<AntFilesProvider>()); if (list.size() > 0) { final @NonNls 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; }
@NotNull protected List<File> getFiles(@Nullable AntDomPattern pattern, final Set<AntFilesProvider> processed) { return Collections.emptyList(); }