diff --git a/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java b/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java index 97a97c6de01..df11ac46fc5 100644 --- a/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java +++ b/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java @@ -408,10 +408,7 @@ private JPanel createButtonPanel() { private class ClearPatternsListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - if (stringTable.isEditing()) { - TableCellEditor cellEditor = stringTable.getCellEditor(stringTable.getEditingRow(), stringTable.getEditingColumn()); - cellEditor.cancelCellEditing(); - } + GuiUtils.cancelEditing(stringTable); int[] rowsSelected = stringTable.getSelectedRows(); stringTable.clearSelection(); diff --git a/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java b/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java index 92a79fb9382..e82b6b93a0c 100644 --- a/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java +++ b/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java @@ -329,11 +329,7 @@ public void actionPerformed(ActionEvent e) { private class DeleteRowAction implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - if (paramTable.isEditing()) { - TableCellEditor cellEditor = paramTable.getCellEditor(paramTable.getEditingRow(), paramTable - .getEditingColumn()); - cellEditor.cancelCellEditing(); - } + GuiUtils.cancelEditing(paramTable); int rowSelected = paramTable.getSelectedRow(); if (rowSelected >= 0) { @@ -363,11 +359,7 @@ public void actionPerformed(ActionEvent e) { private class DeleteColumnAction implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - if (paramTable.isEditing()) { - TableCellEditor cellEditor = paramTable.getCellEditor(paramTable.getEditingRow(), paramTable - .getEditingColumn()); - cellEditor.cancelCellEditing(); - } + GuiUtils.cancelEditing(paramTable); int colSelected = paramTable.getSelectedColumn(); if (colSelected == 0 || colSelected == 1) { diff --git a/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java b/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java index 79ece372556..b5fb78e6318 100644 --- a/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java +++ b/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java @@ -367,17 +367,6 @@ public void actionPerformed(ActionEvent e) { } } - /** - * Cancel cell editing if it is being edited - */ - private void cancelEditing() { - // 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(); - } - } /** * Move a row down @@ -476,7 +465,7 @@ private void showDetail() { * Remove the currently selected argument from the table. */ protected void deleteArgument() { - cancelEditing(); + GuiUtils.cancelEditing(table); int[] rowsSelected = table.getSelectedRows(); int anchorSelection = table.getSelectionModel().getAnchorSelectionIndex(); diff --git a/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java b/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java index b5f20ea2445..ca3f5c23225 100644 --- a/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java +++ b/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java @@ -279,10 +279,7 @@ protected void stopTableEditing() { 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(); - } + GuiUtils.cancelEditing(table); int rowSelected = table.getSelectedRow(); diff --git a/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java b/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java index 55a0afa907b..3e775f1aae8 100644 --- a/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java +++ b/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java @@ -376,7 +376,7 @@ public void actionPerformed(ActionEvent e) { private class UpListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - cancelEditing(); + GuiUtils.cancelEditing(table); int[] rowsSelected = table.getSelectedRows(); if (rowsSelected.length > 0 && rowsSelected[0] > 0) { @@ -394,7 +394,7 @@ public void actionPerformed(ActionEvent e) { private class DownListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - cancelEditing(); + GuiUtils.cancelEditing(table); int[] rowsSelected = table.getSelectedRows(); if (rowsSelected.length > 0 && rowsSelected[rowsSelected.length - 1] < table.getRowCount() - 1) { @@ -415,16 +415,4 @@ public void clearGui() { this.model.clearData(); } - /** - * Cancel cell editing if it is being edited - */ - private void cancelEditing() { - // 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(); - } - } - } diff --git a/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java b/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java index 78b4e2aa7e6..5807304ac26 100644 --- a/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java +++ b/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java @@ -184,7 +184,7 @@ private void init() {// called from ctor, so must not be overridable protected void deleteRows() { // If a table cell is being edited, we must cancel the editing // before deleting the row. - cancelEditing(); + GuiUtils.cancelEditing(authTable); int[] rowsSelected = authTable.getSelectedRows(); int anchorSelection = authTable.getSelectionModel().getAnchorSelectionIndex(); @@ -208,15 +208,6 @@ protected void deleteRows() { } } - /** - * If a table cell is being edited, we must cancel the editing before deleting the row - */ - private void cancelEditing() { - if (authTable.isEditing()) { - TableCellEditor cellEditor = authTable.getCellEditor(authTable.getEditingRow(), authTable.getEditingColumn()); - cellEditor.cancelCellEditing(); - } - } private void checkButtonsStatus() { // Disable DELETE if there are no rows in the table to delete. diff --git a/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java b/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java index 1139770ae83..46c0b95c4d8 100644 --- a/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java +++ b/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java @@ -150,11 +150,7 @@ public void actionPerformed(ActionEvent e) { if (tableModel.getRowCount() > 0) { // If a table cell is being edited, we must cancel the editing // before deleting the row. - if (cookieTable.isEditing()) { - TableCellEditor cellEditor = cookieTable.getCellEditor(cookieTable.getEditingRow(), - cookieTable.getEditingColumn()); - cellEditor.cancelCellEditing(); - } + GuiUtils.cancelEditing(cookieTable); int rowSelected = cookieTable.getSelectedRow(); diff --git a/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java b/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java index e318ecf47d4..52f1f510bd3 100644 --- a/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java +++ b/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java @@ -282,11 +282,7 @@ public void actionPerformed(ActionEvent e) { if (dnsServersTableModel.getRowCount() > 0) { // If a table cell is being edited, we must cancel the editing // before deleting the row. - if (dnsServersTable.isEditing()) { - TableCellEditor cellEditor = dnsServersTable.getCellEditor(dnsServersTable.getEditingRow(), - dnsServersTable.getEditingColumn()); - cellEditor.cancelCellEditing(); - } + GuiUtils.cancelEditing(dnsServersTable); int rowSelected = dnsServersTable.getSelectedRow(); diff --git a/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java b/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java index 9b4d3890d17..e77f41dc8af 100644 --- a/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java +++ b/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java @@ -249,10 +249,8 @@ public void actionPerformed(ActionEvent e) { private void runCommandOnSelectedFile(String command) { // 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(); - } + GuiUtils.cancelEditing(table); + int rowSelected = table.getSelectedRow(); if (rowSelected >= 0) { runCommandOnRow(command, rowSelected); diff --git a/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPropertiesPanel.java b/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPropertiesPanel.java index 859565b9374..953078e758c 100644 --- a/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPropertiesPanel.java +++ b/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPropertiesPanel.java @@ -136,11 +136,7 @@ public void actionPerformed(ActionEvent e) { if (tableModel.getRowCount() > 0) { // If a table cell is being edited, we must cancel the editing // before deleting the row. - if (jmsPropertiesTable.isEditing()) { - TableCellEditor cellEditor = jmsPropertiesTable.getCellEditor(jmsPropertiesTable.getEditingRow(), jmsPropertiesTable - .getEditingColumn()); - cellEditor.cancelCellEditing(); - } + GuiUtils.cancelEditing(jmsPropertiesTable); int rowSelected = jmsPropertiesTable.getSelectedRow(); diff --git a/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java b/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java index f009cdafd6d..90ad9207ca5 100644 --- a/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java +++ b/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java @@ -209,10 +209,7 @@ public void actionPerformed(ActionEvent e) { private 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(); - } + GuiUtils.cancelEditing(table); int rowSelected = table.getSelectedRow(); if (rowSelected >= 0) {