Package docking.actions
Class ToolActions
- java.lang.Object
-
- docking.actions.ToolActions
-
- All Implemented Interfaces:
DockingToolActions
,java.beans.PropertyChangeListener
,java.util.EventListener
public class ToolActions extends java.lang.Object implements DockingToolActions, java.beans.PropertyChangeListener
An class to manage actions registered with the tool
-
-
Constructor Summary
Constructors Constructor Description ToolActions(DockingTool tool, ActionToGuiHelper actionToGuiHelper)
Construct an ActionManager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGlobalAction(DockingActionIf action)
Adds the given action that is enabled, regardless of the active providervoid
addLocalAction(ComponentProvider provider, DockingActionIf action)
Add an action that works specifically with a component provider.void
dispose()
javax.swing.Action
getAction(javax.swing.KeyStroke ks)
java.util.Set<DockingActionIf>
getActions(java.lang.String owner)
Get all actions for the given ownerjava.util.Set<DockingActionIf>
getAllActions()
Get a set of all actions in the toolDockingActionIf
getLocalAction(ComponentProvider provider, java.lang.String actionName)
Gets the provider action by the given namevoid
propertyChange(java.beans.PropertyChangeEvent evt)
void
removeActions(ComponentProvider provider)
Removes all local actions for the given providervoid
removeActions(java.lang.String owner)
Removes all global actions for the given ownervoid
removeGlobalAction(DockingActionIf action)
Removes the given action from the toolvoid
removeLocalAction(ComponentProvider provider, DockingActionIf action)
Remove an action that works specifically with a component provider.void
restoreKeyBindings()
Get the keybindings for each action so that they are still registered as being used; otherwise the options will be removed because they are noted as not being used.
-
-
-
Constructor Detail
-
ToolActions
public ToolActions(DockingTool tool, ActionToGuiHelper actionToGuiHelper)
Construct an ActionManager- Parameters:
tool
- tool using this ActionManageractionToGuiHelper
- the class that takes actions and maps them to GUI widgets
-
-
Method Detail
-
dispose
public void dispose()
-
addLocalAction
public void addLocalAction(ComponentProvider provider, DockingActionIf action)
Add an action that works specifically with a component provider.- Specified by:
addLocalAction
in interfaceDockingToolActions
- Parameters:
provider
- provider associated with the actionaction
- local action to the provider
-
addGlobalAction
public void addGlobalAction(DockingActionIf action)
Description copied from interface:DockingToolActions
Adds the given action that is enabled, regardless of the active provider- Specified by:
addGlobalAction
in interfaceDockingToolActions
- Parameters:
action
- the action
-
removeGlobalAction
public void removeGlobalAction(DockingActionIf action)
Removes the given action from the tool- Specified by:
removeGlobalAction
in interfaceDockingToolActions
- Parameters:
action
- the action to be removed.
-
removeActions
public void removeActions(java.lang.String owner)
Description copied from interface:DockingToolActions
Removes all global actions for the given owner- Specified by:
removeActions
in interfaceDockingToolActions
- Parameters:
owner
- the owner
-
getActions
public java.util.Set<DockingActionIf> getActions(java.lang.String owner)
Get all actions for the given owner- Specified by:
getActions
in interfaceDockingToolActions
- Parameters:
owner
- owner of the actions- Returns:
- array of actions; zero length array is returned if no action exists with the given name
-
getAllActions
public java.util.Set<DockingActionIf> getAllActions()
Get a set of all actions in the tool- Specified by:
getAllActions
in interfaceDockingToolActions
- Returns:
- a new set of the existing actions
-
restoreKeyBindings
public void restoreKeyBindings()
Get the keybindings for each action so that they are still registered as being used; otherwise the options will be removed because they are noted as not being used.
-
removeLocalAction
public void removeLocalAction(ComponentProvider provider, DockingActionIf action)
Remove an action that works specifically with a component provider.- Specified by:
removeLocalAction
in interfaceDockingToolActions
- Parameters:
provider
- provider associated with the actionaction
- local action to the provider
-
removeActions
public void removeActions(ComponentProvider provider)
Description copied from interface:DockingToolActions
Removes all local actions for the given provider- Specified by:
removeActions
in interfaceDockingToolActions
- Parameters:
provider
- the provider
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
getLocalAction
public DockingActionIf getLocalAction(ComponentProvider provider, java.lang.String actionName)
Description copied from interface:DockingToolActions
Gets the provider action by the given name- Specified by:
getLocalAction
in interfaceDockingToolActions
- Parameters:
provider
- the provideractionName
- the action name- Returns:
- the action
-
getAction
public javax.swing.Action getAction(javax.swing.KeyStroke ks)
-
-