Package ghidra.app.script

# Class GhidraState

java.lang.Object
ghidra.app.script.GhidraState

public class GhidraState extends Object
Represents the current state of a Ghidra tool

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GhidraState(GhidraState state)`
  `GhidraState(PluginTool tool, Project project, Program program, ProgramLocation location, ProgramSelection selection, ProgramSelection highlight)`
  Constructs a new Ghidra state.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addEnvironmentVar(String name, byte value)`
  `void`
  `addEnvironmentVar(String name, double value)`
  `void`
  `addEnvironmentVar(String name, float value)`
  `void`
  `addEnvironmentVar(String name, int value)`
  `void`
  `addEnvironmentVar(String name, long value)`
  `void`
  `addEnvironmentVar(String name, short value)`
  `void`
  `addEnvironmentVar(String name, Object value)`
  `Address`
  `getCurrentAddress()`
  `ProgramSelection`
  `getCurrentHighlight()`
  `ProgramLocation`
  `getCurrentLocation()`
  `Program`
  `getCurrentProgram()`
  Returns the current program.
  `ProgramSelection`
  `getCurrentSelection()`
  `Set<String>`
  `getEnvironmentNames()`
  `Object`
  `getEnvironmentVar(String name)`
  `Project`
  `getProject()`
  Returns the current project.
  `PluginTool`
  `getTool()`
  Returns the current tool.
  `void`
  `removeEnvironmentVar(String name)`
  `void`
  `setCurrentAddress(Address address)`
  If it differs, set the current location to the given address and fire a `ProgramLocationPluginEvent`.
  `void`
  `setCurrentHighlight(ProgramSelection highlight)`
  Set the currently highlighted selection and fire a `ProgramHighlightPluginEvent`.
  `void`
  `setCurrentLocation(ProgramLocation location)`
  If it differs, set the current location and fire a `ProgramLocationPluginEvent`.
  `void`
  `setCurrentProgram(Program program)`
  Sets the current program.
  `void`
  `setCurrentSelection(ProgramSelection selection)`
  Set the current selection and fire a `ProgramSelectionPluginEvent`.

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

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

- ## Constructor Details

  - ### GhidraState

    public GhidraState(PluginTool tool, Project project, Program program, ProgramLocation location, ProgramSelection selection, ProgramSelection highlight)
    Constructs a new Ghidra state.
    Parameters:
      `tool` - the current tool
      `project` - the current project
      `program` - the current program
      `location` - the current location
      `selection` - the current selection
      `highlight` - the current highlight

  - ### GhidraState

    public GhidraState(GhidraState state)

- ## Method Details

  - ### getTool

    public PluginTool getTool()
    Returns the current tool.
    Returns:
      the current tool

  - ### getProject

    public Project getProject()
    Returns the current project.
    Returns:
      the current project

  - ### getCurrentProgram

    public Program getCurrentProgram()
    Returns the current program.
    Returns:
      the current program

  - ### setCurrentProgram

    public void setCurrentProgram(Program program)
    Sets the current program.
    Parameters:
      `program` - the new program object

  - ### getCurrentAddress

    public Address getCurrentAddress()
    Returns:
      the address of the current location

  - ### setCurrentAddress

    public void setCurrentAddress(Address address)
    If it differs, set the current location to the given address and fire a `ProgramLocationPluginEvent`.
    Parameters:
      `address` - the address

  - ### getCurrentLocation

    public ProgramLocation getCurrentLocation()
    Returns:
      the current location

  - ### setCurrentLocation

    public void setCurrentLocation(ProgramLocation location)
    If it differs, set the current location and fire a `ProgramLocationPluginEvent`.
    Parameters:
      `location` - the location

  - ### getCurrentHighlight

    public ProgramSelection getCurrentHighlight()
    Returns:
      the currently highlighted selection

  - ### setCurrentHighlight

    public void setCurrentHighlight(ProgramSelection highlight)
    Set the currently highlighted selection and fire a `ProgramHighlightPluginEvent`.
    Parameters:
      `highlight` - the selection

  - ### getCurrentSelection

    public ProgramSelection getCurrentSelection()
    Returns:
      the current selection

  - ### setCurrentSelection

    public void setCurrentSelection(ProgramSelection selection)
    Set the current selection and fire a `ProgramSelectionPluginEvent`.
    Parameters:
      `selection` - the selection

  - ### addEnvironmentVar

    public void addEnvironmentVar(String name, byte value)

  - ### addEnvironmentVar

    public void addEnvironmentVar(String name, short value)

  - ### addEnvironmentVar

    public void addEnvironmentVar(String name, int value)

  - ### addEnvironmentVar

    public void addEnvironmentVar(String name, long value)

  - ### addEnvironmentVar

    public void addEnvironmentVar(String name, float value)

  - ### addEnvironmentVar

    public void addEnvironmentVar(String name, double value)

  - ### addEnvironmentVar

    public void addEnvironmentVar(String name, Object value)

  - ### removeEnvironmentVar

    public void removeEnvironmentVar(String name)

  - ### getEnvironmentVar

    public Object getEnvironmentVar(String name)

  - ### getEnvironmentNames

    public Set<String> getEnvironmentNames()