mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +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
|
@Override
|
||||||
public boolean isEnabledForContext(ActionContext context) {
|
public boolean isEnabledForContext(ActionContext context) {
|
||||||
if (!(context instanceof DataTypesActionContext)) {
|
// enable this action if any node is a non-built-in data type
|
||||||
return false;
|
return context instanceof DataTypesActionContext dtac &&
|
||||||
}
|
dtac.getSelectedNodes().stream().anyMatch(node -> {
|
||||||
|
return node instanceof DataTypeNode dtNode &&
|
||||||
return hasAnyDtNodes(((DataTypesActionContext) context).getSelectedNodes());
|
!(dtNode.getDataType() instanceof BuiltInDataType);
|
||||||
}
|
});
|
||||||
|
|
||||||
private boolean hasAnyDtNodes(List<GTreeNode> nodes) {
|
|
||||||
if (nodes.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (GTreeNode node : nodes) {
|
|
||||||
if (node instanceof DataTypeNode) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAlreadyAssociated(DataTypesActionContext dtContext) {
|
private boolean isAlreadyAssociated(DataTypesActionContext dtContext) {
|
||||||
|
|
||||||
List<DataTypeNode> nodes = dtContext.getDisassociatableNodes();
|
List<DataTypeNode> nodes = dtContext.getDisassociatableNodes();
|
||||||
return !nodes.isEmpty();
|
return !nodes.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue