Package org.eclipse.jface.action
Class ExternalActionManager.CommandCallback
java.lang.Object
org.eclipse.jface.action.ExternalActionManager.CommandCallback
- All Implemented Interfaces:
ExternalActionManager.IBindingManagerCallback,ExternalActionManager.ICallback,ExternalActionManager.IExecuteCallback,IBindingManagerListener
- Enclosing class:
ExternalActionManager
public static class ExternalActionManager.CommandCallback
extends Object
implements IBindingManagerListener, ExternalActionManager.IBindingManagerCallback, ExternalActionManager.IExecuteCallback
A simple implementation of the
ICallback mechanism that
simply takes a BindingManager and a
CommandManager.
Note: this class is not intended to be subclassed by clients.
- Since:
- 3.1
-
Constructor Summary
ConstructorsConstructorDescriptionCommandCallback(BindingManager bindingManager, CommandManager commandManager) Constructs a new instance ofCommandCallbackwith the workbench it should be using.CommandCallback(BindingManager bindingManager, CommandManager commandManager, ExternalActionManager.IActiveChecker activeChecker) Constructs a new instance ofCommandCallbackwith the workbench it should be using.CommandCallback(BindingManager bindingManager, CommandManager commandManager, ExternalActionManager.IActiveChecker activeChecker, ExternalActionManager.IExecuteApplicable checker) Constructs a new instance ofCommandCallbackwith the workbench it should be using. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddPropertyChangeListener(String commandId, IPropertyChangeListener listener) Adds a listener to the object referenced byidentifier.final voidNotifies that attributes inside an instance ofBindingManagerhave changed.final IntegergetAccelerator(String commandId) An accessor for the accelerator associated with the item indicated by the identifier.final StringgetAcceleratorText(String commandId) An accessor for the accelerator text associated with the item indicated by the identifier.final TriggerSequence[]getActiveBindingsFor(String commandId) Returns the active bindings for a particular command identifier.final booleanisAcceleratorInUse(int accelerator) Checks to see whether the given accelerator is being used by some other mechanism (outside of the menus controlled by JFace).final booleanChecks whether the item matching this identifier is active.voidnotDefined(IAction action, NotDefinedException exception) Fires aNotDefinedExceptionbecause the action was not defined.voidnotEnabled(IAction action, NotEnabledException exception) Fires aNotEnabledExceptionbecause the action was not enabled.voidpostExecuteFailure(IAction action, ExecutionException exception) Creates anExecutionExceptionwhen the action returned a failure.voidpostExecuteSuccess(IAction action, Object returnValue) Fires an execution event when the action returned a success.voidpreExecute(IAction action, Event event) Fires an execution event before an action is run.final voidremovePropertyChangeListener(String commandId, IPropertyChangeListener listener) Removes a listener from the object referenced byidentifier.
-
Constructor Details
-
CommandCallback
Constructs a new instance ofCommandCallbackwith the workbench it should be using. All commands will be considered active.- Parameters:
bindingManager- The binding manager which will provide the callback; must not benull.commandManager- The command manager which will provide the callback; must not benull.- Since:
- 3.1
-
CommandCallback
public CommandCallback(BindingManager bindingManager, CommandManager commandManager, ExternalActionManager.IActiveChecker activeChecker) Constructs a new instance ofCommandCallbackwith the workbench it should be using.- Parameters:
bindingManager- The binding manager which will provide the callback; must not benull.commandManager- The command manager which will provide the callback; must not benull.activeChecker- The callback mechanism for checking whether a command is active; must not benull.- Since:
- 3.1
-
CommandCallback
public CommandCallback(BindingManager bindingManager, CommandManager commandManager, ExternalActionManager.IActiveChecker activeChecker, ExternalActionManager.IExecuteApplicable checker) Constructs a new instance ofCommandCallbackwith the workbench it should be using.- Parameters:
bindingManager- The binding manager which will provide the callback; must not benull.commandManager- The command manager which will provide the callback; must not benull.activeChecker- The callback mechanism for checking whether a command is active; must not benull.checker- The callback to check if an IAction should fire execution events.- Since:
- 3.4
-
-
Method Details
-
addPropertyChangeListener
Description copied from interface:ExternalActionManager.ICallbackAdds a listener to the object referenced by
identifier. This listener will be notified if a property of the item is to be changed. This identifier is specific to mechanism being used. In the case of the Eclipse workbench, this is the command identifier.Has no effect if an identical listener has already been added for the
identifier.- Specified by:
addPropertyChangeListenerin interfaceExternalActionManager.ICallback- Parameters:
commandId- The identifier of the item to which the listener should be attached; must not benull.listener- The listener to be added; must not benull.- See Also:
-
bindingManagerChanged
Description copied from interface:IBindingManagerListenerNotifies that attributes inside an instance ofBindingManagerhave changed. Specific details are described in theBindingManagerEvent. Changes in the binding manager can cause the set of defined or active schemes or bindings to change.- Specified by:
bindingManagerChangedin interfaceIBindingManagerListener- Parameters:
event- the binding manager event. Guaranteed not to benull.
-
getAccelerator
Description copied from interface:ExternalActionManager.ICallbackAn accessor for the accelerator associated with the item indicated by the identifier. This identifier is specific to mechanism being used. In the case of the Eclipse workbench, this is the command identifier.- Specified by:
getAcceleratorin interfaceExternalActionManager.ICallback- Parameters:
commandId- The identifier of the item from which the accelerator should be obtained ; must not benull.- Returns:
- An integer representation of the accelerator. This is the same accelerator format used by SWT.
- See Also:
-
getAcceleratorText
Description copied from interface:ExternalActionManager.ICallbackAn accessor for the accelerator text associated with the item indicated by the identifier. This identifier is specific to mechanism being used. In the case of the Eclipse workbench, this is the command identifier.- Specified by:
getAcceleratorTextin interfaceExternalActionManager.ICallback- Parameters:
commandId- The identifier of the item from which the accelerator text should be obtained ; must not benull.- Returns:
- A string representation of the accelerator. This is the string representation that should be displayed to the user.
- See Also:
-
getActiveBindingsFor
Returns the active bindings for a particular command identifier.- Specified by:
getActiveBindingsForin interfaceExternalActionManager.IBindingManagerCallback- Parameters:
commandId- The identifier of the command whose bindings are requested. This argument may benull. It is assumed that the command has no parameters.- Returns:
- The array of active triggers (
TriggerSequence) for a particular command identifier. This value is guaranteed not to benull, but it may be empty. - Since:
- 3.2
-
isAcceleratorInUse
public final boolean isAcceleratorInUse(int accelerator) Description copied from interface:ExternalActionManager.ICallbackChecks to see whether the given accelerator is being used by some other mechanism (outside of the menus controlled by JFace). This is used to keep JFace from trying to grab accelerators away from someone else.- Specified by:
isAcceleratorInUsein interfaceExternalActionManager.ICallback- Parameters:
accelerator- The accelerator to check -- in SWT's internal accelerator format.- Returns:
trueif the accelerator is already being used and shouldn't be used again;falseotherwise.- See Also:
-
isActive
Checks whether the item matching this identifier is active. This is used to decide whether a contribution item with this identifier should be made visible. An inactive item is not visible. Calling this method with an undefined command id will generate a log message.- Specified by:
isActivein interfaceExternalActionManager.ICallback- Parameters:
commandId- The identifier of the item from which the active state should be retrieved; must not benull.- Returns:
trueif the item is active;falseotherwise.
-
removePropertyChangeListener
Description copied from interface:ExternalActionManager.ICallbackRemoves a listener from the object referenced byidentifier. This identifier is specific to mechanism being used. In the case of the Eclipse workbench, this is the command identifier.- Specified by:
removePropertyChangeListenerin interfaceExternalActionManager.ICallback- Parameters:
commandId- The identifier of the item to from the listener should be removed; must not benull.listener- The listener to be removed; must not benull.- See Also:
-
preExecute
Description copied from interface:ExternalActionManager.IExecuteCallbackFires an execution event before an action is run.- Specified by:
preExecutein interfaceExternalActionManager.IExecuteCallback- Parameters:
action- The action contribution that requires an execution event to be fired. Cannot benull.event- The SWT Event, may benull.- Since:
- 3.4
-
postExecuteSuccess
Description copied from interface:ExternalActionManager.IExecuteCallbackFires an execution event when the action returned a success.- Specified by:
postExecuteSuccessin interfaceExternalActionManager.IExecuteCallback- Parameters:
action- The action contribution that requires an execution event to be fired. Cannot benull.returnValue- The command's result, may benull.- Since:
- 3.4
-
postExecuteFailure
Description copied from interface:ExternalActionManager.IExecuteCallbackCreates anExecutionExceptionwhen the action returned a failure.- Specified by:
postExecuteFailurein interfaceExternalActionManager.IExecuteCallback- Parameters:
action- The action contribution that caused the exception, nevernull.exception- TheExecutionException, nevernull.- Since:
- 3.4
-
notDefined
Description copied from interface:ExternalActionManager.IExecuteCallbackFires aNotDefinedExceptionbecause the action was not defined.- Specified by:
notDefinedin interfaceExternalActionManager.IExecuteCallback- Parameters:
action- The action contribution that caused the exception, nevernull.exception- TheNotDefinedException, nevernull.- Since:
- 3.4
-
notEnabled
Description copied from interface:ExternalActionManager.IExecuteCallbackFires aNotEnabledExceptionbecause the action was not enabled.- Specified by:
notEnabledin interfaceExternalActionManager.IExecuteCallback- Parameters:
action- The action contribution that caused the exception, nevernull.exception- TheNotEnabledException, nevernull.- Since:
- 3.4
-