Package ghidra.app.util.task
Class ProgramOpener
java.lang.Object
ghidra.app.util.task.ProgramOpener
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
ConstructorDescriptionProgramOpener
(Object consumer) Constructs this class with a consumer to use when opening a program. -
Method Summary
Modifier and TypeMethodDescriptionopenProgram
(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
setPromptText
(String text) 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.).
-
Constructor Details
-
ProgramOpener
Constructs this class with a consumer to use when opening a program.- Parameters:
consumer
- the consumer for opening a program
-
-
Method Details
-
setPromptText
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 aTask
or for headless operations.- Parameters:
locator
- the program location to openmonitor
- the TaskMonitor used for status and cancelling- Returns:
- the opened program or null if the operation failed or was cancelled
-