Package ghidra.framework.model
Interface Tool
-
- All Superinterfaces:
DockingTool
,ToolListener
- All Known Implementing Classes:
FrontEndTool
,GhidraTool
,ModalPluginTool
,PluginTool
,StandAlonePluginTool
,TestFrontEndTool
,TestTool
public interface Tool extends DockingTool, ToolListener
A Tool represents a collection of Plugins that are the basic building blocks. The plugins cooperate with one another to achieve certain functionality. The tool interface defines methods called by the Project that manages the tools.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DESCRIPTION_PROPERTY_NAME
Name of the property for the description of the tool.static java.lang.String
ICON_PROPERTY_NAME
Name of the property for the tool icon.static java.lang.String
PLUGIN_COUNT_PROPERTY_NAME
Name of the property for the number of plugins the tool has.static java.lang.String
TOOL_NAME_PROPERTY
Name of the property for the tool name.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
acceptDomainFiles(DomainFile[] data)
When the user drags a data file onto a tool, an event will be fired that the tool will respond to by accepting the data.void
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add property change listener.void
addToolListener(ToolListener listener)
Adds a ToolListener to be notified for any of a Tool's ToolEvents.boolean
canClose(boolean isExiting)
Can this tool be closed?boolean
canCloseDomainFile(DomainFile domainFile)
Can the domain File be closed?
Note: This forces plugins to terminate any tasks they have running for the indicated domain object and apply any unsaved data to the domain object.void
exit()
Tells the tool to stop functioning and release its resources.void
firePluginEvent(PluginEvent event)
Fire the plugin event by notifying the event manager which calls the listeners.java.lang.String[]
getConsumedToolEventNames()
Returns a list of eventNames that this Tool is interested in.DomainFile[]
getDomainFiles()
Get the domain files that this tool currently has open.ToolIconURL
getIconURL()
Get the url for the icon that this tool is using.java.lang.String
getInstanceName()
Returns the tool's unique name.java.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.java.lang.String[]
getToolEventNames()
Returns the names of all the possible ToolEvents that this tool might generate.java.lang.String
getToolName()
Returns the name associated with the toolToolTemplate
getToolTemplate(boolean includeConfigState)
Returns a ToolTemplate for this Tool that describes the state of the tool.void
putInstanceName(java.lang.String instanceName)
Associates a unique(within the active project) name to a tool instance.void
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove property change listener.void
removeToolListener(ToolListener listener)
Removes a ToolListener from receiving any event generated by this Tool.void
restoreDataStateFromXml(org.jdom.Element element)
Tells tool to read its data state from the given input stream.void
restoreWindowingDataFromXml(org.jdom.Element windowData)
Restores the tool's Docking Window layout and positioning information from an XML element.org.jdom.Element
saveDataStateToXml(boolean isTransactionState)
Tells tool to write its data state from the given output stream.ToolTemplate
saveToolToToolTemplate()
Save the tool and return its state as a ToolTemplate.org.jdom.Element
saveToXml(boolean includeConfigState)
org.jdom.Element
saveWindowingDataToXml()
Saves the tool's Docking Window layout and positioning information to an XML element.void
setIconURL(ToolIconURL iconURL)
Set the icon for this tool.void
setToolName(java.lang.String toolName)
Sets the type name of the tool.boolean
shouldSave()
Returns true if this tool should save its data, based upon its changed state and the state of Ghidra's saving method.-
Methods inherited from interface docking.DockingTool
addAction, addComponentProvider, addContextListener, addLocalAction, addPopupActionProvider, clearStatusInfo, close, contextChanged, getActiveComponentProvider, getAllActions, getComponentProvider, getDockingActionsByOwnerName, getGlobalContext, getIcon, getName, getOptions, getProviderWindow, getToolActions, getWindowManager, hasConfigChanged, isActive, isVisible, isVisible, removeAction, removeComponentProvider, removeContextListener, removeLocalAction, removePopupActionProvider, setConfigChanged, setMenuGroup, setStatusInfo, setStatusInfo, setVisible, showComponentProvider, showDialog, toFront, toFront, updateTitle
-
Methods inherited from interface ghidra.framework.model.ToolListener
processToolEvent
-
-
-
-
Field Detail
-
TOOL_NAME_PROPERTY
static final java.lang.String TOOL_NAME_PROPERTY
Name of the property for the tool name.- See Also:
- Constant Field Values
-
ICON_PROPERTY_NAME
static final java.lang.String ICON_PROPERTY_NAME
Name of the property for the tool icon.- See Also:
- Constant Field Values
-
DESCRIPTION_PROPERTY_NAME
static final java.lang.String DESCRIPTION_PROPERTY_NAME
Name of the property for the description of the tool.- See Also:
- Constant Field Values
-
PLUGIN_COUNT_PROPERTY_NAME
static final java.lang.String PLUGIN_COUNT_PROPERTY_NAME
Name of the property for the number of plugins the tool has.- See Also:
- Constant Field Values
-
-
Method Detail
-
exit
void exit()
Tells the tool to stop functioning and release its resources. The tool should dispose of all its windows and other resources.
-
canClose
boolean canClose(boolean isExiting)
Can this tool be closed?- Parameters:
isExiting
- true if all of Ghidra is closing, false if just this tool is closing.- Returns:
- true if the tool is in a state that it can be closed.
-
canCloseDomainFile
boolean canCloseDomainFile(DomainFile domainFile)
Can the domain File be closed?
Note: This forces plugins to terminate any tasks they have running for the indicated domain object and apply any unsaved data to the domain object. If they can't do this or the user cancels then this returns false.- Returns:
- false any of the plugins reports that the domain object should not be closed
-
firePluginEvent
void firePluginEvent(PluginEvent event)
Fire the plugin event by notifying the event manager which calls the listeners.- Parameters:
event
- plugin event
-
getToolName
java.lang.String getToolName()
Returns the name associated with the tool
-
setToolName
void setToolName(java.lang.String toolName) throws java.beans.PropertyVetoException
Sets the type name of the tool.- Parameters:
toolName
- the basename to use when setting the tool's name- Throws:
java.beans.PropertyVetoException
- thrown if a VetoableChangeListener rejects the change
-
putInstanceName
void putInstanceName(java.lang.String instanceName)
Associates a unique(within the active project) name to a tool instance.- Parameters:
instanceName
- unique tool instance name
-
getInstanceName
java.lang.String getInstanceName()
Returns the tool's unique name.
-
getToolEventNames
java.lang.String[] getToolEventNames()
Returns the names of all the possible ToolEvents that this tool might generate. Used by the ConnectionManager to connect tools together.
-
getConsumedToolEventNames
java.lang.String[] getConsumedToolEventNames()
Returns a list of eventNames that this Tool is interested in.
-
acceptDomainFiles
boolean acceptDomainFiles(DomainFile[] data)
When the user drags a data file onto a tool, an event will be fired that the tool will respond to by accepting the data.- Parameters:
data
- the data to be used by the running tool
-
getDomainFiles
DomainFile[] getDomainFiles()
Get the domain files that this tool currently has open.
-
addToolListener
void addToolListener(ToolListener listener)
Adds a ToolListener to be notified for any of a Tool's ToolEvents. The listener will be notified of any events that this tool generates.- Parameters:
listener
- ToolListener to be added to receive all events
-
removeToolListener
void removeToolListener(ToolListener listener)
Removes a ToolListener from receiving any event generated by this Tool. The tool will still recieve specific events that it has registered for.- Parameters:
listener
- The ToolListener to be removed from receiving all events.
-
addPropertyChangeListener
void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add property change listener.
-
removePropertyChangeListener
void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove property change listener.
-
getSupportedDataTypes
java.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.
-
saveDataStateToXml
org.jdom.Element saveDataStateToXml(boolean isTransactionState)
Tells tool to write its data state from the given output stream.- Parameters:
isTransactionState
- true if saving the toolstate is for a potential undo/redo (database transaction)
-
restoreDataStateFromXml
void restoreDataStateFromXml(org.jdom.Element element)
Tells tool to read its data state from the given input stream.- Parameters:
element
- XML data state
-
setIconURL
void setIconURL(ToolIconURL iconURL)
Set the icon for this tool.- Parameters:
iconURL
- icon location
-
getIconURL
ToolIconURL getIconURL()
Get the url for the icon that this tool is using.
-
getToolTemplate
ToolTemplate getToolTemplate(boolean includeConfigState)
Returns a ToolTemplate for this Tool that describes the state of the tool.- Returns:
- a ToolTemplate for this Tool that describes the state of the tool.
-
saveToolToToolTemplate
ToolTemplate saveToolToToolTemplate()
Save the tool and return its state as a ToolTemplate. Forces a complete regeneration of the tool template.- Returns:
- a toolTemplate for this tool.
-
saveWindowingDataToXml
org.jdom.Element saveWindowingDataToXml()
Saves the tool's Docking Window layout and positioning information to an XML element.- Returns:
- the element containing the DockingWindow's layout information.
-
restoreWindowingDataFromXml
void restoreWindowingDataFromXml(org.jdom.Element windowData)
Restores the tool's Docking Window layout and positioning information from an XML element.- Parameters:
windowData
- the element containing the information.
-
shouldSave
boolean shouldSave()
Returns true if this tool should save its data, based upon its changed state and the state of Ghidra's saving method.- Returns:
- true if this tool should save its data
-
saveToXml
org.jdom.Element saveToXml(boolean includeConfigState)
-
-