WebPublisher() {
}
public void run(final File[] exportFiles, final DocumentManager.FTPOptions options, UIFacade uiFacade) {
IJobManager jobManager = Platform.getJobManager();
IProgressMonitor monitor = jobManager.createProgressGroup();
Job startingJob = new Job("starting") {
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask("Publishing files on FTP", exportFiles.length);
try{
final URL baseUrl = buildURL(options);
if (baseUrl==null) {
throw new RuntimeException("Failed to discover your FTP settings. Please make sure that you specified server name and user name");
}
for (int i=0; i<exportFiles.length; i++) {
Job nextJob = createTransferJob(baseUrl, exportFiles[i]);
nextJob.setProgressGroup(monitor, 1);
nextJob.schedule();
nextJob.join();
}
Job finishingJob = new Job("finishing") {
protected IStatus run(IProgressMonitor monitor) {
monitor.done();
return Status.OK_STATUS;
}
};
finishingJob.setProgressGroup(monitor, 0);
finishingJob.schedule();