From f7ceaece064544ed606a2aac8e0f21722462a0cd Mon Sep 17 00:00:00 2001 From: dragonmacher <48328597+dragonmacher@users.noreply.github.com> Date: Tue, 21 Mar 2023 08:05:10 -0400 Subject: [PATCH] Test fixes --- .../compositeeditor/CompositeEditorTableAction.java | 10 +++++----- .../src/main/java/docking/widgets/table/GTable.java | 8 ++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorTableAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorTableAction.java index 764cdfb255..1dae09453b 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorTableAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorTableAction.java @@ -82,16 +82,16 @@ abstract public class CompositeEditorTableAction extends DockingAction implement } JTable table = ((CompositeEditorPanel) provider.getComponent()).getTable(); - if (table instanceof GTable gTable) { - gTable.requestTableFocus(); + if (!table.isEditing()) { + table.requestFocus(); return; } - if (table.isEditing()) { - table.getEditorComponent().requestFocus(); + if (table instanceof GTable gTable) { + gTable.requestTableEditorFocus(); } else { - table.requestFocus(); + table.getEditorComponent().requestFocus(); } } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/GTable.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/GTable.java index 6d9e05640c..9b8c40374e 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/GTable.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/GTable.java @@ -940,14 +940,18 @@ public class GTable extends JTable { public boolean editCellAt(int row, int column, EventObject e) { boolean editAtCell = super.editCellAt(row, column, e); if (editAtCell) { - requestTableFocus(); + requestTableEditorFocus(); } return editAtCell; } - public void requestTableFocus() { + public void requestTableEditorFocus() { TableCellEditor currentEditor = getCellEditor(); Component editorComponent = getEditorComponent(); + if (editorComponent == null) { + return; // not editing + } + if (currentEditor instanceof FocusableEditor focusable) { focusable.focusEditor(); }