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(Tool tool, ActionToGuiHelper actionToGuiHelper)Construct an ActionManager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGlobalAction(DockingActionIf action)Adds the given action that is enabled, regardless of the active providervoidaddLocalAction(ComponentProvider provider, DockingActionIf action)Add an action that works specifically with a component provider.voiddispose()javax.swing.ActiongetAction(javax.swing.KeyStroke ks)java.util.Set<DockingActionIf>getActions(java.lang.String owner)Returns all actions with the given ownerjava.util.Set<DockingActionIf>getAllActions()Returns all actions known to the toolDockingActionIfgetLocalAction(ComponentProvider provider, java.lang.String actionName)Gets the provider action by the given namevoidpropertyChange(java.beans.PropertyChangeEvent evt)voidregisterSharedActionPlaceholder(SharedDockingActionPlaceholder placeholder)Allows clients to register an action by using a placeholder.voidremoveActions(ComponentProvider provider)Removes all local actions for the given providervoidremoveActions(java.lang.String owner)Removes all global actions for the given ownervoidremoveGlobalAction(DockingActionIf action)Removes the given global actionvoidremoveLocalAction(ComponentProvider provider, DockingActionIf action)Remove an action that works specifically with a component provider.voidrestoreKeyBindings()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(Tool 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:
addLocalActionin interfaceDockingToolActions- Parameters:
provider- provider associated with the actionaction- local action to the provider
-
addGlobalAction
public void addGlobalAction(DockingActionIf action)
Description copied from interface:DockingToolActionsAdds the given action that is enabled, regardless of the active provider- Specified by:
addGlobalActionin interfaceDockingToolActions- Parameters:
action- the action
-
removeGlobalAction
public void removeGlobalAction(DockingActionIf action)
Description copied from interface:DockingToolActionsRemoves the given global action- Specified by:
removeGlobalActionin interfaceDockingToolActions- Parameters:
action- the action
-
removeActions
public void removeActions(java.lang.String owner)
Description copied from interface:DockingToolActionsRemoves all global actions for the given owner- Specified by:
removeActionsin interfaceDockingToolActions- Parameters:
owner- the owner
-
getActions
public java.util.Set<DockingActionIf> getActions(java.lang.String owner)
Description copied from interface:DockingToolActionsReturns all actions with the given owner- Specified by:
getActionsin interfaceDockingToolActions- Parameters:
owner- the owner- Returns:
- the actions
-
getAllActions
public java.util.Set<DockingActionIf> getAllActions()
Description copied from interface:DockingToolActionsReturns all actions known to the tool- Specified by:
getAllActionsin interfaceDockingToolActions- Returns:
- the 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:
removeLocalActionin interfaceDockingToolActions- Parameters:
provider- provider associated with the actionaction- local action to the provider
-
removeActions
public void removeActions(ComponentProvider provider)
Description copied from interface:DockingToolActionsRemoves all local actions for the given provider- Specified by:
removeActionsin interfaceDockingToolActions- Parameters:
provider- the provider
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
getLocalAction
public DockingActionIf getLocalAction(ComponentProvider provider, java.lang.String actionName)
Description copied from interface:DockingToolActionsGets the provider action by the given name- Specified by:
getLocalActionin interfaceDockingToolActions- Parameters:
provider- the provideractionName- the action name- Returns:
- the action
-
getAction
public javax.swing.Action getAction(javax.swing.KeyStroke ks)
-
registerSharedActionPlaceholder
public void registerSharedActionPlaceholder(SharedDockingActionPlaceholder placeholder)
Allows clients to register an action by using a placeholder. This is useful when an API wishes to have a central object (like a plugin) register actions for transient providers, that may not be loaded until needed.This method may be called multiple times with the same conceptual placeholder--the placeholder will only be added once.
- Specified by:
registerSharedActionPlaceholderin interfaceDockingToolActions- Parameters:
placeholder- the placeholder containing information related to the action it represents
-
-