JMenu makeMenu(Collection menuInfo, String actionCommand, String menuName) { Iterator iter = menuInfo.iterator(); JMenu menu = new JMenu(menuName); while (iter.hasNext()) { MenuInfo info = (MenuInfo) iter.next(); menu.add(makeMenuItem(info.label, info.className, actionCommand)); } return menu; } public static void setEnabled(JMenu menu) { if (menu.getSubElements().length == 0) { menu.setEnabled(false); } } /** * Create a single menu item * * @param label for the MenuItem * @param name for the MenuItem * @param actionCommand - predefined string, e.g. ActionNames.ADD * @see org.apache.jmeter.gui.action.ActionNames * @return the menu item */ public static JMenuItem makeMenuItem(String label, String name, String actionCommand) { JMenuItem newMenuChoice = new JMenuItem(label); newMenuChoice.setName(name); newMenuChoice.addActionListener(ActionRouter.getInstance()); if (actionCommand != null) { newMenuChoice.setActionCommand(actionCommand); } return newMenuChoice; } public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) { JMenuItem item = makeMenuItem(label, name, actionCommand); item.setAccelerator(accel); return item; } private static void initializeMenus() { try { List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] { JMeterGUIComponent.class, TestBean.class }); timers = new LinkedList(); controllers = new LinkedList(); samplers = new LinkedList(); configElements = new LinkedList(); assertions = new LinkedList(); listeners = new LinkedList(); postProcessors = new LinkedList(); preProcessors = new LinkedList(); nonTestElement
JMenu makeMenu(Collection menuInfo, String actionCommand, String menuName) { Iterator iter = menuInfo.iterator(); JMenu menu = new JMenu(menuName); while (iter.hasNext()) { MenuInfo info = (MenuInfo) iter.next(); menu.add(makeMenuItem(info.label, info.className, actionCommand)); } return menu; } public static void setEnabled(JMenu menu) { if (menu.getSubElements().length == 0) { menu.setEnabled(false); } } public static JMenuItem makeMenuItem(String label, String name, String actionCommand) { JMenuItem newMenuChoice = new JMenuItem(label); newMenuChoice.setName(name); newMenuChoice.addActionListener(ReportActionRouter.getInstance()); if (actionCommand != null) { newMenuChoice.setActionCommand(actionCommand); } return newMenuChoice; } public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) { JMenuItem item = makeMenuItem(label, name, actionCommand); item.setAccelerator(accel); return item; } private static void initializeMenus() { try { List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] { JMeterGUIComponent.class, TestBean.class }); controllers = new LinkedList(); configElements = new LinkedList(); listeners = new LinkedList(); postProcessors = new LinkedList(); preProcessors = new LinkedList(); tables = new LinkedList(); reportPage = new LinkedList(); nonTestElements = new LinkedList(); menuMa
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/MenuFactory.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/ReportMenuFactory.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
JMenu makeMenu(Collection menuInfo, String actionCommand, String menuName) {
1
JMenu makeMenu(Collection menuInfo, String actionCommand, String menuName) {
2
		Iterator iter = menuInfo.iterator();
2
		Iterator iter = menuInfo.iterator();
3
		JMenu menu = new JMenu(menuName);
3
		JMenu menu = new JMenu(menuName);
4
		while (iter.hasNext()) {
4
		while (iter.hasNext()) {
5
			MenuInfo info = (MenuInfo) iter.next();
5
			MenuInfo info = (MenuInfo) iter.next();
6
			menu.add(makeMenuItem(info.label, info.className, actionCommand));
6
			menu.add(makeMenuItem(info.label, info.className, actionCommand));
7
		}
7
		}
8
		return menu;
8
		return menu;
9
	}
9
	}
10
	public static void setEnabled(JMenu menu) {
10
	public static void setEnabled(JMenu menu) {
11
		if (menu.getSubElements().length == 0) {
11
		if (menu.getSubElements().length == 0) {
12
			menu.setEnabled(false);
12
			menu.setEnabled(false);
13
		}
13
		}
14
	}
14
	}
15
	/**
16
	 * Create a single menu item
17
	 * 
18
	 * @param label for the MenuItem
19
	 * @param name for the MenuItem
20
	 * @param actionCommand - predefined string, e.g. ActionNames.ADD
21
	 *     @see org.apache.jmeter.gui.action.ActionNames
22
	 * @return the menu item
23
	 */
24
	public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {
15
	public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {
25
		JMenuItem newMenuChoice = new JMenuItem(label);
16
		JMenuItem newMenuChoice = new JMenuItem(label);
26
		newMenuChoice.setName(name);
17
		newMenuChoice.setName(name);
27
		newMenuChoice.addActionListener(ActionRouter.getInstance());
18
		newMenuChoice.addActionListener(ReportActionRouter.getInstance());
28
		if (actionCommand != null) {
19
		if (actionCommand != null) {
29
			newMenuChoice.setActionCommand(actionCommand);
20
			newMenuChoice.setActionCommand(actionCommand);
30
		}
21
		}
31
		return newMenuChoice;
22
		return newMenuChoice;
32
	}
23
	}
33
	public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {
24
	public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {
34
		JMenuItem item = makeMenuItem(label, name, actionCommand);
25
		JMenuItem item = makeMenuItem(label, name, actionCommand);
35
		item.setAccelerator(accel);
26
		item.setAccelerator(accel);
36
		return item;
27
		return item;
37
	}
28
	}
38
	private static void initializeMenus() {
29
	private static void initializeMenus() {
39
		try {
30
		try {
40
			List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {
31
			List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {
41
					JMeterGUIComponent.class, TestBean.class });
32
					JMeterGUIComponent.class, TestBean.class });
42
			timers = new LinkedList();
33
			controllers = new LinkedList();
43
			controllers = new LinkedList();
34
			configElements = new LinkedList();
44
			samplers = new LinkedList();
35
			listeners = new LinkedList();
45
			configElements = new LinkedList();
36
			postProcessors = new LinkedList();
46
			assertions = new LinkedList();
37
			preProcessors = new LinkedList();
47
			listeners = new LinkedList();
38
			tables = new LinkedList();
48
			postProcessors = new LinkedList();
39
			reportPage = new LinkedList();
49
			preProcessors = new LinkedList();
40
			nonTestElements = new LinkedList();
50
			nonTestElement
41
			menuMa
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