Package ghidra.framework.project.tool
Class GhidraToolTemplate
- java.lang.Object
-
- ghidra.framework.project.tool.GhidraToolTemplate
-
- All Implemented Interfaces:
ToolTemplate
public class GhidraToolTemplate extends java.lang.Object implements ToolTemplate
Implementation for a tool template that has the class names of the plugins that are part of the tool, and the tool's icon.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringTEMPLATE_NAME-
Fields inherited from interface ghidra.framework.model.ToolTemplate
TOOL_INSTANCE_NAME_XML_NAME, TOOL_NAME_XML_NAME, TOOL_XML_NAME
-
-
Constructor Summary
Constructors Constructor Description GhidraToolTemplate(ToolIconURL iconURL, org.jdom.Element toolElement, java.lang.Class<?>[] supportedDataTypes)GhidraToolTemplate(org.jdom.Element root, java.lang.String path)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ToolcreateTool(Project project)Creates a tool like only this template knows how.booleanequals(java.lang.Object obj)Indicates whether some other object is "equal to" this one.javax.swing.ImageIcongetIcon()Get the icon for this tool template.ToolIconURLgetIconURL()Get the icon URL.java.lang.StringgetName()Get the name for the tool.java.lang.StringgetPath()Returns the path from whence this tool template came; may be null if the tool was not loaded from the filesystemjava.lang.Class<?>[]getSupportedDataTypes()Get the classes of the data types that this tool supports, i.e., what data types can be dropped onto this tool.org.jdom.ElementgetToolElement()This returns the XML element that represents the tool part of the overall XML hierarchy.inthashCode()Returns a hash code value for the object.voidrestoreFromXml(org.jdom.Element root)Restore this object from a saved XML element.org.jdom.ElementsaveToXml()Save this object to an XML Element.voidsetIconURL(ToolIconURL url)voidsetName(java.lang.String name)Set the name for the tool template.java.lang.StringtoString()Returns a string representation of the object.
-
-
-
Constructor Detail
-
GhidraToolTemplate
public GhidraToolTemplate(org.jdom.Element root, java.lang.String path)Constructor.- Parameters:
root- XML element that contains the tool template data
-
GhidraToolTemplate
public GhidraToolTemplate(ToolIconURL iconURL, org.jdom.Element toolElement, java.lang.Class<?>[] supportedDataTypes)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:ToolTemplateGet the name for the tool.- Specified by:
getNamein interfaceToolTemplate- Returns:
- the name
-
getPath
public java.lang.String getPath()
Description copied from interface:ToolTemplateReturns the path from whence this tool template came; may be null if the tool was not loaded from the filesystem- Specified by:
getPathin interfaceToolTemplate- Returns:
- the path
-
setName
public void setName(java.lang.String name)
Description copied from interface:ToolTemplateSet the name for the tool template.- Specified by:
setNamein interfaceToolTemplate- Parameters:
name- new tool template name
-
getIcon
public javax.swing.ImageIcon getIcon()
Description copied from interface:ToolTemplateGet the icon for this tool template. This is equivalent to calling getIconURL().getIcon()- Specified by:
getIconin interfaceToolTemplate- Returns:
- the icon for this tool template.
-
getSupportedDataTypes
public java.lang.Class<?>[] getSupportedDataTypes()
Description copied from interface:ToolTemplateGet the classes of the data types that this tool supports, i.e., what data types can be dropped onto this tool.- Specified by:
getSupportedDataTypesin interfaceToolTemplate- Returns:
- list of supported data type classes.
-
getIconURL
public ToolIconURL getIconURL()
Get the icon URL.- Specified by:
getIconURLin interfaceToolTemplate
-
hashCode
public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided byjava.util.Hashtable.- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of the object. In general, thetoStringmethod returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read.- Overrides:
toStringin classjava.lang.Object
-
restoreFromXml
public void restoreFromXml(org.jdom.Element root)
Description copied from interface:ToolTemplateRestore this object from a saved XML element.- Specified by:
restoreFromXmlin interfaceToolTemplate- Parameters:
root- element to restore this object into
-
saveToXml
public org.jdom.Element saveToXml()
Description copied from interface:ToolTemplateSave this object to an XML Element.- Specified by:
saveToXmlin interfaceToolTemplate- Returns:
- the ToolConfig saved as an XML element
-
setIconURL
public void setIconURL(ToolIconURL url)
-
getToolElement
public org.jdom.Element getToolElement()
Description copied from interface:ToolTemplateThis returns the XML element that represents the tool part of the overall XML hierarchy.- Specified by:
getToolElementin interfaceToolTemplate- Returns:
- the XML element that represents the tool part of the overall XML hierarchy.
-
createTool
public Tool createTool(Project project)
Description copied from interface:ToolTemplateCreates a tool like only this template knows how.- Specified by:
createToolin interfaceToolTemplate- Parameters:
project- the project in which the tool will be living.- Returns:
- a new tool for this template implementation.
-
-