Merge remote-tracking branch 'origin/GP-0-dragonmacher-test-fixes-5-23-24'

This commit is contained in:
Ryan Kurtz
2024-05-24 05:56:19 -04:00
9 changed files with 20 additions and 23 deletions
@@ -37,8 +37,6 @@ import ghidra.util.exception.*;
*/ */
public class DataTypeEditorManager implements EditorListener { public class DataTypeEditorManager implements EditorListener {
public static final String EDIT_ACTION_PREFIX = "Editor: ";
private List<EditorProvider> editorList; private List<EditorProvider> editorList;
private EditorOptionManager editorOptionMgr; // manages editor tool options private EditorOptionManager editorOptionMgr; // manages editor tool options
private DataTypeManagerPlugin plugin; private DataTypeManagerPlugin plugin;
@@ -707,7 +705,7 @@ public class DataTypeEditorManager implements EditorListener {
private String name; private String name;
DtSharedActionPlaceholder(String name) { DtSharedActionPlaceholder(String name) {
this.name = EDIT_ACTION_PREFIX + name; this.name = name;
} }
@Override @Override
@@ -325,7 +325,8 @@ public class EnumEditorProvider extends ComponentProviderAdapter
showEnumAction.setToolBarData( showEnumAction.setToolBarData(
new ToolBarData(new GIcon("icon.plugin.enum.editor.home"), thirdGroup)); new ToolBarData(new GIcon("icon.plugin.enum.editor.home"), thirdGroup));
FindReferencesToEnumFieldAction findReferencesAction = new FindReferencesToEnumFieldAction(plugin); FindReferencesToEnumFieldAction findReferencesAction =
new FindReferencesToEnumFieldAction(plugin);
tool.addLocalAction(this, applyAction); tool.addLocalAction(this, applyAction);
tool.addLocalAction(this, addAction); tool.addLocalAction(this, addAction);
@@ -726,8 +727,7 @@ public class EnumEditorProvider extends ComponentProviderAdapter
private ActionListener listener; private ActionListener listener;
EnumPluginAction(String name, ActionListener listener) { EnumPluginAction(String name, ActionListener listener) {
super(DataTypeEditorManager.EDIT_ACTION_PREFIX + name, plugin.getName(), super(name, plugin.getName(), KeyBindingType.SHARED);
KeyBindingType.SHARED);
this.listener = listener; this.listener = listener;
setHelpLocation(new HelpLocation(HELP_TOPIC, name)); setHelpLocation(new HelpLocation(HELP_TOPIC, name));
} }
@@ -704,7 +704,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
assertEquals("0x2d", model.getValueAt(15, model.getLengthColumn())); assertEquals("0x2d", model.getValueAt(15, model.getLengthColumn()));
assertEquals("0x145", model.getLengthAsString()); assertEquals("0x145", model.getLengthAsString());
DockingActionIf action = getAction(plugin, "Editor: Show Numbers In Hex"); DockingActionIf action = getAction(plugin, "Show Numbers In Hex");
setToggleActionSelected((ToggleDockingActionIf) action, new DefaultActionContext(), false); setToggleActionSelected((ToggleDockingActionIf) action, new DefaultActionContext(), false);
assertEquals(false, model.isShowingNumbersInHex()); assertEquals(false, model.isShowingNumbersInHex());
@@ -345,7 +345,7 @@ public class UnionEditorProviderTest extends AbstractUnionEditorTest {
assertEquals("0x1d", model.getValueAt(15, model.getLengthColumn())); assertEquals("0x1d", model.getValueAt(15, model.getLengthColumn()));
assertEquals("0x57", model.getLengthAsString()); assertEquals("0x57", model.getLengthAsString());
DockingActionIf action = getAction(plugin, "Editor: Show Numbers In Hex"); DockingActionIf action = getAction(plugin, "Show Numbers In Hex");
setToggleActionSelected((ToggleDockingActionIf) action, new DefaultActionContext(), false); setToggleActionSelected((ToggleDockingActionIf) action, new DefaultActionContext(), false);
assertEquals(false, model.isShowingNumbersInHex()); assertEquals(false, model.isShowingNumbersInHex());
@@ -48,7 +48,6 @@ import ghidra.app.plugin.core.compositeeditor.ApplyAction;
import ghidra.app.plugin.core.datamgr.actions.*; import ghidra.app.plugin.core.datamgr.actions.*;
import ghidra.app.plugin.core.datamgr.archive.Archive; import ghidra.app.plugin.core.datamgr.archive.Archive;
import ghidra.app.plugin.core.datamgr.archive.DataTypeManagerHandler; import ghidra.app.plugin.core.datamgr.archive.DataTypeManagerHandler;
import ghidra.app.plugin.core.datamgr.editor.DataTypeEditorManager;
import ghidra.app.plugin.core.datamgr.tree.*; import ghidra.app.plugin.core.datamgr.tree.*;
import ghidra.app.plugin.core.function.AbstractEditFunctionSignatureDialog; import ghidra.app.plugin.core.function.AbstractEditFunctionSignatureDialog;
import ghidra.app.plugin.core.programtree.ProgramTreePlugin; import ghidra.app.plugin.core.programtree.ProgramTreePlugin;
@@ -777,7 +776,7 @@ public class DataTypeManagerPluginTest extends AbstractGhidraHeadedIntegrationTe
// the owner for the action is the tool, since the registered item is just a placeholder // the owner for the action is the tool, since the registered item is just a placeholder
// because the editor actions are shared actions // because the editor actions are shared actions
String owner = " (" + ToolConstants.SHARED_OWNER + ')'; String owner = " (" + ToolConstants.SHARED_OWNER + ')';
String actionName = DataTypeEditorManager.EDIT_ACTION_PREFIX + ApplyAction.ACTION_NAME; String actionName = ApplyAction.ACTION_NAME;
String optionName = actionName + owner; String optionName = actionName + owner;
ToolOptions options = tool.getOptions(DockingToolConstants.KEY_BINDINGS); ToolOptions options = tool.getOptions(DockingToolConstants.KEY_BINDINGS);
@@ -1326,15 +1326,15 @@ public class EnumEditor1Test extends AbstractGhidraHeadedIntegrationTest {
} }
private DockingActionIf getAddAction() { private DockingActionIf getAddAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Add Enum Value"); return getAction(plugin, "Add Enum Value");
} }
private DockingActionIf getApplyAction() { private DockingActionIf getApplyAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Apply Enum Changes"); return getAction(plugin, "Apply Enum Changes");
} }
private DockingActionIf getDeleteAction() { private DockingActionIf getDeleteAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Delete Enum Value"); return getAction(plugin, "Delete Enum Value");
} }
private int getRowFor(String theName) { private int getRowFor(String theName) {
@@ -545,7 +545,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
nameField.setText(newName); nameField.setText(newName);
}); });
DockingActionIf applyAction = getAction(plugin, "Editor: Apply Enum Changes"); DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
assertTrue(applyAction.isEnabled()); assertTrue(applyAction.isEnabled());
performAction(applyAction); performAction(applyAction);
@@ -566,7 +566,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
nameField.setText(newDescription); nameField.setText(newDescription);
}); });
DockingActionIf applyAction = getAction(plugin, "Editor: Apply Enum Changes"); DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
assertTrue(applyAction.isEnabled()); assertTrue(applyAction.isEnabled());
performAction(applyAction); performAction(applyAction);
@@ -900,15 +900,15 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
} }
private DockingActionIf getAddAction() { private DockingActionIf getAddAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Add Enum Value"); return getAction(plugin, "Add Enum Value");
} }
private DockingActionIf getApplyAction() { private DockingActionIf getApplyAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Apply Enum Changes"); return getAction(plugin, "Apply Enum Changes");
} }
private DockingActionIf getDeleteAction() { private DockingActionIf getDeleteAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Delete Enum Value"); return getAction(plugin, "Delete Enum Value");
} }
private Enum editSampleEnum() { private Enum editSampleEnum() {
@@ -184,8 +184,8 @@ public class DataTypeEditorsScreenShots extends GhidraScreenShotGenerator {
int numRows = table.getRowCount(); int numRows = table.getRowCount();
selectRow(table, numRows - 2); selectRow(table, numRows - 2);
performAction("Editor: Duplicate Multiple of Component", "DataTypeManagerPlugin", performAction("Duplicate Multiple of Component", "DataTypeManagerPlugin", structureEditor,
structureEditor, false); false);
waitForSwing(); waitForSwing();
captureDialog(); captureDialog();
@@ -209,7 +209,7 @@ public class DataTypeEditorsScreenShots extends GhidraScreenShotGenerator {
int numRows = table.getRowCount(); int numRows = table.getRowCount();
selectRow(table, numRows - 2); selectRow(table, numRows - 2);
performAction("Editor: Create Array", "DataTypeManagerPlugin", structureEditor, false); performAction("Create Array", "DataTypeManagerPlugin", structureEditor, false);
waitForSwing(); waitForSwing();
captureDialog(); captureDialog();
@@ -267,7 +267,7 @@ public class DataTypeEditorsScreenShots extends GhidraScreenShotGenerator {
JTable table = editorPanel.getTable(); JTable table = editorPanel.getTable();
selectRow(table, 4); // select byte:3 bitfield selectRow(table, 4); // select byte:3 bitfield
performAction("Editor: Edit Bitfield", "DataTypeManagerPlugin", structureEditor, false); performAction("Edit Bitfield", "DataTypeManagerPlugin", structureEditor, false);
waitForSwing(); waitForSwing();
captureDialog(); captureDialog();
@@ -73,7 +73,7 @@ public class StackEditorScreenShots extends GhidraScreenShotGenerator {
selectTableRow(table, "param_3"); selectTableRow(table, "param_3");
waitForSwing(); waitForSwing();
performAction("Editor: Create Array", "StackEditorManagerPlugin", stackEditor, false); performAction("Create Array", "StackEditorManagerPlugin", stackEditor, false);
waitForSwing(); waitForSwing();
captureDialog(); captureDialog();