public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); if (action.equals(DELETE)) { deleteArgument(); } else if (action.equals(ADD)) { addArgument(); } } /** * Remove the currently selected argument from the table. */ protected void deleteArgument() { // If a table cell is being edited, we must cancel the editing before // deleting the row if (table.isEditing()) { TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn()); cellEditor.cancelCellEditing(); } int rowSelected = table.getSelectedRow(); if (rowSelected >= 0) { tableModel.removeRow(rowSelected); tableModel.fireTableDataChanged(); // Disable DELETE if there are no rows in the table to delete. if (tableModel.getRowCount() == 0) { delete.setEnabled(false); } // Table still contains one or more rows, so highlight (select) // the appropriate one. else { int rowToSelect = rowSelected; if (rowSelected >= tableModel.getRowCount()) { rowToSelect = rowSelected - 1; } table.setRowSelectionInterval(rowToSelect, rowToSelect); } } } /** * Add a new argument row to the table. */ protected void addArgument() { // If a table cell is being edited, we should accept the current value // and stop the editing before adding a new row. stopTableEditing(); tableModel.addRow(makeNewArgument()); // Enable DELETE (which may already be enabled, but it won't hurt) delete.setEnabled(true); // Highlight (select) the appropriate row. int rowToSelect = tableModel.getRowCount() - 1; table.setRowSelectionInterval(rowToSelect, rowToSelect); } /** * Create a new Argument object. * * @return a new Argument object */ protected Object makeNewArgument() { return new Argument("", ""); // $NON-NLS-1$ // $NON-NLS-2
public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); if (action.equals(DELETE)) { deleteArgument(); } else if (action.equals(ADD)) { addArgument(); } } /** * Remove the currently selected argument from the table. */ protected void deleteArgument() { // If a table cell is being edited, we must cancel the editing before // deleting the row if (table.isEditing()) { TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn()); cellEditor.cancelCellEditing(); } int rowSelected = table.getSelectedRow(); if (rowSelected >= 0) { tableModel.removeRow(rowSelected); tableModel.fireTableDataChanged(); // Disable DELETE if there are no rows in the table to delete. if (tableModel.getRowCount() == 0) { delete.setEnabled(false); } // Table still contains one or more rows, so highlight (select) // the appropriate one. else { int rowToSelect = rowSelected; if (rowSelected >= tableModel.getRowCount()) { rowToSelect = rowSelected - 1; } table.setRowSelectionInterval(rowToSelect, rowToSelect); } } } /** * Add a new argument row to the table. */ protected void addArgument() { // If a table cell is being edited, we should accept the current value // and stop the editing before adding a new row. stopTableEditing(); tableModel.addRow(makeNewLDAPArgument()); // Enable DELETE (which may already be enabled, but it won't hurt) delete.setEnabled(true); // Highlight (select) the appropriate row. int rowToSelect = tableModel.getRowCount() - 1; table.setRowSelectionInterval(rowToSelect, rowToSelect); } /** * Create a new LDAPArgument object. * * @return a new LDAPArgument object */ protected Object makeNewLDAPArgument() { return new LDAPArgument("", "", "")
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/config/gui/ArgumentsPanel.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public void actionPerformed(ActionEvent e) {
1
public void actionPerformed(ActionEvent e) {
2
		String action = e.getActionCommand();
2
		String action = e.getActionCommand();
3
		if (action.equals(DELETE)) {
3
		if (action.equals(DELETE)) {
4
			deleteArgument();
4
			deleteArgument();
5
		} else if (action.equals(ADD)) {
5
		} else if (action.equals(ADD)) {
6
			addArgument();
6
			addArgument();
7
		}
7
		}
8
	}
8
	}
9
	/**
9
	/**
10
	 * Remove the currently selected argument from the table.
10
	 * Remove the currently selected argument from the table.
11
	 */
11
	 */
12
	protected void deleteArgument() {
12
	protected void deleteArgument() {
13
		// If a table cell is being edited, we must cancel the editing before
13
		// If a table cell is being edited, we must cancel the editing before
14
		// deleting the row
14
		// deleting the row
15
		if (table.isEditing()) {
15
		if (table.isEditing()) {
16
			TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
16
			TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
17
			cellEditor.cancelCellEditing();
17
			cellEditor.cancelCellEditing();
18
		}
18
		}
19
		int rowSelected = table.getSelectedRow();
19
		int rowSelected = table.getSelectedRow();
20
		if (rowSelected >= 0) {
20
		if (rowSelected >= 0) {
21
			tableModel.removeRow(rowSelected);
21
			tableModel.removeRow(rowSelected);
22
			tableModel.fireTableDataChanged();
22
			tableModel.fireTableDataChanged();
23
			// Disable DELETE if there are no rows in the table to delete.
23
			// Disable DELETE if there are no rows in the table to delete.
24
			if (tableModel.getRowCount() == 0) {
24
			if (tableModel.getRowCount() == 0) {
25
				delete.setEnabled(false);
25
				delete.setEnabled(false);
26
			}
26
			}
27
			// Table still contains one or more rows, so highlight (select)
27
			// Table still contains one or more rows, so highlight (select)
28
			// the appropriate one.
28
			// the appropriate one.
29
			else {
29
			else {
30
				int rowToSelect = rowSelected;
30
				int rowToSelect = rowSelected;
31
				if (rowSelected >= tableModel.getRowCount()) {
31
				if (rowSelected >= tableModel.getRowCount()) {
32
					rowToSelect = rowSelected - 1;
32
					rowToSelect = rowSelected - 1;
33
				}
33
				}
34
				table.setRowSelectionInterval(rowToSelect, rowToSelect);
34
				table.setRowSelectionInterval(rowToSelect, rowToSelect);
35
			}
35
			}
36
		}
36
		}
37
	}
37
	}
38
	/**
38
	/**
39
	 * Add a new argument row to the table.
39
	 * Add a new argument row to the table.
40
	 */
40
	 */
41
	protected void addArgument() {
41
	protected void addArgument() {
42
		// If a table cell is being edited, we should accept the current value
42
		// If a table cell is being edited, we should accept the current value
43
		// and stop the editing before adding a new row.
43
		// and stop the editing before adding a new row.
44
		stopTableEditing();
44
		stopTableEditing();
45
		tableModel.addRow(makeNewArgument());
45
		tableModel.addRow(makeNewLDAPArgument());
46
		// Enable DELETE (which may already be enabled, but it won't hurt)
46
		// Enable DELETE (which may already be enabled, but it won't hurt)
47
		delete.setEnabled(true);
47
		delete.setEnabled(true);
48
		// Highlight (select) the appropriate row.
48
		// Highlight (select) the appropriate row.
49
		int rowToSelect = tableModel.getRowCount() - 1;
49
		int rowToSelect = tableModel.getRowCount() - 1;
50
		table.setRowSelectionInterval(rowToSelect, rowToSelect);
50
		table.setRowSelectionInterval(rowToSelect, rowToSelect);
51
	}
51
	}
52
	/**
52
	/**
53
	 * Create a new Argument object.
53
	 * Create a new LDAPArgument object.
54
	 * 
54
	 * 
55
	 * @return a new Argument object
55
	 * @return a new LDAPArgument object
56
	 */
56
	 */
57
	protected Object makeNewArgument() {
57
	protected Object makeNewLDAPArgument() {
58
		return new Argument("", ""); // $NON-NLS-1$ // $NON-NLS-2
58
		return new LDAPArgument("", "", "")
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