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
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
ExternalActionManager.CommandCallback
public ExternalActionManager.CommandCallback(
BindingManager bindingManager,
CommandManager commandManager)
- Constructs a new instance of
CommandCallback
with the
workbench it should be using. All commands will be considered active.
-
Parameters:
-
bindingManager
- The binding manager which will provide the callback; must
not be null
. -
commandManager
- The command manager which will provide the callback; must
not be null
. -
Since:
- 3.1
ExternalActionManager.CommandCallback
public ExternalActionManager.CommandCallback(
BindingManager bindingManager,
CommandManager commandManager,
ExternalActionManager.IActiveChecker activeChecker)
- Constructs a new instance of
CommandCallback
with the
workbench it should be using.
-
Parameters:
-
bindingManager
- The binding manager which will provide the callback; must
not be null
. -
commandManager
- The command manager which will provide the callback; must
not be null
. -
activeChecker
- The callback mechanism for checking whether a command is
active; must not be null
. -
Since:
- 3.1
ExternalActionManager.CommandCallback
public ExternalActionManager.CommandCallback(
BindingManager bindingManager,
CommandManager commandManager,
ExternalActionManager.IActiveChecker activeChecker,
ExternalActionManager.IExecuteApplicable checker)
- Constructs a new instance of
CommandCallback
with the
workbench it should be using.
-
Parameters:
-
bindingManager
- The binding manager which will provide the callback; must
not be null
. -
commandManager
- The command manager which will provide the callback; must
not be null
. -
activeChecker
- The callback mechanism for checking whether a command is
active; must not be null
. -
checker
- The callback to check if an IAction should fire execution
events. -
Since:
- 3.4
addPropertyChangeListener
public final void addPropertyChangeListener(
String commandId,
IPropertyChangeListener listener)
-
Description copied from interface:
ExternalActionManager.ICallback
-
Adds 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:
-
addPropertyChangeListener
in interface
ExternalActionManager.ICallback
-
-
Parameters:
-
commandId
- The identifier of the item to which the listener should be
attached; must not be null
. -
listener
- The listener to be added; must not be null
. -
See Also:
-
ExternalActionManager.ICallback.addPropertyChangeListener(String, IPropertyChangeListener)
bindingManagerChanged
public final void bindingManagerChanged(
BindingManagerEvent event)
-
Description copied from interface:
IBindingManagerListener
- Notifies that attributes inside an instance of
BindingManager
have changed.
Specific details are described in the BindingManagerEvent
. Changes in the
binding manager can cause the set of defined or active schemes or bindings to change.
-
-
Specified by:
-
bindingManagerChanged
in interface
IBindingManagerListener
-
-
Parameters:
-
event
- the binding manager event. Guaranteed not to be null
.
getAccelerator
public final
Integer getAccelerator(
String commandId)
-
Description copied from interface:
ExternalActionManager.ICallback
- An 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:
-
getAccelerator
in interface
ExternalActionManager.ICallback
-
-
Parameters:
-
commandId
- The identifier of the item from which the accelerator
should be obtained ; must not be null
.
-
Returns:
- An integer representation of the accelerator. This is the
same accelerator format used by SWT.
-
See Also:
-
ExternalActionManager.ICallback.getAccelerator(String)
getAcceleratorText
public final
String getAcceleratorText(
String commandId)
-
Description copied from interface:
ExternalActionManager.ICallback
- An 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:
-
getAcceleratorText
in interface
ExternalActionManager.ICallback
-
-
Parameters:
-
commandId
- The identifier of the item from which the accelerator text
should be obtained ; must not be null
.
-
Returns:
- A string representation of the accelerator. This is the
string representation that should be displayed to the user.
-
See Also:
-
ExternalActionManager.ICallback.getAcceleratorText(String)
getActiveBindingsFor
public final
TriggerSequence[] getActiveBindingsFor(
String commandId)
- Returns the active bindings for a particular command identifier.
-
-
Specified by:
-
getActiveBindingsFor
in interface
ExternalActionManager.IBindingManagerCallback
-
-
Parameters:
-
commandId
- The identifier of the command whose bindings are
requested. This argument may be null
. 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 be null
, but it may be empty. -
Since:
- 3.2
isAcceleratorInUse
public final boolean isAcceleratorInUse(int accelerator)
-
Description copied from interface:
ExternalActionManager.ICallback
- Checks 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:
-
isAcceleratorInUse
in interface
ExternalActionManager.ICallback
-
-
Parameters:
-
accelerator
- The accelerator to check -- in SWT's internal accelerator
format.
-
Returns:
-
true
if the accelerator is already being used
and shouldn't be used again; false
otherwise. -
See Also:
-
ExternalActionManager.ICallback.isAcceleratorInUse(int)
isActive
public final boolean isActive(
String commandId)
- 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:
-
isActive
in interface
ExternalActionManager.ICallback
-
-
Parameters:
-
commandId
- The identifier of the item from which the active state
should be retrieved; must not be null
.
-
Returns:
-
true
if the item is active; false
otherwise.
removePropertyChangeListener
public final void removePropertyChangeListener(
String commandId,
IPropertyChangeListener listener)
-
Description copied from interface:
ExternalActionManager.ICallback
- Removes a listener from the object referenced by
identifier
. This identifier is specific to mechanism
being used. In the case of the Eclipse workbench, this is the command
identifier.
-
-
Specified by:
-
removePropertyChangeListener
in interface
ExternalActionManager.ICallback
-
-
Parameters:
-
commandId
- The identifier of the item to from the listener should be
removed; must not be null
. -
listener
- The listener to be removed; must not be null
. -
See Also:
-
ExternalActionManager.ICallback.removePropertyChangeListener(String, IPropertyChangeListener)
preExecute
public void preExecute(
IAction action,
Event event)
-
Description copied from interface:
ExternalActionManager.IExecuteCallback
- Fires an execution event before an action is run.
-
-
Specified by:
-
preExecute
in interface
ExternalActionManager.IExecuteCallback
-
-
Parameters:
-
action
- The action contribution that requires an
execution event to be fired. Cannot be null
. -
event
- The SWT Event, may be null
. -
Since:
- 3.4
postExecuteSuccess
public void postExecuteSuccess(
IAction action,
Object returnValue)
-
Description copied from interface:
ExternalActionManager.IExecuteCallback
- Fires an execution event when the action returned a success.
-
-
Specified by:
-
postExecuteSuccess
in interface
ExternalActionManager.IExecuteCallback
-
-
Parameters:
-
action
- The action contribution that requires an
execution event to be fired. Cannot be null
. -
returnValue
- The command's result, may be null
. -
Since:
- 3.4
postExecuteFailure
public void postExecuteFailure(
IAction action,
ExecutionException exception)
-
Description copied from interface:
ExternalActionManager.IExecuteCallback
- Creates an
ExecutionException
when the action returned
a failure.
-
-
Specified by:
-
postExecuteFailure
in interface
ExternalActionManager.IExecuteCallback
-
-
Parameters:
-
action
- The action contribution that caused the exception,
never null
. -
exception
- The ExecutionException
, never null
. -
Since:
- 3.4
notDefined
public void notDefined(
IAction action,
NotDefinedException exception)
-
Description copied from interface:
ExternalActionManager.IExecuteCallback
- Fires a
NotDefinedException
because the action was not
defined.
-
-
Specified by:
-
notDefined
in interface
ExternalActionManager.IExecuteCallback
-
-
Parameters:
-
action
- The action contribution that caused the exception,
never null
. -
exception
- The NotDefinedException
, never null
. -
Since:
- 3.4
notEnabled
public void notEnabled(
IAction action,
NotEnabledException exception)
-
Description copied from interface:
ExternalActionManager.IExecuteCallback
- Fires a
NotEnabledException
because the action was not
enabled.
-
-
Specified by:
-
notEnabled
in interface
ExternalActionManager.IExecuteCallback
-
-
Parameters:
-
action
- The action contribution that caused the exception,
never null
. -
exception
- The NotEnabledException
, never null
. -
Since:
- 3.4
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.