Package ghidra.program.util

# Class ProgramTask

java.lang.Object
ghidra.util.task.Task
ghidra.program.util.ProgramTask

All Implemented Interfaces:
  `MonitoredRunnable`

Direct Known Subclasses:
  `AbstractBSimApplyTask`, `MoveBlockTask`

public abstract class ProgramTask extends Task
Task for operating on programs. Will open and close a transaction around the work.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Program`
  `program`

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

  `taskMonitor, waitForTaskCompleted`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `ProgramTask(Program program, String title, boolean canCancel, boolean hasProgress, boolean isModal)`
  Construct a new Task that will operate on a program.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract void`
  `doRun(TaskMonitor monitor)`
  `final 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`

- ## Field Details

  - ### program

    protected Program program

- ## Constructor Details

  - ### ProgramTask

    protected ProgramTask(Program program, String title, boolean canCancel, boolean hasProgress, boolean isModal)
    Construct a new Task that will operate on a program.
    Parameters:
      `program` - the program that the task will operate on.
      `title` - title the title associated with the task
      `canCancel` - true means that the user can cancel the task
      `hasProgress` - true means that the dialog should show a progress indicator
      `isModal` - true means that the dialog is modal and the task has to complete or be canceled before any other action can occur

- ## Method Details

  - ### run

    public final 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

  - ### doRun

    protected abstract void doRun(TaskMonitor monitor)