home *** CD-ROM | disk | FTP | other *** search
- package mug.app;
-
- import java.awt.Window;
- import java.io.File;
- import mug.ui.Callback;
- import mug.ui.QuestionDialog;
-
- public class SaveCommand extends Command implements Callback {
- private ApplicationFrame _app;
- private boolean _saveAs;
- private File _file;
-
- public SaveCommand(ApplicationFrame var1, boolean var2) {
- this._app = var1;
- this._saveAs = var2;
- }
-
- public void execute() {
- Document var1 = this._app.getDocument();
- if (this._saveAs || (this._file = var1.getFile()) == null) {
- if ((this._file = this._app.showSaveFileDialog()) == null) {
- return;
- }
-
- if (this._file.exists()) {
- String[] var2 = new String[]{"Ok", "Cancel"};
- QuestionDialog var3 = new QuestionDialog(this._app, this._saveAs ? "Save As" : "Save", true, this._app.overwriteMessage(), var2, this);
- ((Window)var3).show();
- return;
- }
- }
-
- if (var1.save(this._file)) {
- ((Command)this).executeNext();
- }
-
- }
-
- public void execute(Object var1, Object var2) {
- if (((String)var2).equals("Ok")) {
- Document var3 = this._app.getDocument();
- if (var3.save(this._file)) {
- ((Command)this).executeNext();
- }
- }
-
- }
- }
-