}
private void doDeleteBundleDeployment() {
String deleteSubmittedMessage = MSG.view_bundle_deploy_deleteSubmitted(deployment.getName());
getMessageCenter().notify(new Message(deleteSubmittedMessage, Message.Severity.Info));
final Duration duration = new Duration();
BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
bundleService.deleteBundleDeployment(deployment.getId(), new AsyncCallback<Void>() {
@Override
public void onFailure(final Throwable caught) {
Timer timer = new Timer() {
@Override
public void run() {
String message = MSG.view_bundle_deploy_deleteFailure(deployment.getName());
getErrorHandler().handleError(message, caught);
}
};
// Delay the showing of the result to give the user some time to see the deleteSubmitted notif
timer.schedule(Math.max(0, 3 * 1000 - duration.elapsedMillis()));
}
@Override
public void onSuccess(Void result) {
Timer timer = new Timer() {
@Override
public void run() {
String message = MSG.view_bundle_deploy_deleteSuccessful(deployment.getName());
getMessageCenter().notify(new Message(message, Message.Severity.Info));
// Bundle deployment is deleted, go back to main bundle destinations view
goToView(
LinkManager.getBundleDestinationLink(bundle.getId(), deployment.getDestination().getId()),
true);
}
};
// Delay the showing of the result to give the user some time to see the deleteSubmitted notif
timer.schedule(Math.max(0, 3 * 1000 - duration.elapsedMillis()));
}
});
}