Skip to content

Commit

Permalink
GP-3736 - Fixed Data Type Manager action state not matching the view
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonmacher committed Jun 7, 2024
1 parent 85b3d76 commit 071338c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,9 @@ private void createLocalActions() {
addLocalAction(previousAction);
nextAction = new NextPreviousDataTypeAction(this, plugin.getName(), true);
addLocalAction(nextAction);
filterArraysAction = getFilterArraysAction();
addLocalAction(filterArraysAction);
filterPointersAction = getFilterPointersAction();
addLocalAction(filterPointersAction);
conflictHandlerModesAction = getConflictHandlerModesAction();
addLocalAction(conflictHandlerModesAction);
addLocalAction(getFilterArraysAction());
addLocalAction(getFilterPointersAction());
addLocalAction(getConflictHandlerModesAction());

// toolbar menu
addLocalAction(new OpenArchiveAction(plugin));
Expand Down Expand Up @@ -318,6 +315,7 @@ public boolean isFilteringArrays() {
private ToggleDockingAction getFilterPointersAction() {
if (filterPointersAction == null) {
filterPointersAction = new FilterPointersAction(plugin);
archiveGTree.enablePointerFilter(filterPointersAction.isSelected());
}

return filterPointersAction;
Expand All @@ -326,6 +324,7 @@ private ToggleDockingAction getFilterPointersAction() {
private ToggleDockingAction getFilterArraysAction() {
if (filterArraysAction == null) {
filterArraysAction = new FilterArraysAction(plugin);
archiveGTree.enableArrayFilter(filterArraysAction.isSelected());
}

return filterArraysAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,11 @@
import ghidra.program.model.data.DataTypeConflictHandler.ConflictResolutionPolicy;
import ghidra.util.HelpLocation;

public class ConflictHandlerModesAction extends
MultiStateDockingAction<DataTypeConflictHandler.ConflictResolutionPolicy> {

// private final DataTypeManagerPlugin plugin;
public class ConflictHandlerModesAction
extends MultiStateDockingAction<DataTypeConflictHandler.ConflictResolutionPolicy> {

public ConflictHandlerModesAction(DataTypeManagerPlugin plugin) {
super("Data Type Conflict Resolution Mode", plugin.getName());
// this.plugin = plugin;

setGroup("conflicts");

Expand All @@ -49,27 +46,22 @@ public ConflictHandlerModesAction(DataTypeManagerPlugin plugin) {
//@formatter:on

ActionState<DataTypeConflictHandler.ConflictResolutionPolicy> renameAndAddState =
new ActionState<>(
"Rename New or Moved Data Type", renameAndAddIcon,
new ActionState<>("Rename New or Moved Data Type", renameAndAddIcon,
DataTypeConflictHandler.ConflictResolutionPolicy.RENAME_AND_ADD);
renameAndAddState.setHelpLocation(conflictModesHelpLocation);

ActionState<DataTypeConflictHandler.ConflictResolutionPolicy> useExistingState =
new ActionState<>(
"Use Existing Data Type", useExistingIcon,
new ActionState<>("Use Existing Data Type", useExistingIcon,
DataTypeConflictHandler.ConflictResolutionPolicy.USE_EXISTING);
useExistingState.setHelpLocation(conflictModesHelpLocation);

ActionState<DataTypeConflictHandler.ConflictResolutionPolicy> replaceExistingState =
new ActionState<>(
"Replace Existing Data Type", replaceExistingIcon,
new ActionState<>("Replace Existing Data Type", replaceExistingIcon,
DataTypeConflictHandler.ConflictResolutionPolicy.REPLACE_EXISTING);
replaceExistingState.setHelpLocation(conflictModesHelpLocation);

ActionState<DataTypeConflictHandler.ConflictResolutionPolicy> replaceDefaultState =
new ActionState<>(
"Replace Empty Structures else Rename",
replaceDefaultIcon,
new ActionState<>("Replace Empty Structures else Rename", replaceDefaultIcon,
DataTypeConflictHandler.ConflictResolutionPolicy.REPLACE_EMPTY_STRUCTS_OR_RENAME_AND_ADD);
replaceDefaultState.setHelpLocation(conflictModesHelpLocation);

Expand All @@ -86,7 +78,7 @@ public ConflictHandlerModesAction(DataTypeManagerPlugin plugin) {
@Override
public void actionStateChanged(ActionState<ConflictResolutionPolicy> newActionState,
EventTrigger trigger) {
// action tracks its own state
// nothing to do; the action state is queried as needed by the client
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ public void treeExpanded(TreeExpansionEvent event) {
}

private class DataTypeTreeRenderer extends GTreeRenderer {
private static final int ICON_WIDTH = 24;
private static final int ICON_HEIGHT = 18;

@Override
Expand Down

0 comments on commit 071338c

Please sign in to comment.