use of org.eclipse.jst.server.generic.servertype.definition.ExcludeType in project webtools.servertools by eclipse.
the class ServerTypeDefinitionUtil method getClasspathEntries.
public static ArrayList getClasspathEntries(String ref, ServerRuntime definition, boolean isLaunch) {
Classpath cp = definition.getClasspath(ref);
Iterator archives = cp.getArchive().iterator();
ArrayList<Object> entryList = new ArrayList<Object>();
while (archives.hasNext()) {
ArchiveType archive = (ArchiveType) archives.next();
String item = definition.getResolver().resolveProperties(archive.getPath());
if (isLaunch)
entryList.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(item)));
else
entryList.add(JavaCore.newLibraryEntry(new Path(item), null, null));
}
Iterator fileSets = cp.getFileset().iterator();
while (fileSets.hasNext()) {
FilesetType fileset = (FilesetType) fileSets.next();
String dir = definition.getResolver().resolveProperties(fileset.getDir());
Iterator includes = fileset.getInclude().iterator();
String[] inclstr = new String[fileset.getInclude().size()];
int i = 0;
while (includes.hasNext()) {
IncludeType incl = (IncludeType) includes.next();
inclstr[i++] = definition.getResolver().resolveProperties(incl.getName());
}
Iterator excludes = fileset.getExclude().iterator();
String[] exclstr = new String[fileset.getExclude().size()];
i = 0;
while (excludes.hasNext()) {
ExcludeType excl = (ExcludeType) excludes.next();
exclstr[i++] = definition.getResolver().resolveProperties(excl.getName());
}
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir(dir);
scanner.setIncludes(inclstr);
scanner.setExcludes(exclstr);
scanner.scan();
String[] filesetFiles = scanner.getIncludedFiles();
for (int j = 0; j < filesetFiles.length; j++) {
String item = dir + "/" + filesetFiles[j];
if (isLaunch)
entryList.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(item)));
else
entryList.add(JavaCore.newLibraryEntry(new Path(item), null, null));
}
}
return entryList;
}
Aggregations