Package ghidra.app.util.task

# Class OpenProgramTask

java.lang.Object
ghidra.util.task.Task
ghidra.app.util.task.OpenProgramTask

All Implemented Interfaces:
  `MonitoredRunnable`

public class OpenProgramTask extends Task
Task for opening one or more programs.

- ## Field Summary

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

  `taskMonitor, waitForTaskCompleted`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OpenProgramTask(ghidra.app.plugin.core.progmgr.ProgramLocator locator, Object consumer)`
  Construct a task for opening a program.
  `OpenProgramTask(DomainFile domainFile, int version, Object consumer)`
  Construct a task for opening a program
  `OpenProgramTask(DomainFile domainFile, Object consumer)`
  Construct a task for opening the current version of a program
  `OpenProgramTask(URL ghidraURL, Object consumer)`
  Construct a task for opening a program from a URL
  `OpenProgramTask(List<ghidra.app.plugin.core.progmgr.ProgramLocator> programLocatorList, Object consumer)`
  Construct a task for opening one or more programs.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `OpenProgramRequest`
  `getOpenProgram()`
  Get the first successful open program request
  `List<OpenProgramRequest>`
  `getOpenPrograms()`
  Get all successful open program requests
  `void`
  `run(TaskMonitor monitor)`
  This is the method that will be called to do the work
  `void`
  `setNoCheckout()`
  Invoking this method prior to task execution will prevent the use of optional checkout which require prompting the user.
  `void`
  `setOpenPromptText(String text)`
  Sets the text to use for the base action type for various prompts that can appear when opening programs.
  `void`
  `setSilent()`
  Invoking this method prior to task execution will prevent any confirmation interaction with the user (e.g., optional checkout, snapshot recovery, etc.).

  ### 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

  - ### OpenProgramTask

    public OpenProgramTask(List<ghidra.app.plugin.core.progmgr.ProgramLocator> programLocatorList, Object consumer)
    Construct a task for opening one or more programs.
    Parameters:
      `programLocatorList` - the list of program locations to open
      `consumer` - the consumer to use for opening the programs

  - ### OpenProgramTask

    public OpenProgramTask(ghidra.app.plugin.core.progmgr.ProgramLocator locator, Object consumer)
    Construct a task for opening a program.
    Parameters:
      `locator` - the program location to open
      `consumer` - the consumer to use for opening the programs

  - ### OpenProgramTask

    public OpenProgramTask(DomainFile domainFile, int version, Object consumer)
    Construct a task for opening a program
    Parameters:
      `domainFile` - the `DomainFile` to open
      `version` - the version to open (versions other than the current version will be opened read-only)
      `consumer` - the consumer to use for opening the programs

  - ### OpenProgramTask

    public OpenProgramTask(DomainFile domainFile, Object consumer)
    Construct a task for opening the current version of a program
    Parameters:
      `domainFile` - the `DomainFile` to open
      `consumer` - the consumer to use for opening the programs

  - ### OpenProgramTask

    public OpenProgramTask(URL ghidraURL, Object consumer)
    Construct a task for opening a program from a URL
    Parameters:
      `ghidraURL` - the URL to the program to be opened
      `consumer` - the consumer to use for opening the programs

- ## Method Details

  - ### setOpenPromptText

    public void setOpenPromptText(String text)
    Sets the text to use for the base action type for various prompts that can appear when opening programs. (The default is "Open".) For example, you may want to override this so be something like "Open Source", or "Open target".
    Parameters:
      `text` - the text to use as the base action name.

  - ### setSilent

    public void setSilent()
    Invoking this method prior to task execution will prevent any confirmation interaction with the user (e.g., optional checkout, snapshot recovery, etc.). Errors may still be displayed if they occur.

  - ### setNoCheckout

    public void setNoCheckout()
    Invoking this method prior to task execution will prevent the use of optional checkout which require prompting the user.

  - ### getOpenPrograms

    public List<OpenProgramRequest> getOpenPrograms()
    Get all successful open program requests
    Returns:
      all successful open program requests

  - ### getOpenProgram

    public OpenProgramRequest getOpenProgram()
    Get the first successful open program request
    Returns:
      first successful open program request or null if none

  - ### 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