Class ProgramPlugin

java.lang.Object
ghidra.framework.plugintool.Plugin
ghidra.app.plugin.ProgramPlugin
All Implemented Interfaces:
PluginEventListener, ServiceListener, ExtensionPoint
Direct Known Subclasses:
PropertyManagerPlugin, PythonPlugin, ScreenshotPlugin

public abstract class ProgramPlugin extends Plugin
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 Details

  • Constructor Details

    • ProgramPlugin

      public ProgramPlugin(PluginTool plugintool)
      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.
      Calling this constructor is works the same as calling ProgramPlugin.
      Parameters:
      plugintool - the tool
      consumeLocationChange - not used
      consumeSelectionChange - 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.
      Calling this constructor is works the same as calling ProgramPlugin.
      Parameters:
      plugintool - the tool
      consumeLocationChange - not used
      consumeSelectionChange - not used
      consumeHighlightChange - not used
  • Method Details

    • processEvent

      public void processEvent(PluginEvent event)
      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 class Plugin
      Parameters:
      event - plugin to process
    • programActivated

      protected void programActivated(Program program)
      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

      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 the ProgramActivatedPluginEvent. Note: this method is called in response to a ProgramPostActivatedPluginEvent

      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

      protected void programClosed(Program program)
      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

      protected void programOpened(Program program)
      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

      protected void programDeactivated(Program program)
      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

      protected void locationChanged(ProgramLocation loc)
      Subclass should override this method if it is interested in program location events.
      Parameters:
      loc - location could be null
    • selectionChanged

      protected void selectionChanged(ProgramSelection sel)
      Subclass should override this method if it is interested in program selection events.
      Parameters:
      sel - selection could be null
    • highlightChanged

      protected void highlightChanged(ProgramSelection hl)
      Subclass should override this method if it is interested in program highlight events.
      Parameters:
      hl - highlight could be null
    • goTo

      protected boolean goTo(Address addr)
      Convenience method to go to the specified address.
      Parameters:
      addr - the address to go to
      Returns:
      true if successful
    • goTo

      protected boolean goTo(CodeUnit cu)
    • setSelection

      protected void setSelection(AddressSetView set)
      Convenience method to fire a program selection event.
      Parameters:
      set - address set for the selection.
    • getProgramLocation

      public ProgramLocation getProgramLocation()
    • getCurrentProgram

      public Program getCurrentProgram()
    • getProgramSelection

      public ProgramSelection getProgramSelection()
    • getProgramHighlight

      public ProgramSelection getProgramHighlight()