Package ghidra.app.plugin
Class ProgramPlugin
java.lang.Object
ghidra.framework.plugintool.Plugin
ghidra.app.plugin.ProgramPlugin
- All Implemented Interfaces:
PluginEventListener
,ServiceListener
,ExtensionPoint
- Direct Known Subclasses:
JythonPlugin
,PropertyManagerPlugin
,ScreenshotPlugin
Base class to handle common program events: Program Open/Close, Program Activated,
Program Location, Program Selection, and Program Highlight. This class has fields related to
these events:
currentProgram
, currentLocation
, currentSelection
and
currentHighlight
.
Subclasses should override the following methods if they are interested in the corresponding events:
-
Field Summary
Modifier and TypeFieldDescriptionprotected ProgramSelection
protected ProgramLocation
protected Program
protected ProgramSelection
Fields inherited from class ghidra.framework.plugintool.Plugin
name, pluginDescription, tool
-
Constructor Summary
ConstructorDescriptionProgramPlugin
(PluginTool plugintool) Constructs a new program pluginProgramPlugin
(PluginTool plugintool, boolean consumeLocationChange, boolean consumeSelectionChange) Deprecated, for removal: This API element is subject to removal in a future version.ProgramPlugin
(PluginTool plugintool, boolean consumeLocationChange, boolean consumeSelectionChange, boolean consumeHighlightChange) Deprecated, for removal: This API element is subject to removal in a future version.callProgramPlugin(PluginTool)
instead -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Convenience method to go to the specified address.protected boolean
protected void
Subclass should override this method if it is interested in program highlight events.protected void
Subclass should override this method if it is interested in program location events.protected void
postProgramActivated
(Program program) Subclass should override this method if it is interested when programs become active and all plugins have had a chance to process theProgramActivatedPluginEvent
.void
processEvent
(PluginEvent event) Process the plugin event.protected void
programActivated
(Program program) Subclass should override this method if it is interested when programs become active.protected void
programClosed
(Program program) Subclasses should override this method if it is interested when a program is closed.protected void
programDeactivated
(Program program) Subclass should override this method if it is interested when programs become inactive.protected void
programOpened
(Program program) Subclasses should override this method if it is interested when a program is opened.protected void
Subclass should override this method if it is interested in program selection events.protected void
Convenience method to fire a program selection event.Methods inherited from class ghidra.framework.plugintool.Plugin
accept, acceptData, canClose, canCloseDomainObject, cleanup, close, dataStateRestoreCompleted, dependsUpon, deregisterService, dispose, equals, eventSent, firePluginEvent, getData, getMissingRequiredServices, getName, getPluginDescription, getServicesRequired, getSupportedDataTypes, getTool, getTransientState, getUndoRedoState, hashCode, hasMissingRequiredService, hasUnsaveData, init, internalRegisterEventConsumed, isDisposed, prepareToSave, readConfigState, readDataState, registerDynamicServiceProvided, registerServiceProvided, restoreTransientState, restoreUndoRedoState, saveData, serviceAdded, serviceRemoved, writeConfigState, writeDataState
-
Field Details
-
currentProgram
-
currentLocation
-
currentSelection
-
currentHighlight
-
-
Constructor Details
-
ProgramPlugin
Constructs a new program plugin- Parameters:
plugintool
- tool the parent tool for this plugin
-
ProgramPlugin
@Deprecated(forRemoval=true, since="10.2") public ProgramPlugin(PluginTool plugintool, boolean consumeLocationChange, boolean consumeSelectionChange) Deprecated, for removal: This API element is subject to removal in a future version.callProgramPlugin(PluginTool)
insteadCalling this constructor is works the same as callingProgramPlugin
.- Parameters:
plugintool
- the toolconsumeLocationChange
- not usedconsumeSelectionChange
- not used
-
ProgramPlugin
@Deprecated(forRemoval=true, since="10.2") public ProgramPlugin(PluginTool plugintool, boolean consumeLocationChange, boolean consumeSelectionChange, boolean consumeHighlightChange) Deprecated, for removal: This API element is subject to removal in a future version.callProgramPlugin(PluginTool)
insteadCalling this constructor is works the same as callingProgramPlugin
.- Parameters:
plugintool
- the toolconsumeLocationChange
- not usedconsumeSelectionChange
- not usedconsumeHighlightChange
- not used
-
-
Method Details
-
processEvent
Process the plugin event.When a program closed event or focus changed event comes in, the locationChanged() and selectionChanged() methods are called with null arguments; currentProgram and currentLocation are cleared.
Note: if the subclass overrides processEvent(), it should call super.processEvent().
- Overrides:
processEvent
in classPlugin
- Parameters:
event
- plugin to process
-
programActivated
Subclass should override this method if it is interested when programs become active. Note: this method is called in response to a ProgramActivatedPluginEvent.At the time this method is called, the "currentProgram" variable will be set the new active program.
- Parameters:
program
- the new program going active.
-
postProgramActivated
Subclass should override this method if it is interested when programs become active and all plugins have had a chance to process theProgramActivatedPluginEvent
. Note: this method is called in response to aProgramPostActivatedPluginEvent
At the time this method is called, the "currentProgram" variable will be set the new active program.
- Parameters:
program
- the new program going active.
-
programClosed
Subclasses should override this method if it is interested when a program is closed. This event has no affect on the "current Program". A "programDeactivated" call will occur that affects the active program.- Parameters:
program
- the program being closed.
-
programOpened
Subclasses should override this method if it is interested when a program is opened. This event has no affect on the "current Program". A "programActivated" call will occur that affects the active program.- Parameters:
program
- the program being opened.
-
programDeactivated
Subclass should override this method if it is interested when programs become inactive. Note: this method is called in response to a ProgramActivatedPluginEvent and there is a currently active program. At the time this method is called, the "currentProgram" variable will be set the new active program or null if there is no new active program.- Parameters:
program
- the old program going inactive.
-
locationChanged
Subclass should override this method if it is interested in program location events.- Parameters:
loc
- location could be null
-
selectionChanged
Subclass should override this method if it is interested in program selection events.- Parameters:
sel
- selection could be null
-
highlightChanged
Subclass should override this method if it is interested in program highlight events.- Parameters:
hl
- highlight could be null
-
goTo
Convenience method to go to the specified address.- Parameters:
addr
- the address to go to- Returns:
- true if successful
-
goTo
-
setSelection
Convenience method to fire a program selection event.- Parameters:
set
- address set for the selection.
-
getProgramLocation
-
getCurrentProgram
-
getProgramSelection
-
getProgramHighlight
-
ProgramPlugin(PluginTool)
instead