Package ghidra.framework.model
Interface ToolServices
- All Known Implementing Classes:
ToolServicesAdapter
public interface ToolServices
Services that the Tool uses.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canAutoSave
(PluginTool tool) Returns true if this tool should be saved base on the state of other running instances of the same toolvoid
closeTool
(PluginTool tool) Notify the framework that the tool is closing.exportTool
(ToolTemplate tool) Save the tool to the given location on the local file system.getCompatibleTools
(Class<? extends DomainObject> domainClass) Returns a set of tools that can open the given domain file class.Returns theassociations
, which describe content types and the tools used to open them, for all content types known to the system.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.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.Return array of running toolsGet the tool chest for the projectlaunchDefaultTool
(Collection<DomainFile> domainFiles) Launch the defaulttool
and open the specified domainFiles.launchDefaultToolWithURL
(URL ghidraUrl) Launch the default tool and open the specified Ghidra URL resource.launchTool
(String toolName, Collection<DomainFile> domainFiles) Launch thetool
with the given name and open the specified domainFiles.launchToolWithURL
(String toolName, URL ghidraUrl) Launch the tool with the given name and attempt to open the specified Ghidra URL resource.void
saveTool
(PluginTool tool) Saves the tool's configuration in the standard tool location.void
Sets theassociations
, which describe content types and the tools used to open them, for the system.
-
Field Details
-
DEFAULT_TOOLNAME
The default tool name for Ghidra- See Also:
-
-
Method Details
-
closeTool
Notify the framework that the tool is closing.- Parameters:
tool
- tool that is closing
-
saveTool
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
-
getDefaultToolTemplate
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
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
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 theassociations
, 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
Sets theassociations
, which describe content types and the tools used to open them, for the system.- Parameters:
infos
- The associations to be applied- See Also:
-
launchDefaultTool
Launch the defaulttool
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 nullPluginTool
. 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
Launch thetool
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 thetool template
to launch or re-usedomainFiles
- 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
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 (seeGhidraURL
)- 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 theghidra
protocol is supported.
-
launchToolWithURL
Launch the tool with the given name and attempt to open the specified Ghidra URL resource.- Parameters:
toolName
- name of the tool to launchghidraUrl
- resource to be opened (seeGhidraURL
)- Returns:
- the requested tool or null if the specified tool not found.
- Throws:
IllegalArgumentException
- if URL protocol is not supported. Currently, only theghidra
protocol is supported.
-
getRunningTools
PluginTool[] getRunningTools()Return array of running tools- Returns:
- array of Tools
-
canAutoSave
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
-