Skip to content

Commit

Permalink
Merge remote-tracking branch
Browse files Browse the repository at this point in the history
'origin/GP-3223_ghidra_LaunchFunctionDefEditFromCompositeEditor' into
patch (#4541)
  • Loading branch information
ryanmkurtz committed May 22, 2023
2 parents 69549f5 + a52d224 commit dd85623
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,8 @@ public boolean isEditComponentAllowed() {
}
return ((baseDt != null) && !(baseDt instanceof BuiltInDataType) &&
!(baseDt instanceof MissingBuiltInDataType) &&
((baseDt instanceof Structure) || baseDt instanceof Union || baseDt instanceof Enum));
((baseDt instanceof Structure) || (baseDt instanceof Union) ||
(baseDt instanceof Enum) || (baseDt instanceof FunctionDefinition)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import ghidra.app.plugin.core.datamgr.util.DataTypeUtils;
import ghidra.app.services.DataTypeManagerService;
import ghidra.program.model.data.*;
import ghidra.program.model.data.Enum;

/**
* Action for use in the composite data type editor.
Expand Down Expand Up @@ -49,17 +48,15 @@ public void actionPerformed(ActionContext context) {
return;
}

if (!model.isEditComponentAllowed()) {
model.setStatus("Can only edit a structure, union, enum or function-definition.");
return;
}

DataTypeComponent comp = model.getComponent(row);
DataType clickedType = comp.getDataType();
DataType dt = DataTypeUtils.getBaseDataType(clickedType);
boolean isEditableType =
(dt instanceof Structure) || (dt instanceof Union) || (dt instanceof Enum);
if (isEditableType) {
edit(dt, clickedType.getName());
}
else {
model.setStatus("Can only edit a structure, union or enum.");
}
edit(dt, clickedType.getName());
requestTableFocus();
}

Expand Down

0 comments on commit dd85623

Please sign in to comment.