mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-12-13 06:33:02 +00:00
Fixed the structure editor sometimes losing focus when editing data
types
This commit is contained in:
parent
179f093aca
commit
c7b4c69720
@ -186,6 +186,7 @@ public abstract class CompositeEditorPanel extends JPanel
|
||||
if (editingRow < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int modelColumn = table.convertColumnIndexToModel(table.getEditingColumn());
|
||||
if (!launchBitFieldEditor(modelColumn, editingRow)) {
|
||||
model.beginEditingField(editingRow, modelColumn);
|
||||
@ -1332,7 +1333,7 @@ public abstract class CompositeEditorPanel extends JPanel
|
||||
|
||||
@Override
|
||||
public void focusEditor() {
|
||||
boolean didFocus = textField.requestFocusInWindow();
|
||||
textField.requestFocusInWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,7 @@ import java.awt.event.ActionListener;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.action.*;
|
||||
import docking.widgets.table.GTable;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.util.HelpLocation;
|
||||
@ -79,7 +80,13 @@ abstract public class CompositeEditorTableAction extends DockingAction implement
|
||||
if (provider == null) {
|
||||
return; // must have been disposed
|
||||
}
|
||||
|
||||
JTable table = ((CompositeEditorPanel) provider.getComponent()).getTable();
|
||||
if (table instanceof GTable gTable) {
|
||||
gTable.requestTableFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (table.isEditing()) {
|
||||
table.getEditorComponent().requestFocus();
|
||||
}
|
||||
|
@ -940,22 +940,26 @@ public class GTable extends JTable {
|
||||
public boolean editCellAt(int row, int column, EventObject e) {
|
||||
boolean editAtCell = super.editCellAt(row, column, e);
|
||||
if (editAtCell) {
|
||||
TableCellEditor currentEditor = getCellEditor();
|
||||
Component editorComponent = getEditorComponent();
|
||||
if (currentEditor instanceof FocusableEditor focusable) {
|
||||
focusable.focusEditor();
|
||||
}
|
||||
else {
|
||||
editorComponent.requestFocusInWindow();
|
||||
}
|
||||
|
||||
if (editorComponent instanceof JTextComponent textComponent) {
|
||||
textComponent.selectAll();
|
||||
}
|
||||
requestTableFocus();
|
||||
}
|
||||
return editAtCell;
|
||||
}
|
||||
|
||||
public void requestTableFocus() {
|
||||
TableCellEditor currentEditor = getCellEditor();
|
||||
Component editorComponent = getEditorComponent();
|
||||
if (currentEditor instanceof FocusableEditor focusable) {
|
||||
focusable.focusEditor();
|
||||
}
|
||||
else {
|
||||
editorComponent.requestFocusInWindow();
|
||||
}
|
||||
|
||||
if (editorComponent instanceof JTextComponent textComponent) {
|
||||
textComponent.selectAll();
|
||||
}
|
||||
}
|
||||
|
||||
public void scrollToSelectedRow() {
|
||||
int[] selectedRows = getSelectedRows();
|
||||
if (selectedRows == null || selectedRows.length == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user