Class GhidraTool

  • All Implemented Interfaces:
    DockingTool, Tool, ToolListener, ServiceProvider
    Direct Known Subclasses:
    TestTool

    public class GhidraTool
    extends PluginTool
    Tool created by the workspace when the user chooses to create a new tool. Its ToolConfigProvider shows all Plugins with the exception of those plugins that can be added to the Front End tool only.
    • Field Detail

      • EXTENSIONS_PREFERENCE_NAME

        public static final java.lang.String EXTENSIONS_PREFERENCE_NAME
        See Also:
        Constant Field Values
      • autoSave

        public static boolean autoSave
    • Constructor Detail

      • GhidraTool

        public GhidraTool​(Project project,
                          java.lang.String name)
        Construct a new Ghidra Tool.
        Parameters:
        project - the project associated with the tool
        name - the name of the tool
      • GhidraTool

        public GhidraTool​(Project project,
                          GhidraToolTemplate template)
        Construct a new GhidraTool using an existing template.
        Parameters:
        project - project that is the associated with the tool.
        template - the template to use when creating the tool
    • Method Detail

      • createDockingWindowManager

        protected DockingWindowManager createDockingWindowManager​(boolean isDockable,
                                                                  boolean hasStatus,
                                                                  boolean isModal)
        Description copied from class: PluginTool
        This method exists here, as opposed to inline in the constructor, so that subclasses can alter the behavior of the DockingWindowManager construction.
        Overrides:
        createDockingWindowManager in class PluginTool
        Parameters:
        isDockable - true if the tool contains components that can be docked
        hasStatus - true if the tool should display a status component
        isModal - true if the tool is modal, meaning that while this tool is visible, no other tool or dialog in Ghidra can have focus
        Returns:
        a new DockingWindowManager
      • initActions

        protected void initActions()
        Description copied from class: PluginTool
        Placeholder for subclasses to get a chance to install actions before plugins.
        Overrides:
        initActions in class PluginTool
      • setToolName

        public void setToolName​(java.lang.String name)
        Description copied from interface: Tool
        Sets the type name of the tool.
        Specified by:
        setToolName in interface Tool
        Overrides:
        setToolName in class PluginTool
        Parameters:
        name - the basename to use when setting the tool's name
      • getToolTemplate

        public ToolTemplate getToolTemplate​(boolean includeConfigState)
        Description copied from interface: Tool
        Returns a ToolTemplate for this Tool that describes the state of the tool.
        Specified by:
        getToolTemplate in interface Tool
        Overrides:
        getToolTemplate in class PluginTool
        Returns:
        a ToolTemplate for this Tool that describes the state of the tool.
      • saveWindowingDataToXml

        public org.jdom.Element saveWindowingDataToXml()
        Description copied from interface: Tool
        Saves the tool's Docking Window layout and positioning information to an XML element.
        Specified by:
        saveWindowingDataToXml in interface Tool
        Overrides:
        saveWindowingDataToXml in class PluginTool
        Returns:
        the element containing the DockingWindow's layout information.
      • restoreWindowingDataFromXml

        public void restoreWindowingDataFromXml​(org.jdom.Element windowData)
        Description copied from interface: Tool
        Restores the tool's Docking Window layout and positioning information from an XML element.
        Specified by:
        restoreWindowingDataFromXml in interface Tool
        Overrides:
        restoreWindowingDataFromXml in class PluginTool
        Parameters:
        windowData - the element containing the information.
      • shouldSave

        public boolean shouldSave()
        Description copied from interface: Tool
        Returns true if this tool should save its data, based upon its changed state and the state of Ghidra's saving method.
        Specified by:
        shouldSave in interface Tool
        Overrides:
        shouldSave in class PluginTool
        Returns:
        true if this tool should save its data
      • doSaveTool

        protected boolean doSaveTool()
        Description copied from class: PluginTool
        Called when it is time to save the tool. Handles auto-saving logic.
        Overrides:
        doSaveTool in class PluginTool
        Returns:
        true if a save happened
      • exit

        public void exit()
        Description copied from interface: Tool
        Tells the tool to stop functioning and release its resources. The tool should dispose of all its windows and other resources.
        Specified by:
        exit in interface Tool
        Overrides:
        exit in class PluginTool
      • addManagePluginsAction

        protected void addManagePluginsAction()
      • showConfig

        protected void showConfig()
      • checkForNewExtensions

        public void checkForNewExtensions()
        Looks for extensions that have been installed since the last time this tool was launched. If any are found, and if those extensions contain plugins, the user is notified and given the chance to install them.