mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-01-09 05:58:00 -05:00
GP-6177 - Updated xref table delete action to not be enabled if only thunk ref types are selected
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user