01: /**
02: * SEQUENCE - A very simple sequence diagram editor
03: * Copyright (C) 2002 Alex Moffat
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: */package com.zanthan.sequence;
19:
20: import java.io.File;
21:
22: import javax.swing.JFileChooser;
23:
24: // MODIFIED: so that it doesn't disable itself.
25: public class SaveAsAction extends ModelAction {
26:
27: SaveAsAction(Model model) {
28: super ("SaveAsAction", model);
29: }
30:
31: boolean doIt() {
32: final JFileChooser chooser = new JFileChooser();
33: chooser.setDialogType(JFileChooser.SAVE_DIALOG);
34: chooser.setDialogTitle(getResource("dialogTitle"));
35:
36: int returnVal = chooser.showSaveDialog(Sequence.getInstance());
37: if (returnVal == JFileChooser.APPROVE_OPTION) {
38: File file = chooser.getSelectedFile();
39: return getModel().writeToFile(file);
40: } else {
41: return false;
42: }
43: }
44: }
|