Package ghidra.framework.main
Class AbstractDataTreeDialog
java.lang.Object
docking.DialogComponentProvider
ghidra.framework.main.AbstractDataTreeDialog
- All Implemented Interfaces:
ActionContextProvider
,GTreeSelectionListener
,StatusListener
,TaskListener
,ActionListener
,EventListener
- Direct Known Subclasses:
DataTreeDialog
,OpenVersionedFileDialog
public abstract class AbstractDataTreeDialog
extends DialogComponentProvider
implements GTreeSelectionListener, ActionListener
Base dialog for choosing DomainFiles. Provides and manages the base data tree panel. Subclasses
should call the buildDataTreePanel() when they are constructing their main panels. They should
also call the initializeFocusedComponent() method so that default focus for the dialog is in
the text field if it is enabled or otherwise the focus should be the tree.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected ProjectDataTreePanel
protected static final int
Fields inherited from class docking.DialogComponentProvider
applyButton, buttonPanel, cancelButton, dismissButton, okButton, rootPanel
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractDataTreeDialog
(Component parent, String title, DataTreeDialogType type, DomainFileFilter filter, Project project) Construct a new DataTreeDialog for the given project. -
Method Summary
Modifier and TypeMethodDescriptionvoid
actionPerformed
(ActionEvent event) void
Add action listener that is called when the OK button is hit.protected void
protected JPanel
protected void
The callback method for when the "Cancel" button is pressed.void
close()
getActionContext
(MouseEvent event) An optional extension point for subclasses to provider action context for the actions used by this provider.protected static DomainFileFilter
Get the selected domain file.Get the selected folder.protected void
protected void
The callback method for when the "OK" button is pressed.void
selectDomainFile
(DomainFile file) Select the node that corresponds to the given domain file.void
selectFolder
(DomainFolder folder) Select a folder in the tree.void
Select the root folder in the tree.void
setNameText
(String name) void
void
setSelectedFolder
(DomainFolder folder) Sets a domain folder as the initially selected folder when the dialog is first shown.void
setTreeSelectionMode
(int mode) void
show()
void
Shows this dialog.void
TreeSelectionListener method that is called whenever the value of the selection changes.boolean
Methods inherited from class docking.DialogComponentProvider
addAction, addApplyButton, addButton, addCancelButton, addDismissButton, addOKButton, addWorkPanel, alertMessage, alertMessage, applyCallback, cancelCurrentTask, clearScheduledTask, clearStatusText, closeDialog, dialogClosed, dialogShown, 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, setAccessibleDescription, 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
-
WIDTH
protected static final int WIDTH- See Also:
-
HEIGHT
protected static final int HEIGHT- See Also:
-
treePanel
-
-
Constructor Details
-
AbstractDataTreeDialog
protected AbstractDataTreeDialog(Component parent, String title, DataTreeDialogType 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
-
initializeFocusedComponent
protected void initializeFocusedComponent() -
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:DialogComponentProvider
An optional extension point for subclasses to provider action context for the actions used by this provider.- Specified by:
getActionContext
in interfaceActionContextProvider
- Overrides:
getActionContext
in 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. -
getNameText
-
setNameText
-
setSelectedFolder
Sets a domain folder as the initially selected folder when the dialog is first shown.- Parameters:
folder
-DomainFolder
to 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:
valueChanged
in interfaceGTreeSelectionListener
- Parameters:
e
- the event that characterizes the change.
-
actionPerformed
- Specified by:
actionPerformed
in 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:
close
in classDialogComponentProvider
-
buildDataTreePanel
-
okCallback
protected void okCallback()Description copied from class:DialogComponentProvider
The callback method for when the "OK" button is pressed.- Overrides:
okCallback
in classDialogComponentProvider
-
wasCancelled
public boolean wasCancelled() -
cancelCallback
protected void cancelCallback()Description copied from class:DialogComponentProvider
The callback method for when the "Cancel" button is pressed. The default behavior is to call setVisible(false) and dispose() on the dialog.- Overrides:
cancelCallback
in classDialogComponentProvider
-
addTreeListeners
protected void addTreeListeners() -
setSearchText
-
getDefaultFilter
-