in org.apache.easyant4e/src/org/apache/easyant4e/wizards/EasyAntImportWizardPage.java [347:419]
public void updateProjectsList(final String path) {
// on an empty path empty selectedProjects
if (path == null || path.length() == 0) {
setMessage("Import Projects Description");
selectedProjects = new ProjectRecord[0];
projectsList.refresh(true);
projectsList.setCheckedElements(selectedProjects);
setPageComplete(projectsList.getCheckedElements().length > 0);
lastPath = path;
return;
}
final File directory = new File(path);
long modified = directory.lastModified();
if (path.equals(lastPath) && lastModified == modified) {
// since the file/folder was not modified and the path did not
// change, no refreshing is required
return;
}
lastPath = path;
lastModified = modified;
// We can't access the radio button from the inner class so get the
// status beforehand
// final boolean dirSelected =
// this.projectFromDirectoryRadio.getSelection();
try {
getContainer().run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
monitor.beginTask("Searching", 100);
selectedProjects = new ProjectRecord[0];
Collection files = new ArrayList();
monitor.worked(10);
if (directory.isDirectory()) {
if (!collectProjectFilesFromDirectory(files, directory, null, monitor)) {
return;
}
Iterator filesIterator = files.iterator();
selectedProjects = new ProjectRecord[files.size()];
int index = 0;
monitor.worked(50);
monitor.subTask("Processing");
while (filesIterator.hasNext()) {
File file = (File) filesIterator.next();
ProjectRecord projectRecord = new ProjectRecord(file, lastPath);
selectedProjects[index] = projectRecord;
index++;
}
} else {
monitor.worked(60);
}
monitor.done();
}
});
} catch (InvocationTargetException e) {
Activator.getEasyAntPlugin().log(IStatus.ERROR, e.getMessage());
} catch (InterruptedException e) {
// Nothing to do if the user interrupts.
}
projectsList.refresh(true);
projectsList.setCheckedElements(getValidProjects());
if (getValidProjects().length < selectedProjects.length) {
setMessage("Projects in workspace", WARNING);
} else {
setMessage("Import projects description");
}
setPageComplete(projectsList.getCheckedElements().length > 0);
}