Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonmacher committed May 23, 2024
1 parent 1bf26ac commit d7ff30f
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
*/
public class DataTypeEditorManager implements EditorListener {

public static final String EDIT_ACTION_PREFIX = "Editor: ";

private List<EditorProvider> editorList;
private EditorOptionManager editorOptionMgr; // manages editor tool options
private DataTypeManagerPlugin plugin;
Expand Down Expand Up @@ -707,7 +705,7 @@ private class DtSharedActionPlaceholder implements SharedDockingActionPlaceholde
private String name;

DtSharedActionPlaceholder(String name) {
this.name = EDIT_ACTION_PREFIX + name;
this.name = name;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ private void createActions() {
showEnumAction.setToolBarData(
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, addAction);
Expand Down Expand Up @@ -726,8 +727,7 @@ private class EnumPluginAction extends DockingAction {
private ActionListener listener;

EnumPluginAction(String name, ActionListener listener) {
super(DataTypeEditorManager.EDIT_ACTION_PREFIX + name, plugin.getName(),
KeyBindingType.SHARED);
super(name, plugin.getName(), KeyBindingType.SHARED);
this.listener = listener;
setHelpLocation(new HelpLocation(HELP_TOPIC, name));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ public void testToggleHexModeAction() throws Exception {
assertEquals("0x2d", model.getValueAt(15, model.getLengthColumn()));
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);

assertEquals(false, model.isShowingNumbersInHex());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public void testToggleHexModeAction() throws Exception {
assertEquals("0x1d", model.getValueAt(15, model.getLengthColumn()));
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);

assertEquals(false, model.isShowingNumbersInHex());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import ghidra.app.plugin.core.datamgr.actions.*;
import ghidra.app.plugin.core.datamgr.archive.Archive;
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.function.AbstractEditFunctionSignatureDialog;
import ghidra.app.plugin.core.programtree.ProgramTreePlugin;
Expand Down Expand Up @@ -777,7 +776,7 @@ public void testEditorActionsGetRegisteredWithoutEditing() {
// the owner for the action is the tool, since the registered item is just a placeholder
// because the editor actions are shared actions
String owner = " (" + ToolConstants.SHARED_OWNER + ')';
String actionName = DataTypeEditorManager.EDIT_ACTION_PREFIX + ApplyAction.ACTION_NAME;
String actionName = ApplyAction.ACTION_NAME;
String optionName = actionName + owner;
ToolOptions options = tool.getOptions(DockingToolConstants.KEY_BINDINGS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1326,15 +1326,15 @@ private void addEnumValue() {
}

private DockingActionIf getAddAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Add Enum Value");
return getAction(plugin, "Add Enum Value");
}

private DockingActionIf getApplyAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Apply Enum Changes");
return getAction(plugin, "Apply Enum Changes");
}

private DockingActionIf getDeleteAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Delete Enum Value");
return getAction(plugin, "Delete Enum Value");
}

private int getRowFor(String theName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ public void testNameTrim() throws Exception {
nameField.setText(newName);
});

DockingActionIf applyAction = getAction(plugin, "Editor: Apply Enum Changes");
DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
assertTrue(applyAction.isEnabled());

performAction(applyAction);
Expand All @@ -566,7 +566,7 @@ public void testDescriptionTrim() throws Exception {
nameField.setText(newDescription);
});

DockingActionIf applyAction = getAction(plugin, "Editor: Apply Enum Changes");
DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
assertTrue(applyAction.isEnabled());

performAction(applyAction);
Expand Down Expand Up @@ -900,15 +900,15 @@ private String findLabelText(Container container, String name) {
}

private DockingActionIf getAddAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Add Enum Value");
return getAction(plugin, "Add Enum Value");
}

private DockingActionIf getApplyAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Apply Enum Changes");
return getAction(plugin, "Apply Enum Changes");
}

private DockingActionIf getDeleteAction() {
return getAction(plugin, DataTypeEditorManager.EDIT_ACTION_PREFIX + "Delete Enum Value");
return getAction(plugin, "Delete Enum Value");
}

private Enum editSampleEnum() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ public void testNumDuplicates() {
int numRows = table.getRowCount();
selectRow(table, numRows - 2);

performAction("Editor: Duplicate Multiple of Component", "DataTypeManagerPlugin",
structureEditor, false);
performAction("Duplicate Multiple of Component", "DataTypeManagerPlugin", structureEditor,
false);
waitForSwing();

captureDialog();
Expand All @@ -209,7 +209,7 @@ public void testNumElementsPrompt() {
int numRows = table.getRowCount();
selectRow(table, numRows - 2);

performAction("Editor: Create Array", "DataTypeManagerPlugin", structureEditor, false);
performAction("Create Array", "DataTypeManagerPlugin", structureEditor, false);
waitForSwing();

captureDialog();
Expand Down Expand Up @@ -267,7 +267,7 @@ public void testStructureEditBitfield() {
JTable table = editorPanel.getTable();
selectRow(table, 4); // select byte:3 bitfield

performAction("Editor: Edit Bitfield", "DataTypeManagerPlugin", structureEditor, false);
performAction("Edit Bitfield", "DataTypeManagerPlugin", structureEditor, false);
waitForSwing();

captureDialog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void testNumElementsPrompt() {
selectTableRow(table, "param_3");
waitForSwing();

performAction("Editor: Create Array", "StackEditorManagerPlugin", stackEditor, false);
performAction("Create Array", "StackEditorManagerPlugin", stackEditor, false);
waitForSwing();
captureDialog();

Expand Down

0 comments on commit d7ff30f

Please sign in to comment.