Skip to content

Commit d430254

Browse files
dragonmacherghidra1
authored andcommitted
GP-676 - Tweak to the TableChooserDialog API to always use a transaction
1 parent f4a4cd0 commit d430254

File tree

5 files changed

+4
-51
lines changed

5 files changed

+4
-51
lines changed

Ghidra/Features/Base/ghidra_scripts/FindSharedReturnFunctionsScript.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,6 @@ public String getButtonName() {
152152
return "Fixup SharedReturn";
153153
}
154154

155-
@Override
156-
public boolean useBulkTransaction() {
157-
return true;
158-
}
159-
160155
@Override
161156
public boolean execute(AddressableRowObject rowObject) {
162157
SharedReturnLocations sharedRetLoc = (SharedReturnLocations) rowObject;

Ghidra/Features/Base/ghidra_scripts/FixupNoReturnFunctionsScript.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,6 @@ public String getButtonName() {
271271
return "Fixup NoReturn";
272272
}
273273

274-
@Override
275-
public boolean useBulkTransaction() {
276-
return true;
277-
}
278-
279274
@Override
280275
public boolean execute(AddressableRowObject rowObject) {
281276
NoReturnLocations noRetLoc = (NoReturnLocations) rowObject;

Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserDialog.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,7 @@ private void doExecute(List<AddressableRowObject> rowObjects, TaskMonitor monito
242242
monitor.initialize(rowObjects.size());
243243

244244
try {
245-
List<AddressableRowObject> deleted;
246-
if (executor.useBulkTransaction()) {
247-
deleted = doProcessRowsInTransaction(rowObjects, monitor);
248-
}
249-
else {
250-
deleted = doProcessRows(rowObjects, monitor);
251-
}
245+
List<AddressableRowObject> deleted = doProcessRowsInTransaction(rowObjects, monitor);
252246

253247
for (AddressableRowObject rowObject : deleted) {
254248
model.removeObject(rowObject);

Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserExecutor.java

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
* The interface clients must implement to use the {@link TableChooserDialog}. This class is the
2020
* callback that is used to process items from the dialog's table as users select one or more
2121
* rows in the table and then press the table's "apply" button.
22-
*
23-
* <P>See the notes on {@link #useBulkTransaction()}. We recommend you override that method to
24-
* return true.
2522
*/
2623
public interface TableChooserExecutor {
2724

@@ -37,34 +34,11 @@ public interface TableChooserExecutor {
3734
* Applies this executors action to the given rowObject. Return true if the given object
3835
* should be removed from the table.
3936
*
37+
* <P>This method call will be wrapped in a transaction so the client does not have to do so.
38+
* Multiple selected rows will all be processed in a single transaction.
39+
*
4040
* @param rowObject the AddressRowObject to be executed upon
4141
* @return true if the rowObject should be removed from the table, false otherwise
4242
*/
4343
public boolean execute(AddressableRowObject rowObject);
44-
45-
/**
46-
* When true, the calls to {@link #execute(AddressableRowObject)} will be wrapped in a
47-
* transaction. This allows clients to not use transactions themselves. This can increase
48-
* performance when the user selects a large number of rows in the table to be executed, as
49-
* this API will only use on transaction for all rows, instead of one per row.
50-
*
51-
* <P>When true, this will use one transaction per button press of the
52-
* {@link TableChooserDialog}. Thus, if the user only processes a single row per button
53-
* press, then there is no performance gain over the traditional use of transactions.
54-
*
55-
* <P><B>We recommend clients override this method to return true</B>.
56-
*
57-
* <P>Note: when false is returned from this method, <b>no transaction is created before the
58-
* call to {@link #execute(AddressableRowObject)}</b>--the client is responsible for
59-
* transaction management in this case.
60-
*
61-
* <P>For backward compatibility, this method defaults to returning false. You must override
62-
* this method to return true in your code to make use of the single bulk transaction.
63-
*
64-
* @return true to use bulk transactions; false to use no transaction at all when calling
65-
* {@link #execute(AddressableRowObject)}; default is false
66-
*/
67-
public default boolean useBulkTransaction() {
68-
return false; // false by default for backward compatibility
69-
}
7044
}

Ghidra/Features/Decompiler/ghidra_scripts/ShowConstantUse.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,6 @@ public String getButtonName() {
311311
return "Create Structure";
312312
}
313313

314-
@Override
315-
public boolean useBulkTransaction() {
316-
return true;
317-
}
318-
319314
@Override
320315
public boolean execute(AddressableRowObject rowObject) {
321316
ConstUseLocation constLoc = (ConstUseLocation) rowObject;

0 commit comments

Comments
 (0)