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(); menuMap
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(); nonTestElements
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/ReportMenuFactory.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/MenuFactory.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
	 */
15
	public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {
24
	public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {
16
		JMenuItem newMenuChoice = new JMenuItem(label);
25
		JMenuItem newMenuChoice = new JMenuItem(label);
17
		newMenuChoice.setName(name);
26
		newMenuChoice.setName(name);
18
		newMenuChoice.addActionListener(ReportActionRouter.getInstance());
27
		newMenuChoice.addActionListener(ActionRouter.getInstance());
19
		if (actionCommand != null) {
28
		if (actionCommand != null) {
20
			newMenuChoice.setActionCommand(actionCommand);
29
			newMenuChoice.setActionCommand(actionCommand);
21
		}
30
		}
22
		return newMenuChoice;
31
		return newMenuChoice;
23
	}
32
	}
24
	public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {
33
	public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {
25
		JMenuItem item = makeMenuItem(label, name, actionCommand);
34
		JMenuItem item = makeMenuItem(label, name, actionCommand);
26
		item.setAccelerator(accel);
35
		item.setAccelerator(accel);
27
		return item;
36
		return item;
28
	}
37
	}
29
	private static void initializeMenus() {
38
	private static void initializeMenus() {
30
		try {
39
		try {
31
			List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {
40
			List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {
32
					JMeterGUIComponent.class, TestBean.class });
41
					JMeterGUIComponent.class, TestBean.class });
33
			controllers = new LinkedList();
42
			timers = new LinkedList();
34
			configElements = new LinkedList();
43
			controllers = new LinkedList();
35
			listeners = new LinkedList();
44
			samplers = new LinkedList();
36
			postProcessors = new LinkedList();
45
			configElements = new LinkedList();
37
			preProcessors = new LinkedList();
46
			assertions = new LinkedList();
38
			tables = new LinkedList();
47
			listeners = new LinkedList();
39
			reportPage = new LinkedList();
48
			postProcessors = new LinkedList();
40
			nonTestElements = new LinkedList();
49
			preProcessors = new LinkedList();
41
			menuMap
50
			nonTestElements
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