Package ghidra.framework.cmd

# Class BackgroundCommand<T extends DomainObject>

java.lang.Object
ghidra.framework.cmd.BackgroundCommand<T>

Type Parameters:
  `T` - `DomainObject` implementation interface

All Implemented Interfaces:
  `Command<T>`

Direct Known Subclasses:
  `AbstractModularizationCmd`, `AddMemRefsCmd`, `ApplyFunctionDataTypesCmd`, `ApplyFunctionSignatureCmd`, `CaptureFunctionDataTypesCmd`, `CompoundBackgroundCommand`, `CreateDataBackgroundCmd`, `CreateDataInStructureBackgroundCmd`, `CreateFunctionCmd`, `CreateMultipleFunctionsCmd`, `CreateThunkFunctionCmd`, `DecompilerParallelConventionAnalysisCmd`, `DecompilerParameterIdCmd`, `DecompilerSwitchAnalysisCmd`, `DeleteBlockCmd`, `DeleteFunctionTagCmd`, `DemanglerCmd`, `DisassembleCommand`, `FillOutStructureCmd`, `FunctionPurgeAnalysisCmd`, `FunctionResultStateStackAnalysisCmd`, `FunctionStackAnalysisCmd`, `MergeableBackgroundCommand`, `ModuleAlgorithmCmd`, `NewFunctionStackAnalysisCmd`, `ReDisassembleCommand`, `SetFlowOverrideCmd`, `SharedReturnAnalysisCmd`, `SubroutineModelCmd`

public abstract class BackgroundCommand<T extends DomainObject> extends Object implements Command<T>
Abstract command that will be run in a thread (in the background) other than the AWT(GUI) thread. Use this to apply a long running command that is cancellable.

The monitor allows the command to display status information as it executes.

This allows commands to make changes in the background so that the GUI is not frozen and the user can still interact with the GUI.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BackgroundCommand()`
  `BackgroundCommand(String name, boolean hasProgress, boolean canCancel, boolean isModal)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `applyTo(T obj)`
  Applies the command to the given domain object.
  `abstract boolean`
  `applyTo(T obj, TaskMonitor monitor)`
  Method called when this command is to apply changes to the given domain object.
  `boolean`
  `canCancel()`
  Check if the command can be canceled.
  `void`
  `dispose()`
  Called when this command is going to be removed/canceled without running it.
  `String`
  `getName()`
  Returns the name of this command.
  `String`
  `getStatusMsg()`
  Returns the status message indicating the status of the command.
  `boolean`
  `hasProgress()`
  Check if the command provides progress information.
  `boolean`
  `isModal()`
  Check if the command requires the monitor to be modal.
  `void`
  `run(PluginTool tool, T obj)`
  `protected void`
  `setStatusMsg(String statusMsg)`
  `void`
  `taskCompleted()`
  Called when the task monitor is completely done with indicating progress.
  `String`
  `toString()`

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

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

- ## Constructor Details

  - ### BackgroundCommand

    public BackgroundCommand()

  - ### BackgroundCommand

    public BackgroundCommand(String name, boolean hasProgress, boolean canCancel, boolean isModal)

- ## Method Details

  - ### applyTo

    public final boolean applyTo(T obj)
    Description copied from interface: `Command`
    Applies the command to the given domain object.
    Specified by:
      `applyTo` in interface `Command<T extends DomainObject>`
    Parameters:
      `obj` - domain object that this command is to be applied.
    Returns:
      true if the command applied successfully

  - ### applyTo

    public abstract boolean applyTo(T obj, TaskMonitor monitor)
    Method called when this command is to apply changes to the given domain object. A monitor is provided to display status information about the command as it executes in the background.
    Parameters:
      `obj` - domain object that will be affected by the command
      `monitor` - monitor to show progress of the command
    Returns:
      true if the command applied successfully

  - ### getName

    public String getName()
    Description copied from interface: `Command`
    Returns the name of this command.
    Specified by:
      `getName` in interface `Command<T extends DomainObject>`
    Returns:
      the name of this command

  - ### hasProgress

    public boolean hasProgress()
    Check if the command provides progress information.
    Returns:
      true if the command shows progress information

  - ### canCancel

    public boolean canCancel()
    Check if the command can be canceled.
    Returns:
      true if this command can be canceled

  - ### isModal

    public boolean isModal()
    Check if the command requires the monitor to be modal. No other command should be allowed, and the GUI will be locked.
    Returns:
      true if no other operation should be going on while this command is in progress.

  - ### dispose

    public void dispose()
    Called when this command is going to be removed/canceled without running it. This gives the command the opportunity to free any temporary resources it has hold of.

  - ### taskCompleted

    public void taskCompleted()
    Called when the task monitor is completely done with indicating progress.

  - ### getStatusMsg

    public String getStatusMsg()
    Description copied from interface: `Command`
    Returns the status message indicating the status of the command.
    Specified by:
      `getStatusMsg` in interface `Command<T extends DomainObject>`
    Returns:
      reason for failure, or null if the status of the command was successful

  - ### setStatusMsg

    protected void setStatusMsg(String statusMsg)

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### run

    public void run(PluginTool tool, T obj)