Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
13 changes: 1 addition & 12 deletions src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 1 addition & 4 deletions src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
16 changes: 2 additions & 14 deletions src/core/org/apache/jmeter/testbeans/gui/TableEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down