}
// don't save if we don't prompt
int choice = ISaveablePart2.NO;
MessageDialog dialog;
if (stillOpenElsewhere) {
String message = NLS
.bind(
WorkbenchMessages.EditorManager_saveChangesOptionallyQuestion,
model.getName());
MessageDialogWithToggle dialogWithToggle = new MessageDialogWithToggle(shellProvider.getShell(),
WorkbenchMessages.Save_Resource, null, message,
MessageDialog.QUESTION, buttons, 0, WorkbenchMessages.EditorManager_closeWithoutPromptingOption, false) {
protected int getShellStyle() {
return (canCancel ? SWT.CLOSE : SWT.NONE)
| SWT.TITLE | SWT.BORDER
| SWT.APPLICATION_MODAL
| getDefaultOrientation();
}
};
dialog = dialogWithToggle;
} else {
String message = NLS
.bind(
WorkbenchMessages.EditorManager_saveChangesQuestion,
model.getName());
dialog = new MessageDialog(shellProvider.getShell(),
WorkbenchMessages.Save_Resource, null, message,
MessageDialog.QUESTION, buttons, 0) {
protected int getShellStyle() {
return (canCancel ? SWT.CLOSE : SWT.NONE)
| SWT.TITLE | SWT.BORDER
| SWT.APPLICATION_MODAL
| getDefaultOrientation();
}
};
}
choice = SaveableHelper.testGetAutomatedResponse();
if (SaveableHelper.testGetAutomatedResponse() == SaveableHelper.USER_RESPONSE) {
choice = dialog.open();
if(stillOpenElsewhere) {
// map value of choice back to ISaveablePart2 values
switch (choice) {
case IDialogConstants.YES_ID: