Package ghidra.formats.gfilesystem
Class SelectFromListDialog<T>
- java.lang.Object
-
- docking.DialogComponentProvider
-
- ghidra.formats.gfilesystem.SelectFromListDialog<T>
-
- Type Parameters:
T
- opaque object type that will be selected by the user.
- All Implemented Interfaces:
ActionContextProvider
,StatusListener
,TaskListener
public class SelectFromListDialog<T> extends DialogComponentProvider
Dialog that presents the user with a list of strings and returns the object associated with the user-picked element.
-
-
Field Summary
-
Fields inherited from class docking.DialogComponentProvider
applyButton, buttonPanel, cancelButton, dismissButton, okButton, rootPanel
-
-
Constructor Summary
Constructors Constructor Description SelectFromListDialog(java.lang.String title, java.lang.String prompt, java.util.List<T> list, java.util.function.Function<T,java.lang.String> toStringFunc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getSelectedObject()
protected void
okCallback()
The callback method for when the "OK" button is pressed.static <T> T
selectFromList(java.util.List<T> list, java.lang.String title, java.lang.String prompt, java.util.function.Function<T,java.lang.String> toStringFunc)
Modally shows the user a dialog with a list of strings, and returns the picked object.-
Methods inherited from class docking.DialogComponentProvider
addAction, addApplyButton, addButton, addCancelButton, addDismissButton, addOKButton, addWorkPanel, alertMessage, alertMessage, applyCallback, cancelCallback, cancelCurrentTask, clearScheduledTask, clearStatusText, close, dialogClosed, dialogShown, dismissCallback, dispose, doInitialize, escapeCallback, executeProgressTask, getActionContext, getActions, getBackground, getBounds, getComponent, getDefaultButton, getDefaultSize, getDialogSize, getFocusComponent, getGlassPane, getHelpLocatdion, getId, getIntialLocation, getLocationOnScreen, getParent, getPreferredSize, getRemberSize, getRememberLocation, getStatusColor, getStatusLabel, getStatusText, getTaskMonitorComponent, getTaskScheduler, getTitle, getUseSharedLocation, hideTaskMonitorComponent, isApplyEnabled, isCancelEnabled, isModal, isOKEnabled, isResizeable, isRunningTask, isShowing, isTransient, isVisible, notifyContextChanged, removeAction, removeButton, removeWorkPanel, repack, setApplyEnabled, setApplyToolTip, setBackground, setCancelButtonText, setCancelEnabled, setCancelToolTip, setCursor, setDefaultButton, setDefaultSize, setDialogSize, setDismissToolTip, setFocusComponent, setGlassPane, setHelpLocation, setInitialLocation, setMinimumSize, setMinimumSize, setOkButtonText, setOkEnabled, setOkToolTip, setPreferredSize, setRememberLocation, setRememberSize, setResizable, setStatusJustification, setStatusText, setStatusText, setStatusText, setTitle, setTransient, setUseSharedLocation, showProgressBar, showTaskMonitorComponent, stopProgressTimer, taskCancelled, taskCompleted, toFront, toString, waitForCurrentTask
-
-
-
-
Method Detail
-
selectFromList
public static <T> T selectFromList(java.util.List<T> list, java.lang.String title, java.lang.String prompt, java.util.function.Function<T,java.lang.String> toStringFunc)
Modally shows the user a dialog with a list of strings, and returns the picked object.(automatically switches to Swing thread)
- Parameters:
list
- list of object of type Ttitle
- title of dialogprompt
- prompt shown above listtoStringFunc
- func that converts a T into a String.- Returns:
- the chosen T object, or null if dialog canceled.
-
okCallback
protected void okCallback()
Description copied from class:DialogComponentProvider
The callback method for when the "OK" button is pressed.- Overrides:
okCallback
in classDialogComponentProvider
-
getSelectedObject
public T getSelectedObject()
-
-