Package ghidra.pyghidra

# Class PyGhidraPlugin

java.lang.Object
ghidra.framework.plugintool.Plugin
ghidra.app.plugin.ProgramPlugin
ghidra.pyghidra.PyGhidraPlugin

All Implemented Interfaces:
  `PluginEventListener`, `ServiceListener`, `ExtensionPoint`

public class PyGhidraPlugin extends ProgramPlugin
This plugin provides the interactive Python interpreter.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `PyGhidraInterpreter`
  `interpreter`
  `final InterpreterGhidraScript`
  `script`
  `static final String`
  `TITLE`

  ### Fields inherited from class ghidra.app.plugin.ProgramPlugin

  `currentHighlight, currentLocation, currentProgram, currentSelection`

  ### Fields inherited from class ghidra.framework.plugintool.Plugin

  `name, pluginDescription, tool`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PyGhidraPlugin(PluginTool tool)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `dispose()`
  Tells a plugin that it is no longer needed.
  `protected void`
  `highlightChanged(ProgramSelection highlight)`
  Subclass should override this method if it is interested in program highlight events.
  `void`
  `init()`
  Initialization method; override to add initialization for this plugin.
  `protected void`
  `locationChanged(ProgramLocation location)`
  Subclass should override this method if it is interested in program location events.
  `protected void`
  `programActivated(Program program)`
  Subclass should override this method if it is interested when programs become active.
  `protected void`
  `programDeactivated(Program program)`
  Subclass should override this method if it is interested when programs become inactive.
  `protected void`
  `selectionChanged(ProgramSelection selection)`
  Subclass should override this method if it is interested in program selection events.
  `static void`
  `setInitializer(Consumer<PyGhidraPlugin> initializer)`
  Sets the plugin's Python side initializer.

  ### Methods inherited from class ghidra.app.plugin.ProgramPlugin

  `getCurrentProgram, getProgramHighlight, getProgramLocation, getProgramSelection, goTo, goTo, postProgramActivated, processEvent, programClosed, programOpened, setSelection`

  ### Methods inherited from class ghidra.framework.plugintool.Plugin

  `accept, acceptData, canClose, canCloseDomainObject, cleanup, close, dataStateRestoreCompleted, dependsUpon, deregisterService, equals, eventSent, firePluginEvent, getData, getMissingRequiredServices, getName, getPluginDescription, getServicesRequired, getSupportedDataTypes, getTool, getTransientState, getUndoRedoState, hashCode, hasMissingRequiredService, hasUnsaveData, internalRegisterEventConsumed, isDisposed, prepareToSave, readConfigState, readDataState, registerDynamicServiceProvided, registerServiceProvided, restoreTransientState, restoreUndoRedoState, saveData, serviceAdded, serviceRemoved, writeConfigState, writeDataState`

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

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### TITLE

    public static final String TITLE
    See Also:
      - Constant Field Values

  - ### script

    public final InterpreterGhidraScript script

  - ### interpreter

    public PyGhidraInterpreter interpreter

- ## Constructor Details

  - ### PyGhidraPlugin

    public PyGhidraPlugin(PluginTool tool)

- ## Method Details

  - ### setInitializer

    public static void setInitializer(Consumer<PyGhidraPlugin> initializer)
    Sets the plugin's Python side initializer.

    This method is for internal use only and is only public so it can be called from Python.

    Parameters:
      `initializer` - the Python side initializer
    Throws:
      `AssertException` - if the code completer has already been set

  - ### init

    public void init()
    Description copied from class: `Plugin`
    Initialization method; override to add initialization for this plugin. This is where a plugin should acquire its services. When this method is called, all plugins have been instantiated in the tool.
    Overrides:
      `init` in class `Plugin`

  - ### dispose

    public void dispose()
    Description copied from class: `Plugin`
    Tells a plugin that it is no longer needed. The plugin should release any resources that it has. All actions, components, services will automatically be cleaned up.
    Overrides:
      `dispose` in class `Plugin`

  - ### programActivated

    protected void programActivated(Program program)
    Description copied from class: `ProgramPlugin`
    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.

    Overrides:
      `programActivated` in class `ProgramPlugin`
    Parameters:
      `program` - the new program going active.

  - ### programDeactivated

    protected void programDeactivated(Program program)
    Description copied from class: `ProgramPlugin`
    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.
    Overrides:
      `programDeactivated` in class `ProgramPlugin`
    Parameters:
      `program` - the old program going inactive.

  - ### locationChanged

    protected void locationChanged(ProgramLocation location)
    Description copied from class: `ProgramPlugin`
    Subclass should override this method if it is interested in program location events.
    Overrides:
      `locationChanged` in class `ProgramPlugin`
    Parameters:
      `location` - location could be null

  - ### selectionChanged

    protected void selectionChanged(ProgramSelection selection)
    Description copied from class: `ProgramPlugin`
    Subclass should override this method if it is interested in program selection events.
    Overrides:
      `selectionChanged` in class `ProgramPlugin`
    Parameters:
      `selection` - selection could be null

  - ### highlightChanged

    protected void highlightChanged(ProgramSelection highlight)
    Description copied from class: `ProgramPlugin`
    Subclass should override this method if it is interested in program highlight events.
    Overrides:
      `highlightChanged` in class `ProgramPlugin`
    Parameters:
      `highlight` - highlight could be null