Package ghidra.framework.main

# Class GetDomainObjectTask

java.lang.Object
ghidra.util.task.Task
ghidra.framework.main.GetDomainObjectTask

All Implemented Interfaces:
  `MonitoredRunnable`

public class GetDomainObjectTask extends Task
A modal task that gets a domain object for a specified version. Object is either open read-only or immutable. NOTE: This task is not intended to open a domain file for modification and saving back to a project. A file open for read-only use will be upgraded if needed and is possible. Once open it is important that the specified consumer be released from the domain object when done using the open object (see `DomainObject.release(Object)`).

- ## Field Summary

  ### Fields inherited from class ghidra.util.task.Task

  `taskMonitor, waitForTaskCompleted`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GetDomainObjectTask(Object consumer, DomainFile domainFile, int versionNumber)`
  Construct task open specified domainFile read only.
  `GetDomainObjectTask(Object consumer, DomainFile domainFile, int versionNumber, boolean immutable)`
  Construct task open specified domainFile read only or immutable.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DomainObject`
  `getDomainObject()`
  Return the domain object instance.
  `void`
  `run(TaskMonitor monitor)`
  This is the method that will be called to do the work

  ### Methods inherited from class ghidra.util.task.Task

  `addTaskListener, canCancel, cancel, getStatusTextAlignment, getTaskTitle, getWaitForTaskCompleted, hasProgress, isCancelled, isModal, monitoredRun, notifyTaskListeners, setHasProgress`

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

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

- ## Constructor Details

  - ### GetDomainObjectTask

    public GetDomainObjectTask(Object consumer, DomainFile domainFile, int versionNumber)
    Construct task open specified domainFile read only. An upgrade is performed if needed and is possible.
    Parameters:
      `consumer` - consumer of the domain object
      `domainFile` - domain file
      `versionNumber` - version

  - ### GetDomainObjectTask

    public GetDomainObjectTask(Object consumer, DomainFile domainFile, int versionNumber, boolean immutable)
    Construct task open specified domainFile read only or immutable. Immutable mode should not be used for content that will be modified. If read-only an upgrade is performed if needed, if immutable the user will be prompted if an upgrade should be performed if possible in which case it will open read-only.
    Parameters:
      `consumer` - consumer of the domain object
      `domainFile` - domain file
      `versionNumber` - version
      `immutable` - true if the object should be open immutable, else read-only.

- ## Method Details

  - ### run

    public void run(TaskMonitor monitor)
    Description copied from class: `Task`
    This is the method that will be called to do the work

    Note: The run(TaskMonitor) method should not make any calls directly on Swing components, as these calls are not thread safe. Place Swing calls in a Runnable, then call `Swing.runLater(Runnable)` or `Swing.runNow(Runnable)`to schedule the Runnable inside of the AWT Event Thread.

    Specified by:
      `run` in class `Task`
    Parameters:
      `monitor` - The TaskMonitor that will monitor the executing Task

  - ### getDomainObject

    public DomainObject getDomainObject()
    Return the domain object instance.
    Returns:
      domain object which was opened or null if task cancelled or failed