boolean isValidDragAction(JMeterTreeNode[] source, JMeterTreeNode dest) { boolean isValid = true; TreeNode[] path = dest.getPath(); for (int i = 0; i < path.length; i++) { if (contains(source, path[i])) { isValid = false; } } return isValid; } public void mouseEntered(MouseEvent e) { } private void changeSelectionIfDragging(MouseEvent e) { if (dragging) { GuiPackage.getInstance().getMainFrame().drawDraggedComponent(dragIcon, e.getX(), e.getY()); if (tree.getPathForLocation(e.getX(), e.getY()) != null) { currentPath = tree.getPathForLocation(e.getX(), e.getY()); if (!contains(draggedNodes, getCurrentNode())) { tree.setSelectionPath(currentPath); } } } } private boolean contains(Object[] container, Object item) { for (int i = 0; i < container.length; i++) { if (container[i] == item) { return true; } } return false; } public void mousePressed(MouseEvent e) { // Get the Main Frame. MainFrame mainFrame = GuiPackage.getInstance().getMainFrame(); // Close any Main Menu that is open mainFrame.closeMenu(); int selRow = tree.getRowForLocation(e.getX(), e.getY()); if (tree.getPathForLocation(e.getX(), e.getY()) != null) { log.debug("mouse pressed, updating currentPath"); currentPath = tree.getPathForLocation(e.getX(), e.getY()); } if (selRow != -1
boolean isValidDragAction(ReportTreeNode[] source, ReportTreeNode dest) { boolean isValid = true; TreeNode[] path = dest.getPath(); for (int i = 0; i < path.length; i++) { if (contains(source, path[i])) { isValid = false; } } return isValid; } public void mouseEntered(MouseEvent e) { } private void changeSelectionIfDragging(MouseEvent e) { if (dragging) { ReportGuiPackage.getInstance().getMainFrame().drawDraggedComponent(dragIcon, e.getX(), e.getY()); if (tree.getPathForLocation(e.getX(), e.getY()) != null) { currentPath = tree.getPathForLocation(e.getX(), e.getY()); if (!contains(draggedNodes, getCurrentNode())) { tree.setSelectionPath(currentPath); } } } } private boolean contains(Object[] container, Object item) { for (int i = 0; i < container.length; i++) { if (container[i] == item) { return true; } } return false; } public void mousePressed(MouseEvent e) { // Get the Main Frame. ReportMainFrame mainFrame = ReportGuiPackage.getInstance().getMainFrame(); // Close any Main Menu that is open mainFrame.closeMenu(); int selRow = tree.getRowForLocation(e.getX(), e.getY()); if (tree.getPathForLocation(e.getX(), e.getY()) != null) { log.debug("mouse pressed, updating currentPath"); currentPath = tree.getPathForLocation(e.getX(), e.getY()); } if (selRow != -1
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/tree/JMeterTreeListener.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/report/gui/tree/ReportTreeListener.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
boolean isValidDragAction(JMeterTreeNode[] source, JMeterTreeNode dest) {
1
boolean isValidDragAction(ReportTreeNode[] source, ReportTreeNode dest) {
2
		boolean isValid = true;
2
		boolean isValid = true;
3
		TreeNode[] path = dest.getPath();
3
		TreeNode[] path = dest.getPath();
4
		for (int i = 0; i < path.length; i++) {
4
		for (int i = 0; i < path.length; i++) {
5
			if (contains(source, path[i])) {
5
			if (contains(source, path[i])) {
6
				isValid = false;
6
				isValid = false;
7
			}
7
			}
8
		}
8
		}
9
		return isValid;
9
		return isValid;
10
	}
10
	}
11
	public void mouseEntered(MouseEvent e) {
11
	public void mouseEntered(MouseEvent e) {
12
	}
12
	}
13
	private void changeSelectionIfDragging(MouseEvent e) {
13
	private void changeSelectionIfDragging(MouseEvent e) {
14
		if (dragging) {
14
		if (dragging) {
15
			GuiPackage.getInstance().getMainFrame().drawDraggedComponent(dragIcon, e.getX(), e.getY());
15
			ReportGuiPackage.getInstance().getMainFrame().drawDraggedComponent(dragIcon, e.getX(), e.getY());
16
			if (tree.getPathForLocation(e.getX(), e.getY()) != null) {
16
			if (tree.getPathForLocation(e.getX(), e.getY()) != null) {
17
				currentPath = tree.getPathForLocation(e.getX(), e.getY());
17
				currentPath = tree.getPathForLocation(e.getX(), e.getY());
18
				if (!contains(draggedNodes, getCurrentNode())) {
18
				if (!contains(draggedNodes, getCurrentNode())) {
19
					tree.setSelectionPath(currentPath);
19
					tree.setSelectionPath(currentPath);
20
				}
20
				}
21
			}
21
			}
22
		}
22
		}
23
	}
23
	}
24
	private boolean contains(Object[] container, Object item) {
24
	private boolean contains(Object[] container, Object item) {
25
		for (int i = 0; i < container.length; i++) {
25
		for (int i = 0; i < container.length; i++) {
26
			if (container[i] == item) {
26
			if (container[i] == item) {
27
				return true;
27
				return true;
28
			}
28
			}
29
		}
29
		}
30
		return false;
30
		return false;
31
	}
31
	}
32
	public void mousePressed(MouseEvent e) {
32
	public void mousePressed(MouseEvent e) {
33
		// Get the Main Frame.
33
		// Get the Main Frame.
34
		MainFrame mainFrame = GuiPackage.getInstance().getMainFrame();
34
		ReportMainFrame mainFrame = ReportGuiPackage.getInstance().getMainFrame();
35
		// Close any Main Menu that is open
35
		// Close any Main Menu that is open
36
		mainFrame.closeMenu();
36
		mainFrame.closeMenu();
37
		int selRow = tree.getRowForLocation(e.getX(), e.getY());
37
		int selRow = tree.getRowForLocation(e.getX(), e.getY());
38
		if (tree.getPathForLocation(e.getX(), e.getY()) != null) {
38
		if (tree.getPathForLocation(e.getX(), e.getY()) != null) {
39
			log.debug("mouse pressed, updating currentPath");
39
			log.debug("mouse pressed, updating currentPath");
40
			currentPath = tree.getPathForLocation(e.getX(), e.getY());
40
			currentPath = tree.getPathForLocation(e.getX(), e.getY());
41
		}
41
		}
42
		if (selRow != -1
42
		if (selRow != -1
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