public void run() {
// call Save Reminder dialog
SaveReminderDialog dialog = new SaveReminderDialog(window.getShell());
- SaveReminderDialog.Result result = dialog.open();
+ SaveReminderDialog.ResultChoice result = dialog.open();
if (result != null) {
- /* check return choice in result here and fire appropriate action:
- * - save now and then close file ("Save now")
- * - do not save and then close file ("I've already saved my work")
- * - cancel the close ("Do not close this file")
- */
- /*if (confirmClose(window)) {
- window.close();
- // TODO: not really; you'll close the file here after a confirmation from the user via the ConfirmSaved dialog
- System.exit(0);
- }*/
+ // check return choice in result here and fire appropriate action:
+ switch (result) {
+ case SAVE: // save now and then close file ("Save now")
+ //TODO: trigger Save dialog to save the file
+ window.getView().resetView(); // clear current data and work
+ break;
+ case NOSAVE: // do not save and then close file ("I've already saved my work")
+ window.getView().resetView(); // clear current data and work
+ status("Closed");
+ break;
+ case CANCEL: // cancel the close ("Do not close this file")
+ status("Close cancelled.");
+ break;
+ }
}
}
package ie.dcu.apps.ist.dialogs;
+import ie.dcu.apps.ist.dialogs.ExportDialog.Result;
+import ie.dcu.apps.ist.export.imagemap.AreaShape;
+import ie.dcu.apps.ist.export.imagemap.RolloverEffect;
+
+import java.io.File;
+
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Shell;
public class SaveReminderDialog extends Dialog {
- // Default title
- private static final String TITLE = "Save Reminder";
- public class Result {};
-
public SaveReminderDialog(Shell shell) {
super(shell);
setText(TITLE);
}
-
- public Result open() {
- return null;
+
+ public enum ResultChoice {
+ SAVE, NOSAVE, CANCEL
}
- //return MessageDialog.openConfirm(
- // window.getShell(), "Save",
- // "Have you remembered to save your work before closing this file?");
+ // Default title
+ private static final String TITLE = "Save Reminder";
+
+ public ResultChoice open() {
+ //TODO: build dialog UI here
+ return ResultChoice.SAVE;
+ }
}