home *** CD-ROM | disk | FTP | other *** search
- package mug.app;
-
- import java.awt.Window;
- import mug.ui.Callback;
- import mug.ui.QuestionDialog;
-
- public class CloseCommand extends Command implements Callback {
- private ApplicationFrame _app;
-
- public CloseCommand(ApplicationFrame var1) {
- this._app = var1;
- }
-
- public void execute() {
- Document var1 = this._app.getDocument();
- if (var1.isModified()) {
- String[] var2 = new String[]{"Discard Changes", "Cancel", "Save Changes"};
- QuestionDialog var3 = new QuestionDialog(this._app, true, this._app.unsavedChangesMessage(), var2, this);
- ((Window)var3).show();
- } else {
- ((Command)this).executeNext();
- }
- }
-
- public void execute(Object var1, Object var2) {
- if (((String)var2).equals("Discard Changes")) {
- ((Command)this).executeNext();
- } else {
- if (((String)var2).equals("Save Changes")) {
- ((Command)this).executeNext(new SaveCommand(this._app, false));
- }
-
- }
- }
- }
-