Package ghidra.framework.model

# Interface ToolChest

public interface ToolChest
Interface to define methods to manage tools in a central location.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addToolChestChangeListener(ToolChestChangeListener l)`
  Add a listener to be notified when the tool chest is changed.
  `boolean`
  `addToolTemplate(ToolTemplate template)`
  Add tool template to the tool chest.
  `int`
  `getToolCount()`
  Get the number of tools in this tool chest.
  `ToolTemplate`
  `getToolTemplate(String toolName)`
  Get the tool template for the given tool name.
  `ToolTemplate[]`
  `getToolTemplates()`
  Get the tool templates from the tool chest.
  `boolean`
  `remove(String toolName)`
  Remove entry (toolTemplate or toolSet) from the tool chest.
  `void`
  `removeToolChestChangeListener(ToolChestChangeListener l)`
  Remove a listener that is listening to when the tool chest is changed.
  `boolean`
  `replaceToolTemplate(ToolTemplate template)`
  Performs the same action as calling `remove(String)` and then `addToolTemplate(ToolTemplate)`.

- ## Method Details

  - ### getToolTemplate

    ToolTemplate getToolTemplate(String toolName)
    Get the tool template for the given tool name.
    Parameters:
      `toolName` - name of tool
    Returns:
      null if there is no tool template for the given toolName.

  - ### getToolTemplates

    ToolTemplate[] getToolTemplates()
    Get the tool templates from the tool chest.
    Returns:
      list of tool template

  - ### addToolChestChangeListener

    void addToolChestChangeListener(ToolChestChangeListener l)
    Add a listener to be notified when the tool chest is changed.
    Parameters:
      `l` - listener to add

  - ### removeToolChestChangeListener

    void removeToolChestChangeListener(ToolChestChangeListener l)
    Remove a listener that is listening to when the tool chest is changed.
    Parameters:
      `l` - to remove

  - ### addToolTemplate

    boolean addToolTemplate(ToolTemplate template)
    Add tool template to the tool chest.

    Note: If the given tool template name already exists in the project, then the name will be altered by appending an underscore and a one-up value. The `template` parameter's name is also updated with then new name.

    To simply replace a tool with without changing its name, call `replaceToolTemplate(ToolTemplate)`

    Parameters:
      `template` - tool template to add

  - ### remove

    boolean remove(String toolName)
    Remove entry (toolTemplate or toolSet) from the tool chest.
    Parameters:
      `toolName` - name of toolConfig or toolSet to remove
    Returns:
      true if the toolConfig or toolset was successfully removed from the tool chest.

  - ### getToolCount

    int getToolCount()
    Get the number of tools in this tool chest.
    Returns:
      tool count.

  - ### replaceToolTemplate

    boolean replaceToolTemplate(ToolTemplate template)
    Performs the same action as calling `remove(String)` and then `addToolTemplate(ToolTemplate)`. However, calling this method prevents state from being lost in the transition, such as position in the tool chest and default tool status.
    Parameters:
      `template` - The template to add to the tool chest, replacing any tools with the same name.
    Returns:
      True if the template was added.