}
public void initWGADistributions() {
if (_wgaDeploymentManager.getDeployments().size() == 0) {
final String fDownloadURL = getWGADownloadURL();
Job createDefaultDeployment = new Job("Initializing WGA distributions") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
monitor.beginTask("Initializing WGA distributions", 100);
SubProgressMonitor downloadMonitor = new SubProgressMonitor(monitor, 90);
TemporaryFile temp = downloadCurrentWGARelease(downloadMonitor);
SubProgressMonitor deployMonitor = new SubProgressMonitor(monitor, 10);
getWGADeploymentManager().createOrUpdateDefaultDeployment(temp.getFile(), deployMonitor);
temp.delete();
return Status.OK_STATUS;
} catch (InputStreamCanceledException e) {
logWarning("WGA distribution download has been canceled by user.");
return Status.CANCEL_STATUS;
} catch (UnknownHostException e) {
logError("Download of current OpenWGA release failed", e);
return new Status(Status.ERROR, PLUGIN_ID, "Download of current OpenWGA release from '" + fDownloadURL + "' failed. Unknown host.");
} catch (Exception e) {
logError("Download of current WGA release failed.", e);
return new Status(Status.ERROR, PLUGIN_ID, "Download of current OpenWGA release from '" + fDownloadURL + "' failed. See log for details.");
} finally {
monitor.done();
}
}
@Override
public boolean belongsTo(Object family) {
return JOB_FAMILY_WGA_DISTRIBUTION_DOWNLOAD.equals(family);
}
};
boolean startDownload = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Download current OpenWGA release", "You have currently no OpenWGA distribution installed in your workspace, which is necessary to use the OpenWGA Developer Studio. The latest release will be downloaded from '" + fDownloadURL + "' now.");
if (startDownload) {
createDefaultDeployment.setPriority(Job.LONG);
createDefaultDeployment.setUser(true);
createDefaultDeployment.schedule();
}
}
}