Package ghidra.framework.main
Class DataTreeDialog
java.lang.Object
docking.DialogComponentProvider
ghidra.framework.main.DataTreeDialog
- All Implemented Interfaces:
ActionContextProvider,GTreeSelectionListener,StatusListener,TaskListener,ActionListener,EventListener
- Direct Known Subclasses:
OpenVersionedFileDialog
public class DataTreeDialog
extends DialogComponentProvider
implements GTreeSelectionListener, ActionListener
Dialog to open or save domain data items to a new location or name.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDialog type for choosing a user folder.static final intDialog type for creating domain data files.protected static final intstatic final intDialog type for opening domain data files.static final intDialog type for saving domain data files.protected ProjectDataTreePanelprotected static final intFields inherited from class docking.DialogComponentProvider
applyButton, buttonPanel, cancelButton, dismissButton, okButton, rootPanel -
Constructor Summary
ConstructorsConstructorDescriptionDataTreeDialog(Component parent, String title, int type) Construct a new DataTreeDialog for the active project.DataTreeDialog(Component parent, String title, int type, DomainFileFilter filter) Construct a new DataTreeDialog for the active project.DataTreeDialog(Component parent, String title, int type, DomainFileFilter filter, Project project) Construct a new DataTreeDialog for the given project. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) voidAdd action listener that is called when the OK button is hit.protected voidprotected JPanelprotected voidThe callback method for when the "Cancel" button is pressed.voidclose()protected voidOverride this method if you want to do something when the dialog is made visiblevoidgetActionContext(MouseEvent event) An optional extension point for subclasses to provider action context for the actions used by this provider.Get the selected domain file.Get the selected folder.protected voidThe callback method for when the "OK" button is pressed.voidselectDomainFile(DomainFile file) Select the node that corresponds to the given domain file.voidselectFolder(DomainFolder folder) Select a folder in the tree.voidSelect the root folder in the tree.voidsetNameText(String name) voidsetSearchText(String string) voidsetSelectedFolder(DomainFolder folder) Sets a domain folder as the initially selected folder when the dialog is first shown.voidsetTreeSelectionMode(int mode) voidshow()voidShows this dialog.voidTreeSelectionListener method that is called whenever the value of the selection changes.booleanMethods inherited from class docking.DialogComponentProvider
addAction, addApplyButton, addButton, addCancelButton, addDismissButton, addOKButton, addWorkPanel, alertMessage, alertMessage, applyCallback, cancelCurrentTask, clearScheduledTask, clearStatusText, closeDialog, dialogClosed, dismissCallback, dispose, doInitialize, escapeCallback, executeProgressTask, getActions, getBackground, getBounds, getComponent, getDefaultButton, getDefaultSize, getDialogSize, getFocusComponent, getGlassPane, getHelpLocation, getId, getInitialLocation, getLocationOnScreen, getParent, getPreferredSize, getRememberLocation, getRememberSize, 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
-
Field Details
-
OPEN
public static final int OPENDialog type for opening domain data files.- See Also:
-
SAVE
public static final int SAVEDialog type for saving domain data files.- See Also:
-
CHOOSE_FOLDER
public static final int CHOOSE_FOLDERDialog type for choosing a user folder.- See Also:
-
CREATE
public static final int CREATEDialog type for creating domain data files.- See Also:
-
WIDTH
protected static final int WIDTH- See Also:
-
HEIGHT
protected static final int HEIGHT- See Also:
-
treePanel
-
-
Constructor Details
-
DataTreeDialog
Construct a new DataTreeDialog for the active project. This chooser will show all project files. Following linked-folders will only be allowed if a type ofCHOOSE_FOLDERorOPENis specified. If different behavior is required a filter should be specified using the other constructor.- Parameters:
parent- dialog's parenttitle- title to usetype- specify OPEN, SAVE, CHOOSE_FOLDER, CHOOSE_USER_FOLDER, or CREATE- Throws:
IllegalArgumentException- if invalid type is specified
-
DataTreeDialog
Construct a new DataTreeDialog for the active project.- Parameters:
parent- dialog's parenttitle- title to usetype- specify OPEN, SAVE, CHOOSE_FOLDER, or CHOOSE_USER_FOLDERfilter- filter used to control what is displayed in the data tree- Throws:
IllegalArgumentException- if invalid type is specified
-
DataTreeDialog
public DataTreeDialog(Component parent, String title, int type, DomainFileFilter filter, Project project) Construct a new DataTreeDialog for the given project.- Parameters:
parent- dialog's parenttitle- title to usetype- specify OPEN, SAVE, CHOOSE_FOLDER, or CHOOSE_USER_FOLDERfilter- filter used to control what is displayed in the data treeproject- the project to browse- Throws:
IllegalArgumentException- if invalid type is specified
-
-
Method Details
-
setTreeSelectionMode
public void setTreeSelectionMode(int mode) -
addOkActionListener
Add action listener that is called when the OK button is hit.- Parameters:
l- listener to add
-
getActionContext
Description copied from class:DialogComponentProviderAn optional extension point for subclasses to provider action context for the actions used by this provider.- Specified by:
getActionContextin interfaceActionContextProvider- Overrides:
getActionContextin classDialogComponentProvider- Parameters:
event- The mouse event used (may be null) to generate a popup menu
-
show
public void show() -
showComponent
public void showComponent()Shows this dialog. The preferred show method isshow(), as it is the preferred nomenclature. -
dialogShown
protected void dialogShown()Description copied from class:DialogComponentProviderOverride this method if you want to do something when the dialog is made visible- Overrides:
dialogShownin classDialogComponentProvider
-
getNameText
-
setNameText
-
setSelectedFolder
Sets a domain folder as the initially selected folder when the dialog is first shown.- Parameters:
folder-DomainFolderto select when showing the dialog
-
getDomainFile
Get the selected domain file.- Returns:
- null if there was no domain file selected
-
getDomainFolder
Get the selected folder.- Returns:
- null if there was no domain folder selected
-
valueChanged
TreeSelectionListener method that is called whenever the value of the selection changes.- Specified by:
valueChangedin interfaceGTreeSelectionListener- Parameters:
e- the event that characterizes the change.
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
selectRootDataFolder
public void selectRootDataFolder()Select the root folder in the tree. -
selectFolder
Select a folder in the tree.- Parameters:
folder- the folder to select
-
selectDomainFile
Select the node that corresponds to the given domain file.- Parameters:
file- the file
-
close
public void close()- Overrides:
closein classDialogComponentProvider
-
buildMainPanel
-
okCallback
protected void okCallback()Description copied from class:DialogComponentProviderThe callback method for when the "OK" button is pressed.- Overrides:
okCallbackin classDialogComponentProvider
-
wasCancelled
public boolean wasCancelled() -
cancelCallback
protected void cancelCallback()Description copied from class:DialogComponentProviderThe callback method for when the "Cancel" button is pressed. The default behavior is to call setVisible(false) and dispose() on the dialog.- Overrides:
cancelCallbackin classDialogComponentProvider
-
addTreeListeners
protected void addTreeListeners() -
findAndSelect
-
setSearchText
-