class ExitCommand implements Command { private static final Set commands = new HashSet(); static { commands.add(ActionNames.EXIT); } /** * Constructor for the ExitCommand object */ public ExitCommand() { } /** * Gets the ActionNames attribute of the ExitCommand object * * @return The ActionNames value */ public Set getActionNames() { return commands; } /** * Description of the Method * * @param e * Description of Parameter */ public void doAction(ActionEvent e) { ActionRouter.getInstance().doActionNow(new ActionEvent(e.getSource(), e.getID(), ActionNames.CHECK_DIRTY)); if (GuiPackage.getInstance().isDirty()) { int chosenOption = JOptionPane.showConfirmDialog(GuiPackage.getInstance().getMainFrame(), JMeterUtils .getResString("cancel_exit_to_save"), // $NON-NLS-1$ JMeterUtils.getResString("save?"), // $NON-NLS-1$ JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (chosenOption == JOptionPane.NO_OPTION) { System.exit(0); } else if (chosenOption == JOptionPane.YES_OPTION) { ActionRouter.getInstance().doActionNow(new ActionEvent(e.getSource(), e.getID(), ActionNames.SAVE_ALL_AS)); if (!GuiPackage.getInstance().isDirty()) { System.exit(0); } } } else { System.exit(0); } }
class ReportExitCommand implements Command { public static final String EXIT = "exit"; private static final Set commands = new HashSet(); static { commands.add(EXIT); } /** * Constructor for the ExitCommand object */ public ReportExitCommand() { } /** * Gets the ActionNames attribute of the ExitCommand object * * @return The ActionNames value */ public Set getActionNames() { return commands; } /** * Description of the Method * * @param e * Description of Parameter */ public void doAction(ActionEvent e) { ReportActionRouter.getInstance().doActionNow( new ActionEvent(e.getSource(), e.getID(), ReportCheckDirty.CHECK_DIRTY)); if (ReportGuiPackage.getInstance().isDirty()) { int chosenOption = JOptionPane.showConfirmDialog(ReportGuiPackage .getInstance().getMainFrame(), JMeterUtils .getResString("cancel_exit_to_save"), JMeterUtils .getResString("Save?"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (chosenOption == JOptionPane.NO_OPTION) { System.exit(0); } else if (chosenOption == JOptionPane.YES_OPTION) { ReportActionRouter.getInstance().doActionNow( new ActionEvent(e.getSource(), e.getID(), ReportSave.SAVE_ALL_AS)); if (!ReportGuiPackage.getInstance().isDirty()) { System.exit(0); } } } else { System.exit(0); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/ExitCommand.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/report/gui/action/ReportExitCommand.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
class ExitCommand implements Command {
1
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
		}
50
	}
51
	}
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0