1 | public class ExitCommand implements Command {↵ | | 1 | public class ReportExitCommand implements Command {↵
|
|
| | | 2 | public static final String EXIT = "exit";↵
|
|
2 | private static final Set commands = new HashSet();↵ | | 3 | private static final Set commands = new HashSet();↵
|
|
3 | static {↵ | | 4 | static {↵
|
4 | commands.add(ActionNames.EXIT);↵ | | 5 | commands.add(EXIT);↵
|
5 | }↵ | | 6 | }↵
|
|
6 | /**↵ | | 7 | /**↵
|
7 | * Constructor for the ExitCommand object↵ | | 8 | * Constructor for the ExitCommand object↵
|
8 | */↵ | | 9 | */↵
|
9 | public ExitCommand() {↵ | | 10 | public ReportExitCommand() {↵
|
10 | }↵ | | 11 | }↵
|
|
11 | /**↵ | | 12 | /**↵
|
12 | * Gets the ActionNames attribute of the ExitCommand object↵ | | 13 | * Gets the ActionNames attribute of the ExitCommand object↵
|
13 | * ↵ | | 14 | * ↵
|
14 | * @return The ActionNames value↵ | | 15 | * @return The ActionNames value↵
|
15 | */↵ | | 16 | */↵
|
16 | public Set getActionNames() {↵ | | 17 | public Set getActionNames() {↵
|
17 | return commands;↵ | | 18 | return commands;↵
|
18 | }↵ | | 19 | }↵
|
|
19 | /**↵ | | 20 | /**↵
|
20 | * Description of the Method↵ | | 21 | * Description of the Method↵
|
21 | * ↵ | | 22 | * ↵
|
22 | * @param e↵ | | 23 | * @param e↵
|
23 | * Description of Parameter↵ | | 24 | * Description of Parameter↵
|
24 | */↵ | | 25 | */↵
|
25 | public void doAction(ActionEvent e) {↵ | | 26 | public void doAction(ActionEvent e) {↵
|
26 | ActionRouter.getInstance().doActionNow(↵ | | 27 | ReportActionRouter.getInstance().doActionNow(↵
|
27 | new ActionEvent(e.getSource(), e.getID(), ActionNames↵ | | 28 | new ActionEvent(e.getSource(), e.getID(),↵
|
28 | .CHECK_DIRTY));↵ | | 29 | ReportCheckDirty.CHECK_DIRTY));↵
|
29 | if (GuiPackage.getInstance().isDirty()) {↵ | | 30 | if (ReportGuiPackage.getInstance().isDirty()) {↵
|
30 | int chosenOption = JOptionPane.showConfirmDialog(GuiPackage↵ | | 31 | int chosenOption = JOptionPane.showConfirmDialog(ReportGuiPackage↵
|
31 | .getInstance().getMainFrame(), JMeterUtils↵ | | 32 | .getInstance().getMainFrame(), JMeterUtils↵
|
32 | .getResString("cancel_exit_to_save"), // $NON-NLS-1$↵ | | 33 | .getResString("cancel_exit_to_save"), ↵
|
33 | JMeterUtils↵ | | 34 | JMeterUtils↵
|
34 | .getResString("save?"), // $NON-NLS-1$↵ | | 35 | .getResString("Save?"), ↵
|
35 | JOptionPane.YES_NO_CANCEL_OPTION, ↵ | | 36 | JOptionPane.YES_NO_CANCEL_OPTION,↵
|
36 | JOptionPane.QUESTION_MESSAGE);↵ | | 37 | JOptionPane.QUESTION_MESSAGE);↵
|
37 | if (chosenOption == JOptionPane.NO_OPTION) {↵ | | 38 | if (chosenOption == JOptionPane.NO_OPTION) {↵
|
38 | System.exit(0);↵ | | 39 | System.exit(0);↵
|
39 | } else if (chosenOption == JOptionPane.YES_OPTION) {↵ | | 40 | } else if (chosenOption == JOptionPane.YES_OPTION) {↵
|
40 | ActionRouter.getInstance().doActionNow(↵ | | 41 | ReportActionRouter.getInstance().doActionNow(↵
|
41 | new ActionEvent(e.getSource(), e.getID(), ActionNames↵ | | 42 | new ActionEvent(e.getSource(), e.getID(),↵
|
42 | .SAVE_ALL_AS));↵ | | 43 | ReportSave.SAVE_ALL_AS));↵
|
43 | if (!GuiPackage.getInstance().isDirty()) {↵ | | 44 | if (!ReportGuiPackage.getInstance().isDirty()) {↵
|
44 | System.exit(0);↵ | | 45 | System.exit(0);↵
|
45 | }↵ | | 46 | }↵
|
46 | }↵ | | 47 | }↵
|
47 | } else {↵ | | 48 | } else {↵
|
48 | System.exit(0);↵ | | 49 | System.exit(0);↵
|
49 | | | 50 |
|