GP-1 Disable replace action for BadDataType

This commit is contained in:
ghidra1 2025-07-09 19:10:22 -04:00
parent f250cfeac4
commit 3f638e22b4

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -67,10 +67,18 @@ public class ReplaceDataTypeAction extends DockingAction {
return false; return false;
} }
if (!(node instanceof DataTypeNode)) { if (!(node instanceof DataTypeNode dtNode)) {
return false; return false;
} }
return node.isModifiable(); if (!dtNode.isModifiable()) {
return false;
}
if (dtNode.getDataType() instanceof BadDataType) {
// Although BAD datatype should not appear in tree, if it does replace is
// not supported. Delete should be used instead.
return false;
}
return true;
} }
private DataTypeTreeNode getSelectedDataTypeTreeNode(ActionContext context) { private DataTypeTreeNode getSelectedDataTypeTreeNode(ActionContext context) {