Class ProgramOpener

java.lang.Object
ghidra.app.util.task.ProgramOpener

public class ProgramOpener extends Object
Helper class that contains the logic for opening program for all the various program locations and program states. It handles opening DomainFiles, URLs, versioned DomainFiles, and links to DomainFiles. It also handles upgrades and checkouts.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs this class with a consumer to use when opening a program.
  • Method Summary

    Modifier and Type
    Method
    Description
    openProgram(ghidra.app.plugin.core.progmgr.ProgramLocator locator, TaskMonitor monitor)
    Opens the program for the given location.
    void
    Invoking this method prior to task execution will prevent the use of optional checkout which require prompting the user.
    void
    Sets the text to use for the base action type for various prompts that can appear when opening programs.
    void
    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 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProgramOpener

      public ProgramOpener(Object consumer)
      Constructs this class with a consumer to use when opening a program.
      Parameters:
      consumer - the consumer for opening a program
  • Method Details

    • setPromptText

      public void setPromptText(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.
    • openProgram

      public Program openProgram(ghidra.app.plugin.core.progmgr.ProgramLocator locator, TaskMonitor monitor)
      Opens the program for the given location. This method is intended to be invoked from within a Task or for headless operations.
      Parameters:
      locator - the program location to open
      monitor - the TaskMonitor used for status and cancelling
      Returns:
      the opened program or null if the operation failed or was cancelled