| org.eclipse.ui.handlers.IHandlerService
All known Subclasses: org.eclipse.ui.internal.handlers.HandlerService, org.eclipse.ui.internal.handlers.SlaveHandlerService,
IHandlerService | public interface IHandlerService extends IServiceWithSources(Code) | |
Provides services related to activating and deactivating handlers within the
workbench.
This interface is not intended to be implemented or extended by clients.
since: 3.1 |
Method Summary | |
public IHandlerActivation | activateHandler(IHandlerActivation activation)
Activates the given handler from a child service. | public IHandlerActivation | activateHandler(String commandId, IHandler handler)
Activates the given handler within the context of this service. | public IHandlerActivation | activateHandler(String commandId, IHandler handler, Expression expression)
Activates the given handler within the context of this service. | public IHandlerActivation | activateHandler(String commandId, IHandler handler, Expression expression, boolean global)
Activates the given handler within the context of this service. | public IHandlerActivation | activateHandler(String commandId, IHandler handler, Expression expression, int sourcePriorities)
Activates the given handler within the context of this service. | public ExecutionEvent | createExecutionEvent(Command command, Event event) Creates an execution event based on an SWT event. | public ExecutionEvent | createExecutionEvent(ParameterizedCommand command, Event event) Creates a parameterized execution event based on an SWT event and a
parameterized command. | public void | deactivateHandler(IHandlerActivation activation) Deactivates the given handler within the context of this service. | public void | deactivateHandlers(Collection activations) Deactivates the given handlers within the context of this service. | public Object | executeCommand(String commandId, Event event) Executes the command with the given identifier and no parameters.
Parameters: commandId - The identifier of the command to execute; must not benull . Parameters: event - The SWT event triggering the command execution; may benull . | public Object | executeCommand(ParameterizedCommand command, Event event) Executes the given parameterized command.
Parameters: command - The parameterized command to be executed; must not benull . Parameters: event - The SWT event triggering the command execution; may benull . | public IEvaluationContext | getCurrentState() Returns an evaluation context representing the current state of the
world. | public void | readRegistry()
Reads the handler information from the registry. | public void | setHelpContextId(IHandler handler, String helpContextId) Sets the help context identifier to associate with a particular handler. |
activateHandler | public IHandlerActivation activateHandler(IHandlerActivation activation)(Code) | |
Activates the given handler from a child service. This is used by slave
and nested services to promote handler activations up to the root. By
using this method, it is possible for handlers coming from a more nested
component to override the nested component.
Parameters: activation - The activation that is local to the child service; must not benull . A token which can be used to later cancel the activation. Onlysomeone with access to this token can cancel the activation. Theactivation will automatically be cancelled if the context fromwhich this service was retrieved is destroyed. This activation islocal to this service (i.e., it is not the activation that ispassed as a parameter). since: 3.2 |
activateHandler | public IHandlerActivation activateHandler(String commandId, IHandler handler)(Code) | |
Activates the given handler within the context of this service. If this
service was retrieved from the workbench, then this handler will be
active globally. If the service was retrieved from a nested component,
then the handler will only be active within that component.
Also, it is guaranteed that the handlers submitted through a particular
service will be cleaned up when that services is destroyed. So, for
example, a service retrieved from a IWorkbenchPartSite
would deactivate all of its handlers when the site is destroyed.
Parameters: commandId - The identifier for the command which this handler handles;must not be null . Parameters: handler - The handler to activate; must not be null . A token which can be used to later cancel the activation. Onlysomeone with access to this token can cancel the activation. Theactivation will automatically be cancelled if the context fromwhich this service was retrieved is destroyed. |
activateHandler | public IHandlerActivation activateHandler(String commandId, IHandler handler, Expression expression)(Code) | |
Activates the given handler within the context of this service. The
handler becomes active when expression evaluates to
true . This is the same as calling
IHandlerService.activateHandler(String,IHandler,Expression,boolean) with
global==false.
Also, it is guaranteed that the handlers submitted through a particular
service will be cleaned up when that services is destroyed. So, for
example, a service retrieved from a IWorkbenchPartSite
would deactivate all of its handlers when the site is destroyed.
Parameters: commandId - The identifier for the command which this handler handles;must not be null . Parameters: handler - The handler to activate; must not be null . Parameters: expression - This expression must evaluate to true beforethis handler will really become active. The expression may benull if the handler should always be active. A token which can be used to later cancel the activation. Onlysomeone with access to this token can cancel the activation. Theactivation will automatically be cancelled if the context fromwhich this service was retrieved is destroyed. See Also: org.eclipse.ui.ISources since: 3.2 |
activateHandler | public IHandlerActivation activateHandler(String commandId, IHandler handler, Expression expression, boolean global)(Code) | |
Activates the given handler within the context of this service. The
handler becomes active when expression evaluates to
true . if global==false , then this
handler service must also be the active service to active the handler.
For example, the handler service on a part is active when that part is
active.
Also, it is guaranteed that the handlers submitted through a particular
service will be cleaned up when that services is destroyed. So, for
example, a service retrieved from a IWorkbenchPartSite
would deactivate all of its handlers when the site is destroyed.
Parameters: commandId - The identifier for the command which this handler handles;must not be null . Parameters: handler - The handler to activate; must not be null . Parameters: expression - This expression must evaluate to true beforethis handler will really become active. The expression may benull if the handler should always be active. Parameters: global - Indicates that the handler should be activated irrespectivelyof whether the corresponding workbench component (e.g.,window, part, etc.) is active. A token which can be used to later cancel the activation. Onlysomeone with access to this token can cancel the activation. Theactivation will automatically be cancelled if the context fromwhich this service was retrieved is destroyed. See Also: org.eclipse.ui.ISources since: 3.2 |
activateHandler | public IHandlerActivation activateHandler(String commandId, IHandler handler, Expression expression, int sourcePriorities)(Code) | |
Activates the given handler within the context of this service. The
handler becomes active when expression evaluates to
true .
Also, it is guaranteed that the handlers submitted through a particular
service will be cleaned up when that services is destroyed. So, for
example, a service retrieved from a IWorkbenchPartSite
would deactivate all of its handlers when the site is destroyed.
Parameters: commandId - The identifier for the command which this handler handles;must not be null . Parameters: handler - The handler to activate; must not be null . Parameters: expression - This expression must evaluate to true beforethis handler will really become active. The expression may benull if the handler should always be active. Parameters: sourcePriorities - The source priorities for the expression. A token which can be used to later cancel the activation. Onlysomeone with access to this token can cancel the activation. Theactivation will automatically be cancelled if the context fromwhich this service was retrieved is destroyed. See Also: org.eclipse.ui.ISourcesIHandlerService.activateHandler(StringIHandlerExpression) |
createExecutionEvent | public ExecutionEvent createExecutionEvent(Command command, Event event)(Code) | | Creates an execution event based on an SWT event. This execution event
can then be passed to a command for execution.
Parameters: command - The command for which an execution event should be created;must not be null . Parameters: event - The SWT event triggering the command execution; may benull . An execution event suitable for callingCommand.executeWithChecks(ExecutionEvent). since: 3.2 See Also: Command.executeWithChecks(ExecutionEvent) |
createExecutionEvent | public ExecutionEvent createExecutionEvent(ParameterizedCommand command, Event event)(Code) | | Creates a parameterized execution event based on an SWT event and a
parameterized command. This execution event can then be passed to a
command for execution.
Parameters: command - The parameterized command for which an execution event shouldbe created; must not be null . Parameters: event - The SWT event triggering the command execution; may benull . An execution event suitable for callingCommand.executeWithChecks(ExecutionEvent). since: 3.2 See Also: ParameterizedCommand.getCommand See Also: Command.executeWithChecks(ExecutionEvent) |
deactivateHandler | public void deactivateHandler(IHandlerActivation activation)(Code) | | Deactivates the given handler within the context of this service. If the
handler was activated with a different service, then it must be
deactivated from that service instead. It is only possible to retract a
handler activation with this method. That is, you must have the same
IHandlerActivation used to activate the handler.
Parameters: activation - The token that was returned from a call toactivateHandler ; must not be null . |
deactivateHandlers | public void deactivateHandlers(Collection activations)(Code) | | Deactivates the given handlers within the context of this service. If the
handler was activated with a different service, then it must be
deactivated from that service instead. It is only possible to retract a
handler activation with this method. That is, you must have the same
IHandlerActivation used to activate the handler.
Parameters: activations - The tokens that were returned from a call toactivateHandler . This collection must onlycontain instances of IHandlerActivation . Thecollection must not be null . |
executeCommand | public Object executeCommand(String commandId, Event event) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException(Code) | | Executes the command with the given identifier and no parameters.
Parameters: commandId - The identifier of the command to execute; must not benull . Parameters: event - The SWT event triggering the command execution; may benull . The return value from the execution; may be null . throws: ExecutionException - If the handler has problems executing this command. throws: NotDefinedException - If the command you are trying to execute is not defined. throws: NotEnabledException - If the command you are trying to execute is not enabled. throws: NotHandledException - If there is no handler. since: 3.2 See Also: Command.executeWithChecks(ExecutionEvent) |
executeCommand | public Object executeCommand(ParameterizedCommand command, Event event) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException(Code) | | Executes the given parameterized command.
Parameters: command - The parameterized command to be executed; must not benull . Parameters: event - The SWT event triggering the command execution; may benull . The return value from the execution; may be null . throws: ExecutionException - If the handler has problems executing this command. throws: NotDefinedException - If the command you are trying to execute is not defined. throws: NotEnabledException - If the command you are trying to execute is not enabled. throws: NotHandledException - If there is no handler. since: 3.2 See Also: Command.executeWithChecks(ExecutionEvent) |
getCurrentState | public IEvaluationContext getCurrentState()(Code) | | Returns an evaluation context representing the current state of the
world. This is equivalent to the application context required by
ExecutionEvent .
the current state of the application; never null . See Also: ParameterizedCommand.executeWithChecks(ObjectObject) See Also: ExecutionEvent.ExecutionEvent(Commandjava.util.MapObjectObject) |
readRegistry | public void readRegistry()(Code) | |
Reads the handler information from the registry. This will overwrite any
of the existing information in the handler service. This method is
intended to be called during start-up. When this method completes, this
handler service will reflect the current state of the registry.
|
setHelpContextId | public void setHelpContextId(IHandler handler, String helpContextId)(Code) | | Sets the help context identifier to associate with a particular handler.
Parameters: handler - The handler with which to register a help context identifier;must not be null . Parameters: helpContextId - The help context identifier to register; may benull if the help context identifier should beremoved. since: 3.2 |
|
|