use of com.microsoft.azuretools.utils.CanceledByUserException in project azure-tools-for-java by Microsoft.
the class WebAppDeployDialog method updateAndFillTable.
private void updateAndFillTable() {
try {
ProgressDialog.get(getShell(), "Update Azure Local Cache Progress").run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Updating Azure local cache...", IProgressMonitor.UNKNOWN);
try {
if (monitor.isCanceled()) {
throw new CanceledByUserException();
}
AzureModelController.updateResourceGroupMaps(new UpdateProgressIndicator(monitor));
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
doFillTable();
}
});
} catch (CanceledByUserException ex) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
System.out.println("updateAndFillTable(): Canceled by user");
cancelPressed();
}
});
} catch (Exception ex) {
ex.printStackTrace();
LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "run@ProgressDialog@updateAndFillTable@AppServiceCreateDialog", ex));
}
monitor.done();
}
});
} catch (InvocationTargetException | InterruptedException ex) {
ex.printStackTrace();
LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "updateAndFillTable@AppServiceCreateDialog", ex));
}
}
use of com.microsoft.azuretools.utils.CanceledByUserException in project azure-tools-for-java by Microsoft.
the class WebAppDeployDialog method updateAndFillTable.
private void updateAndFillTable() {
ProgressManager.getInstance().run(new Task.Modal(project, "Update Azure Local Cache Progress", true) {
@Override
public void run(ProgressIndicator progressIndicator) {
progressIndicator.setIndeterminate(true);
try {
if (progressIndicator.isCanceled()) {
throw new CanceledByUserException();
}
AzureModelController.updateResourceGroupMaps(new UpdateProgressIndicator(progressIndicator));
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
doFillTable();
}
}, ModalityState.any());
} catch (CanceledByUserException ex) {
//AzureModel.getInstance().setResourceGroupToWebAppMap(null);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
System.out.println("updateAndFillTable(): Canceled by user");
doCancelAction();
}
}, ModalityState.any());
} catch (Exception ex) {
ex.printStackTrace();
LOGGER.debug("updateAndFillTable", ex);
}
}
});
}
Aggregations