1 19 20 package org.netbeans.modules.java.source.parsing; 21 22 import java.io.IOException ; 23 import java.util.ArrayList ; 24 import java.util.Collections ; 25 import java.util.List ; 26 import javax.tools.JavaFileObject; 27 import org.netbeans.api.java.classpath.ClassPath; 28 import org.netbeans.modules.java.preprocessorbridge.spi.JavaFileFilterImplementation; 29 import org.openide.filesystems.FileObject; 30 31 35 public class FileObjectArchive implements Archive { 36 37 private final FileObject root; 38 39 40 public FileObjectArchive (final FileObject root) { 41 this.root = root; 42 } 43 44 public Iterable <JavaFileObject> getFiles(String folderName, ClassPath.Entry entry, JavaFileFilterImplementation filter) throws IOException { 45 FileObject folder = root.getFileObject(folderName); 46 if (folder == null || entry == null || !entry.includes(folder)) { 47 return Collections.<JavaFileObject>emptySet(); 48 } 49 FileObject[] children = folder.getChildren(); 50 List <JavaFileObject> result = new ArrayList <JavaFileObject>(children.length); 51 for (FileObject fo : children) { 52 if (fo.isData() && (entry == null || entry.includes(fo))) { 53 result.add(FileObjects.nbFileObject(fo,filter,false)); 54 } 55 } 56 return result; 57 } 58 59 public void clear() { 60 } 61 62 } 63 | Popular Tags |