Package ghidra.framework.cmd
Class BackgroundCommand
- java.lang.Object
-
- ghidra.framework.cmd.BackgroundCommand
-
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
AbstractModularizationCmd,AddMemRefsCmd,ApplyFunctionDataTypesCmd,ApplyFunctionSignatureCmd,CaptureFunctionDataTypesCmd,CompoundBackgroundCommand,CreateDataBackgroundCmd,CreateDataInStructureBackgroundCmd,CreateFunctionCmd,CreateMultipleFunctionsCmd,CreateThunkFunctionCmd,DeleteBlockCmd,DeleteFunctionTagCmd,DemanglerCmd,DisassembleCommand,FunctionPurgeAnalysisCmd,FunctionResultStateStackAnalysisCmd,FunctionStackAnalysisCmd,MergeableBackgroundCommand,ModuleAlgorithmCmd,NewFunctionStackAnalysisCmd,SetFlowOverrideCmd,SharedReturnAnalysisCmd,SubroutineModelCmd
public abstract class BackgroundCommand extends java.lang.Object implements Command
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 interruptable. 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(java.lang.String name, boolean hasProgress, boolean canCancel, boolean isModal)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanapplyTo(DomainObject obj)Applies the command to the given domain object.abstract booleanapplyTo(DomainObject obj, TaskMonitor monitor)Method called when this command is to apply changes to the given domain object.booleancanCancel()Check if the command can be canceled.voiddispose()Called when this command is going to be removed/canceled without running it.java.lang.StringgetName()Returns the name of this command.java.lang.StringgetStatusMsg()Returns the status message indicating the status of the command.booleanhasProgress()Check if the command provides progress information.booleanisModal()Check if the command requires the monitor to be modal.protected voidsetStatusMsg(java.lang.String statusMsg)voidtaskCompleted()Called when the task monitor is completely done with indicating progress.java.lang.StringtoString()
-
-
-
Method Detail
-
applyTo
public final boolean applyTo(DomainObject obj)
Description copied from interface:CommandApplies the command to the given domain object.
-
applyTo
public abstract boolean applyTo(DomainObject 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 commandmonitor- monitor to show progress of the command- Returns:
- true if the command applied successfully
-
getName
public java.lang.String getName()
Description copied from interface:CommandReturns 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 java.lang.String getStatusMsg()
Description copied from interface:CommandReturns the status message indicating the status of the command.- Specified by:
getStatusMsgin interfaceCommand- Returns:
- reason for failure, or null if the status of the command was successful
-
setStatusMsg
protected void setStatusMsg(java.lang.String statusMsg)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-