Package ghidra.framework.main

# Class OpenVersionedFileDialog<T extends DomainObject>

java.lang.Object
docking.DialogComponentProvider
ghidra.framework.main.DataTreeDialog
ghidra.framework.main.OpenVersionedFileDialog<T>

Type Parameters:
  `T` - domain object class

All Implemented Interfaces:
  `ActionContextProvider`, `GTreeSelectionListener`, `StatusListener`, `TaskListener`, `ActionListener`, `EventListener`

public class OpenVersionedFileDialog<T extends DomainObject> extends DataTreeDialog
Dialog to open a file that is versioned and allow a version to be opened.

- ## Field Summary

  ### Fields inherited from class ghidra.framework.main.DataTreeDialog

  `CHOOSE_FOLDER, CREATE, HEIGHT, OPEN, SAVE, treePanel, WIDTH`

  ### Fields inherited from class docking.DialogComponentProvider

  `applyButton, buttonPanel, cancelButton, dismissButton, okButton, rootPanel`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OpenVersionedFileDialog(PluginTool tool, String title, Class<T> domainObjectClass)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `addTreeListeners()`
  `protected JPanel`
  `buildMainPanel()`
  `void`
  `close()`
  `protected void`
  `dialogClosed()`
  Override this method if you want to do something when the dialog is made invisible
  `protected void`
  `dialogShown()`
  Override this method if you want to do something when the dialog is made visible
  `ActionContext`
  `getActionContext(MouseEvent event)`
  An optional extension point for subclasses to provider action context for the actions used by this provider.
  `DomainFile`
  `getDomainFile()`
  Get the selected domain file.
  `DomainFolder`
  `getDomainFolder()`
  Get the selected folder.
  `T`
  `getDomainObject(Object consumer, boolean immutable)`
  Get the selected domain object for read-only or immutable use.
  `int`
  `getVersion()`
  Return the selected version number from the history panel.
  `void`
  `setOpenObjectChoices(List<T> openDomainObjects)`
  Set an optional list of already open domain objects of type `<T>` which may be selected instead of a project domain file.

  ### Methods inherited from class ghidra.framework.main.DataTreeDialog

  `actionPerformed, addOkActionListener, cancelCallback, findAndSelect, getNameText, okCallback, selectDomainFile, selectFolder, selectRootDataFolder, setNameText, setSearchText, setSelectedFolder, setTreeSelectionMode, show, showComponent, valueChanged, wasCancelled`

  ### Methods inherited from class docking.DialogComponentProvider

  `addAction, addApplyButton, addButton, addCancelButton, addDismissButton, addOKButton, addWorkPanel, alertMessage, alertMessage, applyCallback, cancelCurrentTask, clearScheduledTask, clearStatusText, closeDialog, 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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### OpenVersionedFileDialog

    public OpenVersionedFileDialog(PluginTool tool, String title, Class<T> domainObjectClass)
    Constructor
    Parameters:
      `tool` - tool where the file is being opened.
      `title` - title to use
      `domainObjectClass` - allowed domain object class which corresponds to `<T>`

- ## Method Details

  - ### setOpenObjectChoices

    public void setOpenObjectChoices(List<T> openDomainObjects)
    Set an optional list of already open domain objects of type `<T>` which may be selected instead of a project domain file. The `getDomainObject(Object, boolean)` method should be used when this optional list has been set. If this dialog is reused the list should be set null if previously set. This method must be invoked prior to showing the dialog.
    Parameters:
      `openDomainObjects` - list of open domain objects from which a selection may be made.

  - ### getDomainObject

    public T getDomainObject(Object consumer, boolean immutable)
    Get the selected domain object for read-only or immutable use. If an existing open object is selected its original mode applies but consumer will be added. The caller/consumer is responsible for releasing the returned domain object when done using it (see `DomainObject.release(Object)`).
    Parameters:
      `consumer` - domain object consumer
      `immutable` - true if the domain object should be opened immutable, else false for read-only. Immutable mode should not be used for content that will be modified. If read-only indicated an upgrade will always be performed if required.
    Returns:
      opened domain object or null if a file was not selected or if open failed to complete.

  - ### getVersion

    public int getVersion()
    Return the selected version number from the history panel.
    Returns:
      -1 if a version history was not selected

  - ### getDomainFile

    public DomainFile getDomainFile()
    Description copied from class: `DataTreeDialog`
    Get the selected domain file.
    Overrides:
      `getDomainFile` in class `DataTreeDialog`
    Returns:
      null if there was no domain file selected

  - ### getDomainFolder

    public DomainFolder getDomainFolder()
    Description copied from class: `DataTreeDialog`
    Get the selected folder.
    Overrides:
      `getDomainFolder` in class `DataTreeDialog`
    Returns:
      null if there was no domain folder selected

  - ### buildMainPanel

    protected JPanel buildMainPanel()
    Overrides:
      `buildMainPanel` in class `DataTreeDialog`

  - ### close

    public void close()
    Overrides:
      `close` in class `DataTreeDialog`

  - ### dialogShown

    protected void dialogShown()
    Description copied from class: `DialogComponentProvider`
    Override this method if you want to do something when the dialog is made visible
    Overrides:
      `dialogShown` in class `DataTreeDialog`

  - ### dialogClosed

    protected void dialogClosed()
    Description copied from class: `DialogComponentProvider`
    Override this method if you want to do something when the dialog is made invisible
    Overrides:
      `dialogClosed` in class `DialogComponentProvider`

  - ### addTreeListeners

    protected void addTreeListeners()
    Overrides:
      `addTreeListeners` in class `DataTreeDialog`

  - ### getActionContext

    public ActionContext getActionContext(MouseEvent event)
    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 interface `ActionContextProvider`
    Overrides:
      `getActionContext` in class `DataTreeDialog`
    Parameters:
      `event` - The mouse event used (may be null) to generate a popup menu