Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-497 - Deprecated broken method on ListSelectionTableDialog

dragonmachera33e2948576c
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/plugins/importer/batch/BatchImportDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/plugins/importer/batch/BatchImportDialog.java
index 6b3f70cb53..09bc90d02a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/plugins/importer/batch/BatchImportDialog.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/plugins/importer/batch/BatchImportDialog.java
@@ -349,9 +349,8 @@ public class BatchImportDialog extends DialogComponentProvider {
ListSelectionTableDialog<String> dialog =
new ListSelectionTableDialog<>("Application Files", names);
- dialog.setMultiSelectionMode(true);
dialog.hideOkButton();
- dialog.show(table);
+ dialog.showSelectMultiple(table);
}
private void setOpenAfterImporting(boolean b) {
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/ListSelectionTableDialog.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/ListSelectionTableDialog.java
index df92360ee2..b3e99b791e 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/ListSelectionTableDialog.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/ListSelectionTableDialog.java
@@ -118,24 +118,44 @@ public class ListSelectionTableDialog<T> extends DialogComponentProvider {
}
public T show(Component parent) {
- setMultiSelectionMode(false);
+ setSelectionMode(false);
DockingWindowManager.showDialog(parent, this);
return getSelectedItem();
}
public List<T> showSelectMultiple(Component parent) {
- setMultiSelectionMode(true);
+ setSelectionMode(true);
DockingWindowManager.showDialog(parent, this);
return getSelectedItems();
}
+ /**
+ * Calling this method does does not work correctly when used with
+ * {@link #show(Component)} or {@link #showSelectMultiple(Component)}. To use this method, you
+ * must show the dialog by calling:
+ * <pre>
+ * DockingWindowManager.showDialog(parent, dialog);
+ * </pre>
+ *
+ * <P>There is no need to use this method when using either of the aforementioned
+ * {@code show} methods
+ *
+ * @param enable true to allow multiple selection
+ *
+ * @deprecated to be removed sometime after the 9.3 release
+ */
+ @Deprecated
public void setMultiSelectionMode(boolean enable) {
- if (enable) {
- gTable.getSelectionModel()
- .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+ setSelectionMode(enable);
+ }
+
+ private void setSelectionMode(boolean allowMultipleSelections) {
+ ListSelectionModel selectionModel = gTable.getSelectionModel();
+ if (allowMultipleSelections) {
+ selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
}
else {
- gTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
}