Package ghidra.framework.plugintool
Class ToolServicesAdapter
- java.lang.Object
-
- ghidra.framework.plugintool.ToolServicesAdapter
-
- All Implemented Interfaces:
ToolServices
public class ToolServicesAdapter extends java.lang.Object implements ToolServices
-
-
Field Summary
-
Fields inherited from interface ghidra.framework.model.ToolServices
DEFAULT_TOOLNAME
-
-
Constructor Summary
Constructors Constructor Description ToolServicesAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDefaultToolChangeListener(DefaultToolChangeListener listener)
Add a listener that will be notified when the default tool specification changes.boolean
canAutoSave(Tool tool)
Returns true if this tool should be saved base on the state of other runnings instances of the same toolvoid
closeTool(Tool tool)
Notify the framework that the tool is closing.void
displaySimilarTool(Tool tool, DomainFile domainFile, PluginEvent event)
Find a running tool like the one specified that has the named domain file.void
exportTool(java.io.File location, Tool tool)
Save the tool to the given location on the local file system.java.util.Set<ToolTemplate>
getCompatibleTools(java.lang.Class<? extends DomainObject> domainClass)
Returns a set of tools that can open the given domain file class.java.util.Set<ToolAssociationInfo>
getContentTypeToolAssociations()
Returns theassociations
, which describe content types and the tools used to open them, for all content types known to the system.ToolTemplate
getDefaultToolTemplate(DomainFile domainFile)
Returns the default tool template used to open the tool.Tool[]
getRunningTools()
Return array of running toolsToolChest
getToolChest()
Get the tool chest for the project.Tool
launchDefaultTool(DomainFile domainFile)
Launch the default tool; if domainFile is not null, this file will be opened in the tool.Tool
launchTool(java.lang.String toolName, DomainFile domainFile)
Launch the tool with the given namevoid
removeDefaultToolChangeListener(DefaultToolChangeListener listener)
Remove the listener.void
saveTool(Tool tool)
Saves the tool's configuration in the standard tool location.void
setContentTypeToolAssociations(java.util.Set<ToolAssociationInfo> infos)
Sets theassociations
, which describe content types and the tools used to open them, for the system.
-
-
-
Method Detail
-
addDefaultToolChangeListener
public void addDefaultToolChangeListener(DefaultToolChangeListener listener)
Description copied from interface:ToolServices
Add a listener that will be notified when the default tool specification changes.- Specified by:
addDefaultToolChangeListener
in interfaceToolServices
-
canAutoSave
public boolean canAutoSave(Tool tool)
Description copied from interface:ToolServices
Returns true if this tool should be saved base on the state of other runnings instances of the same tool- Specified by:
canAutoSave
in interfaceToolServices
- Parameters:
tool
- the tool to check for saving- Returns:
- true if the tool should be saved
-
closeTool
public void closeTool(Tool tool)
Description copied from interface:ToolServices
Notify the framework that the tool is closing.- Specified by:
closeTool
in interfaceToolServices
- Parameters:
tool
- tool that is closing
-
displaySimilarTool
public void displaySimilarTool(Tool tool, DomainFile domainFile, PluginEvent event)
Description copied from interface:ToolServices
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.- Specified by:
displaySimilarTool
in interfaceToolServices
- 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
-
exportTool
public void exportTool(java.io.File location, Tool tool) throws java.io.FileNotFoundException, java.io.IOException
Description copied from interface:ToolServices
Save the tool to the given location on the local file system.- Specified by:
exportTool
in interfaceToolServices
- Parameters:
location
- file to export tool description intotool
- tool to export- Throws:
java.io.FileNotFoundException
- thrown if the file's directory doesn't exist.java.io.IOException
- thrown if there is an error writing the file.
-
getCompatibleTools
public java.util.Set<ToolTemplate> getCompatibleTools(java.lang.Class<? extends DomainObject> domainClass)
Description copied from interface:ToolServices
Returns a set of tools that can open the given domain file class.- Specified by:
getCompatibleTools
in interfaceToolServices
- Parameters:
domainClass
- The domain file class type for which to get tools
-
getContentTypeToolAssociations
public java.util.Set<ToolAssociationInfo> getContentTypeToolAssociations()
Description copied from interface:ToolServices
Returns theassociations
, which describe content types and the tools used to open them, for all content types known to the system.- Specified by:
getContentTypeToolAssociations
in interfaceToolServices
- See Also:
ToolServices.setContentTypeToolAssociations(Set)
-
getDefaultToolTemplate
public ToolTemplate getDefaultToolTemplate(DomainFile domainFile)
Description copied from interface:ToolServices
Returns the default tool template used to open the tool. Here default means the tool that should be used to open the given file, whether defined by the user or the system default.- Specified by:
getDefaultToolTemplate
in interfaceToolServices
- Parameters:
domainFile
- The file for which to find the preferred tool.- Returns:
- The preferred tool that should be used to open the given file.
-
getRunningTools
public Tool[] getRunningTools()
Description copied from interface:ToolServices
Return array of running tools- Specified by:
getRunningTools
in interfaceToolServices
- Returns:
- array of Tools
-
getToolChest
public ToolChest getToolChest()
Description copied from interface:ToolServices
Get the tool chest for the project.- Specified by:
getToolChest
in interfaceToolServices
-
launchDefaultTool
public Tool launchDefaultTool(DomainFile domainFile)
Description copied from interface:ToolServices
Launch the default tool; if domainFile is not null, this file will be opened in the tool.- Specified by:
launchDefaultTool
in interfaceToolServices
- Parameters:
domainFile
- the file to open; may be null- See Also:
#setDefaultTool(ToolTemplate)
-
launchTool
public Tool launchTool(java.lang.String toolName, DomainFile domainFile)
Description copied from interface:ToolServices
Launch the tool with the given name- Specified by:
launchTool
in interfaceToolServices
- Parameters:
toolName
- name of the tool to launchdomainFile
- the file to open; may be null
-
removeDefaultToolChangeListener
public void removeDefaultToolChangeListener(DefaultToolChangeListener listener)
Description copied from interface:ToolServices
Remove the listener.- Specified by:
removeDefaultToolChangeListener
in interfaceToolServices
-
saveTool
public void saveTool(Tool tool)
Description copied from interface:ToolServices
Saves the tool's configuration in the standard tool location.- Specified by:
saveTool
in interfaceToolServices
- Parameters:
tool
- tool to save.
-
setContentTypeToolAssociations
public void setContentTypeToolAssociations(java.util.Set<ToolAssociationInfo> infos)
Description copied from interface:ToolServices
Sets theassociations
, which describe content types and the tools used to open them, for the system.- Specified by:
setContentTypeToolAssociations
in interfaceToolServices
- Parameters:
infos
- The associations to be applied- See Also:
ToolServices.getContentTypeToolAssociations()
-
-