Interface ToolServices

All Known Implementing Classes:
ToolServicesAdapter

public interface ToolServices
Services that the Tool uses.
  • Field Details

  • Method Details

    • closeTool

      void closeTool(PluginTool tool)
      Notify the framework that the tool is closing.
      Parameters:
      tool - tool that is closing
    • saveTool

      void saveTool(PluginTool tool)
      Saves the tool's configuration in the standard tool location.
      Parameters:
      tool - tool to save.
    • exportTool

      Save the tool to the given location on the local file system.
      Parameters:
      tool - the tool template to write
      Returns:
      the file to which the tool was saved
      Throws:
      FileNotFoundException - thrown if the file's directory doesn't exist.
      IOException - thrown if there is an error writing the file.
    • getToolChest

      ToolChest getToolChest()
      Get the tool chest for the project
      Returns:
      the tool chest
    • displaySimilarTool

      void displaySimilarTool(PluginTool tool, DomainFile domainFile, PluginEvent event)
      Find a running tool like the one specified that has the named domain file. If it finds a matching tool, then it is brought to the front. Otherwise, it creates one and runs it. It then invokes the specified event on the running tool.
      Parameters:
      tool - find/create a tool like this one.
      domainFile - open this file in the found/created tool.
      event - invoke this event on the found/created tool
    • getDefaultToolTemplate

      ToolTemplate getDefaultToolTemplate(DomainFile domainFile)
      Returns the default/preferred tool template which should be used to open the specified domain file, whether defined by the user or the system default.
      Parameters:
      domainFile - The file whose preferred tool should be found.
      Returns:
      The preferred tool that should be used to open the given file or null if none found.
    • getDefaultToolTemplate NEW

      ToolTemplate getDefaultToolTemplate(String contentType)
      Returns the default/preferred tool template which should be used to open the specified domain file content type, whether defined by the user or the system default.
      Parameters:
      contentType - The content type whose preferred tool should be found.
      Returns:
      The preferred tool that should be used to open the given file or null if none found.
    • getCompatibleTools

      Set<ToolTemplate> getCompatibleTools(Class<? extends DomainObject> domainClass)
      Returns a set of tools that can open the given domain file class.
      Parameters:
      domainClass - The domain file class type for which to get tools
      Returns:
      the tools
    • getContentTypeToolAssociations

      Set<ToolAssociationInfo> getContentTypeToolAssociations()
      Returns the associations, which describe content types and the tools used to open them, for all content types known to the system.
      Returns:
      the associations
      See Also:
    • setContentTypeToolAssociations

      void setContentTypeToolAssociations(Set<ToolAssociationInfo> infos)
      Sets the associations, which describe content types and the tools used to open them, for the system.
      Parameters:
      infos - The associations to be applied
      See Also:
    • launchDefaultTool

      PluginTool launchDefaultTool(Collection<DomainFile> domainFiles)
      Launch the default tool and open the specified domainFiles. NOTE: running tool reuse is implementation dependent
      Parameters:
      domainFiles - the files to open. A null or empty list will results in an immediate return of a null PluginTool. Null entries are not permitted.
      Returns:
      the launched tool. Null returned if a suitable default tool for the file content type was not found or failed to launch.
    • launchTool

      PluginTool launchTool(String toolName, Collection<DomainFile> domainFiles)
      Launch the tool with the given name and open the specified domainFiles. Only those domainFiles with a content type supported by the specified tool will be opened. NOTE: running tool reuse is implementation dependent.
      Parameters:
      toolName - name of the tool template to launch or re-use
      domainFiles - the files to open; may be null or empty. Null entries are not permitted.
      Returns:
      the resulting tool or null if the specified tool was not found or failed to launch
    • launchDefaultToolWithURL NEW

      PluginTool launchDefaultToolWithURL(URL ghidraUrl)
      Launch the default tool and open the specified Ghidra URL resource. The tool chosen will be based upon the content type of the specified resource. NOTE: running tool re-use is implementation dependent
      Parameters:
      ghidraUrl - resource to be opened (see GhidraURL)
      Returns:
      the launched tool. Null returned if a failure occurs while accessing the specified resource or a suitable default tool for the file content type was not found.
      Throws:
      IllegalArgumentException - if URL protocol is not supported. Currently, only the ghidra protocol is supported.
    • launchToolWithURL NEW

      PluginTool launchToolWithURL(String toolName, URL ghidraUrl)
      Launch the tool with the given name and attempt to open the specified Ghidra URL resource.
      Parameters:
      toolName - name of the tool to launch
      ghidraUrl - resource to be opened (see GhidraURL)
      Returns:
      the requested tool or null if the specified tool not found.
      Throws:
      IllegalArgumentException - if URL protocol is not supported. Currently, only the ghidra protocol is supported.
    • getRunningTools

      PluginTool[] getRunningTools()
      Return array of running tools
      Returns:
      array of Tools
    • canAutoSave

      boolean canAutoSave(PluginTool tool)
      Returns true if this tool should be saved base on the state of other running instances of the same tool
      Parameters:
      tool - the tool to check for saving
      Returns:
      true if the tool should be saved