Package docking
Interface Tool
-
- All Superinterfaces:
ServiceProvider
- All Known Implementing Classes:
AbstractDockingTool
,FrontEndTool
,GhidraTool
,ModalPluginTool
,PluginTool
,StandAlonePluginTool
,TestFrontEndTool
,TestTool
public interface Tool extends ServiceProvider
Generic tool interface for managingComponentProvider
s andactions
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAction(DockingActionIf action)
Adds the action to the tool.void
addComponentProvider(ComponentProvider componentProvider, boolean show)
Adds the ComponentProvider to the tool, optionally making it visible.void
addContextListener(DockingContextListener listener)
Adds the given context listener to this toolvoid
addLocalAction(ComponentProvider componentProvider, DockingActionIf action)
Adds the action to the given provider as a local action.void
addPopupActionProvider(PopupActionProvider provider)
Adds the given popup action provider to this tool.void
clearStatusInfo()
Clear the status informationvoid
close()
Suggests the tool to attempt to close().void
contextChanged(ComponentProvider provider)
Signals to the tool that the provider's context has changed.ComponentProvider
getActiveComponentProvider()
Returns the active component provider, that which has focusjava.util.Set<DockingActionIf>
getAllActions()
Return a set of all actions in the tool.ComponentProvider
getComponentProvider(java.lang.String name)
Gets the ComponentProvider with the given name.ActionContext
getDefaultToolContext()
Returns the defaultActionContext
for the tool.java.util.Set<DockingActionIf>
getDockingActionsByOwnerName(java.lang.String owner)
Returns all actions for the given ownerjavax.swing.ImageIcon
getIcon()
Get the icon that the tool is usingjava.lang.String
getName()
Returns a combination of the tool name and the instance name of the form tool name(instance name), e.g., SomeTool(2)ToolOptions
getOptions(java.lang.String categoryName)
Get the options for the given category name; if no options exist with the given name, then one is created.java.awt.Window
getProviderWindow(ComponentProvider componentProvider)
Returns the parent window for the given providerDockingToolActions
getToolActions()
Returns the class that manages actions for the tool.DockingWindowManager
getWindowManager()
Returns the DockingWindowManger for this tool.boolean
hasConfigChanged()
Return true if the tool's configuration has changedboolean
isActive(ComponentProvider componentProvider)
Returns true if the ComponentProvider is the currently active provider.boolean
isVisible()
Returns true if tool is visibleboolean
isVisible(ComponentProvider componentProvider)
Returns true if the given ComponentProvider is currently visible.void
removeAction(DockingActionIf action)
Removes the given action from the tool.void
removeComponentProvider(ComponentProvider componentProvider)
Removes the given ComponentProvider from the tool.void
removeContextListener(DockingContextListener listener)
Removes the given context listener to this toolvoid
removeLocalAction(ComponentProvider componentProvider, DockingActionIf action)
Removes the action from the providervoid
removePopupActionProvider(PopupActionProvider provider)
Removes the given popup action providervoid
setConfigChanged(boolean changed)
Toggles the "change" state of the tool...void
setMenuGroup(java.lang.String[] menuPath, java.lang.String group, java.lang.String menuSubGroup)
Set the menu group associated with a cascaded submenu.void
setStatusInfo(java.lang.String text)
Set the status informationvoid
setStatusInfo(java.lang.String text, boolean beep)
Set the status informationvoid
setVisible(boolean visibility)
Sets the tool visible or invisible.void
showComponentProvider(ComponentProvider componentProvider, boolean visible)
Shows or hides the component provider in the toolvoid
showDialog(DialogComponentProvider dialogComponent)
Shows the dialog using the tool's root frame as a parent.void
toFront()
Brings this tool to the front.void
toFront(ComponentProvider componentProvider)
Makes the given ComponentProvider move to the front if it is tabbed with other components.void
updateTitle(ComponentProvider componentProvider)
Indicates to the tool that the given componentProvider's title has changed.-
Methods inherited from interface ghidra.framework.plugintool.ServiceProvider
addServiceListener, getService, removeServiceListener
-
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns a combination of the tool name and the instance name of the form tool name(instance name), e.g., SomeTool(2)- Returns:
- the tool name
-
isVisible
boolean isVisible()
Returns true if tool is visible- Returns:
- true if tool is visible
-
setVisible
void setVisible(boolean visibility)
Sets the tool visible or invisible. This method is used by the Project to make it's tools visible or invisible depending on whether this tool is in is the active workspace.- Parameters:
visibility
- true specifies that the tool should be visible
-
toFront
void toFront()
Brings this tool to the front. Places this tool at the top of the stacking order and shows it in front of any other tools.
-
getIcon
javax.swing.ImageIcon getIcon()
Get the icon that the tool is using- Returns:
- the icon that the tool is using
-
addComponentProvider
void addComponentProvider(ComponentProvider componentProvider, boolean show)
Adds the ComponentProvider to the tool, optionally making it visible.- Parameters:
componentProvider
- the provider to add to the toolshow
- if true, the component is made visible.
-
removeComponentProvider
void removeComponentProvider(ComponentProvider componentProvider)
Removes the given ComponentProvider from the tool. When a provider has been removed from the tool it is considered disposed and should not be reused.- Parameters:
componentProvider
- the provider to remove from the tool
-
getComponentProvider
ComponentProvider getComponentProvider(java.lang.String name)
Gets the ComponentProvider with the given name.- Parameters:
name
- the name of the provider to get- Returns:
- the provider
-
setStatusInfo
void setStatusInfo(java.lang.String text)
Set the status information- Parameters:
text
- non-html string to be displayed in the Status display area
-
setStatusInfo
void setStatusInfo(java.lang.String text, boolean beep)
Set the status information- Parameters:
text
- string to be displayed in the Status display areabeep
- whether to be or not
-
clearStatusInfo
void clearStatusInfo()
Clear the status information
-
setMenuGroup
void setMenuGroup(java.lang.String[] menuPath, java.lang.String group, java.lang.String menuSubGroup)
Set the menu group associated with a cascaded submenu. This allows a cascading menu item to be grouped with a specific set of actions.The default group for a cascaded submenu is the name of the submenu.
- Parameters:
menuPath
- menu name path where the last element corresponds to the specified group name.group
- group namemenuSubGroup
- the name used to sort the cascaded menu within other menu items at its level
-
addAction
void addAction(DockingActionIf action)
Adds the action to the tool.- Parameters:
action
- the action to be added.
-
removeAction
void removeAction(DockingActionIf action)
Removes the given action from the tool. When an action is removed from the tool it will be disposed and should not be reused.- Parameters:
action
- the action to be removed.
-
addLocalAction
void addLocalAction(ComponentProvider componentProvider, DockingActionIf action)
Adds the action to the given provider as a local action.- Parameters:
componentProvider
- the provider to add the action to.action
- the DockingAction to add to the componentProvider.
-
removeLocalAction
void removeLocalAction(ComponentProvider componentProvider, DockingActionIf action)
Removes the action from the provider- Parameters:
componentProvider
- the component provider from which to remove the action.action
- the action to remove.
-
addPopupActionProvider
void addPopupActionProvider(PopupActionProvider provider)
Adds the given popup action provider to this tool. This provider will be called each time the popup menu is about to be shown.- Parameters:
provider
- the provider
-
removePopupActionProvider
void removePopupActionProvider(PopupActionProvider provider)
Removes the given popup action provider- Parameters:
provider
- the provider
-
getAllActions
java.util.Set<DockingActionIf> getAllActions()
Return a set of all actions in the tool.Note: the result may contain conceptually duplicate actions, which is when multiple actions exist that share the same full name (the full name is the action name with the owner name, such as "My Action (MyPlugin)".
- Returns:
- set of all actions
-
getDockingActionsByOwnerName
java.util.Set<DockingActionIf> getDockingActionsByOwnerName(java.lang.String owner)
Returns all actions for the given ownerNote: the result may contain conceptually duplicate actions, which is when multiple actions exist that share the same full name (the full name is the action name with the owner name, such as "My Action (MyPlugin)".
- Parameters:
owner
- the action owner's name- Returns:
- the actions
-
getActiveComponentProvider
ComponentProvider getActiveComponentProvider()
Returns the active component provider, that which has focus- Returns:
- the active provider
-
showComponentProvider
void showComponentProvider(ComponentProvider componentProvider, boolean visible)
Shows or hides the component provider in the tool- Parameters:
componentProvider
- the provider to either show or hide.visible
- true to show the provider, false to hide it.
-
showDialog
void showDialog(DialogComponentProvider dialogComponent)
Shows the dialog using the tool's root frame as a parent. Also, remembers any size and location adjustments made by the user for the next time the dialog is shown.- Parameters:
dialogComponent
- the DialogComponentProvider object to be shown in a dialog.
-
getProviderWindow
java.awt.Window getProviderWindow(ComponentProvider componentProvider)
Returns the parent window for the given provider- Parameters:
componentProvider
- the provider- Returns:
- the window
-
toFront
void toFront(ComponentProvider componentProvider)
Makes the given ComponentProvider move to the front if it is tabbed with other components.- Parameters:
componentProvider
- the provider to move to the top of its stacking order.
-
isVisible
boolean isVisible(ComponentProvider componentProvider)
Returns true if the given ComponentProvider is currently visible.- Parameters:
componentProvider
- the provider to check for visibility.- Returns:
- true if the given ComponentProvider is currently visible.
-
isActive
boolean isActive(ComponentProvider componentProvider)
Returns true if the ComponentProvider is the currently active provider. The active provider is the provider that has keyboard focus and provides the current action context.- Parameters:
componentProvider
- the provider to check for active.- Returns:
- true if the ComponentProvider is the currently active provider.
-
updateTitle
void updateTitle(ComponentProvider componentProvider)
Indicates to the tool that the given componentProvider's title has changed.- Parameters:
componentProvider
- the componentProvider whose title has changed.
-
contextChanged
void contextChanged(ComponentProvider provider)
Signals to the tool that the provider's context has changed. This lets toolbar and menu actions update enablement based on current context.Pass
null
to signal that the entire tool's context has changed- Parameters:
provider
- the provider whose context changed; null to signal the tool's context
-
addContextListener
void addContextListener(DockingContextListener listener)
Adds the given context listener to this tool- Parameters:
listener
- the listener to add
-
removeContextListener
void removeContextListener(DockingContextListener listener)
Removes the given context listener to this tool- Parameters:
listener
- the listener to add
-
getWindowManager
DockingWindowManager getWindowManager()
Returns the DockingWindowManger for this tool.- Returns:
- the DockingWindowManger for this tool.
-
getOptions
ToolOptions getOptions(java.lang.String categoryName)
Get the options for the given category name; if no options exist with the given name, then one is created.- Parameters:
categoryName
- the category name- Returns:
- the options
-
setConfigChanged
void setConfigChanged(boolean changed)
Toggles the "change" state of the tool...- Parameters:
changed
- true indicates that the tool config has changed.
-
hasConfigChanged
boolean hasConfigChanged()
Return true if the tool's configuration has changed- Returns:
- true if the tool's configuration has changed
-
getToolActions
DockingToolActions getToolActions()
Returns the class that manages actions for the tool.Most clients will not need to use this methods. Instead, actions should be added to the tool via
addAction(DockingActionIf)
andaddLocalAction(ComponentProvider, DockingActionIf)
.- Returns:
- the action manager
-
close
void close()
Suggests the tool to attempt to close(). This will be as though the user selected the close menu option on the tool or hit the closeWindow x button in the upper corner (Windows systems).
-
getDefaultToolContext
ActionContext getDefaultToolContext()
Returns the defaultActionContext
for the tool. The default context is the context the default ComponentProvider for the tool.- Returns:
- the default
ActionContext
for the tool
-
-