GP-6177 - Updated xref table delete action to not be enabled if only thunk ref types are selected

This commit is contained in:
dragonmacher
2025-12-03 11:59:40 -05:00
parent c8e919b33b
commit eb8694d692
2 changed files with 28 additions and 2 deletions

View File

@@ -170,6 +170,13 @@
from the <A HREF="help/topics/Search/Query_Results_Dialog.htm#Remove_Items">Remove Items
</A> action, which will simply remove items from the table.
</P>
<BLOCKQUOTE>
<P><IMG border="0" src="help/shared/tip.png" alt="">If the <CODE>RefType</CODE> is
<CODE>THUNK</CODE>, then that reference cannot be deleted. However, it may be
<I>removed</I> from the table.</P>
</BLOCKQUOTE>
</BLOCKQUOTE>
</BLOCKQUOTE>

View File

@@ -355,7 +355,21 @@ public class XReferenceUtils {
if (tableModel.isBusy()) {
return false;
}
return table.getSelectedRowCount() > 0;
return hasNonThunkRefs(table);
}
private boolean hasNonThunkRefs(JTable table) {
int[] rows = table.getSelectedRows();
for (int row : rows) {
ReferenceEndpoint rowObject = tableModel.getRowObject(row);
Reference ref = rowObject.getReference();
RefType type = ref.getReferenceType();
if (type != RefType.THUNK) {
return true;
}
}
return false;
}
@Override
@@ -391,8 +405,13 @@ public class XReferenceUtils {
CompoundCmd<Program> compoundCmd = new CompoundCmd<>("Delete References");
for (int row : rows) {
ReferenceEndpoint endpoint = tableModel.getRowObject(row);
deletedRowObjects.add(endpoint);
Reference ref = endpoint.getReference();
RefType type = ref.getReferenceType();
if (type == RefType.THUNK) {
continue; // we cannot delete THUNK types, as they are not real references
}
deletedRowObjects.add(endpoint);
RemoveReferenceCmd cmd = new RemoveReferenceCmd(ref);
compoundCmd.add(cmd);
}