}
String message = NLS.bind(warning, new Object[] { status.getMessage(), operation.getLabel() });
String[] buttons = new String[] { IDialogConstants.YES_LABEL,
IDialogConstants.NO_LABEL };
MessageDialog dialog = new MessageDialog(shell, title, null,
message, MessageDialog.WARNING, buttons, 0);
int dialogAnswer = dialog.open();
// The user has been given the specific status and has chosen
// to proceed or to cancel. The user choice determines what
// the status should be at this point, OK or CANCEL.
if (dialogAnswer == Window.OK) {
reportedStatus = Status.OK_STATUS;
} else {
reportedStatus = Status.CANCEL_STATUS;
}
} else {
String title, stopped;
switch (doing) {
case UNDOING:
title = WorkbenchMessages.Operations_undoProblem;
stopped = WorkbenchMessages.Operations_stoppedOnUndoErrorStatus;
break;
case REDOING:
title = WorkbenchMessages.Operations_redoProblem;
stopped = WorkbenchMessages.Operations_stoppedOnRedoErrorStatus;
break;
default: // EXECUTING
title = WorkbenchMessages.Operations_executeProblem;
stopped = WorkbenchMessages.Operations_stoppedOnExecuteErrorStatus;
break;
}
// It is an error condition. The user has no choice to proceed, so
// we only report what has gone on. We use a warning icon instead of
// an error icon since there has not yet been a failure.
String message = NLS.bind(stopped, status.getMessage(), operation
.getLabel());
MessageDialog dialog = new MessageDialog(shell, title, null,
message, MessageDialog.WARNING,
new String[] { IDialogConstants.OK_LABEL }, 0); // ok
dialog.open();
}
if (createdShell) {
shell.dispose();
}