mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GP-5110 don't enable "Associate With Archive" action if built-in dt
This commit is contained in:
parent
0ea368f36d
commit
c621406c5f
1 changed files with 6 additions and 18 deletions
|
@ -62,27 +62,15 @@ public class AssociateDataTypeAction extends DockingAction {
|
|||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
if (!(context instanceof DataTypesActionContext)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return hasAnyDtNodes(((DataTypesActionContext) context).getSelectedNodes());
|
||||
}
|
||||
|
||||
private boolean hasAnyDtNodes(List<GTreeNode> nodes) {
|
||||
if (nodes.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (GTreeNode node : nodes) {
|
||||
if (node instanceof DataTypeNode) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
// enable this action if any node is a non-built-in data type
|
||||
return context instanceof DataTypesActionContext dtac &&
|
||||
dtac.getSelectedNodes().stream().anyMatch(node -> {
|
||||
return node instanceof DataTypeNode dtNode &&
|
||||
!(dtNode.getDataType() instanceof BuiltInDataType);
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isAlreadyAssociated(DataTypesActionContext dtContext) {
|
||||
|
||||
List<DataTypeNode> nodes = dtContext.getDisassociatableNodes();
|
||||
return !nodes.isEmpty();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue