IRunnableWithProgress runnable = null;
if (_addDialog.isDownloadRequested()) {
runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
TemporaryFile wgaWar = null;
try {
monitor.beginTask("Deploying wga", 100);
SubProgressMonitor downloadMonitor = new SubProgressMonitor(monitor, 90);
boolean isCustomDownloadLocation = false;
if (_addDialog.getLocation() != null && !_addDialog.getLocation().trim().equalsIgnoreCase("")) {
wgaWar = WGADesignerPlugin.getDefault().downloadWGA(downloadMonitor, _addDialog.getLocation());
isCustomDownloadLocation = true;
} else {
wgaWar = WGADesignerPlugin.getDefault().downloadCurrentWGARelease(downloadMonitor);
}
if (!monitor.isCanceled()) {
SubProgressMonitor deployMonitor = new SubProgressMonitor(monitor, 10);
WGADeployment deployment = WGADesignerPlugin.getDefault().getWGADeploymentManager().createDeployment(_addDialog.getSymbolicName(), wgaWar.getFile(), deployMonitor);
if (deployment != null && isCustomDownloadLocation) {
deployment.setUpdateURL(_addDialog.getLocation());
}
}
} catch (Exception e) {
throw new InterruptedException(e.getMessage());
} finally {
if (wgaWar != null) {
wgaWar.delete();
}
monitor.done();
}
}
};