Package org.eclipse.core.commands
Interface IHandler
- All Known Subinterfaces:
IHandler2
- All Known Implementing Classes:
AbstractEnabledHandler
,AbstractEvaluationHandler
,AbstractHandler
,AbstractHandlerWithState
,ActionHandler
,ActivateEditorHandler
,CloseAllHandler
,CloseEditorHandler
,CloseHelpTrayHandler
,CloseOthersHandler
,CollapseAllHandler
,CompareWithOtherResourceHandler
,CycleEditorHandler
,CyclePerspectiveHandler
,CycleViewHandler
,DebugCommandHandler
,ExpandAllHandler
,FileBufferOperationHandler
,FilteredTableBaseHandler
,HandlerServiceHandler
,MarkerViewHandler
,MergeActionHandler
,NewPropertySheetHandler
,ShowInHandler
,ShowPartPaneMenuHandler
,ShowPerspectiveHandler
,ShowViewHandler
,ShowViewMenuHandler
,SplitHandler
,TextZoomInHandler
,TextZoomOutHandler
,WorkbenchEditorsHandler
,WorkbenchHandlerServiceHandler
,WorkbookEditorsHandler
public interface IHandler
A handler is the pluggable piece of a command that handles execution. Each
command can have zero or more handlers associated with it (in general), of
which only one will be active at any given moment in time. When the command
is asked to execute, it will simply pass that request on to its active
handler, if any.
- Since:
- 3.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addHandlerListener
(IHandlerListener handlerListener) Registers an instance ofIHandlerListener
to listen for changes to properties of this instance.void
dispose()
Disposes of this handler.execute
(ExecutionEvent event) Executes with the map of parameter values by name.default String
Return the label for this handler.boolean
Returns whether this handler is capable of executing at this moment in time.boolean
Returns whether this handler is really capable of handling delegation.void
removeHandlerListener
(IHandlerListener handlerListener) Unregisters an instance ofIHandlerListener
listening for changes to properties of this instance.
-
Method Details
-
addHandlerListener
Registers an instance ofIHandlerListener
to listen for changes to properties of this instance.- Parameters:
handlerListener
- the instance to register. Must not benull
. If an attempt is made to register an instance which is already registered with this instance, no operation is performed.
-
dispose
void dispose()Disposes of this handler. This method is run once when the object is no longer referenced. This can be used as an opportunity to unhook listeners from other objects. -
execute
Executes with the map of parameter values by name.- Parameters:
event
- An event containing all the information about the current state of the application; must not benull
.- Returns:
- the result of the execution. Reserved for future use, must be
null
. - Throws:
ExecutionException
- if an exception occurred during execution.
-
isEnabled
boolean isEnabled()Returns whether this handler is capable of executing at this moment in time. If the enabled state is other than true clients should also consider implementing IHandler2 so they can be notified about framework execution contexts.- Returns:
true
if the command is enabled;false
otherwise.- See Also:
-
isHandled
boolean isHandled()Returns whether this handler is really capable of handling delegation. In the case of a handler that is a composition of other handlers, this reply is intended to indicate whether the handler is truly capable of receiving delegated responsibilities at this time.- Returns:
true
if the handler is handled;false
otherwise.
-
removeHandlerListener
Unregisters an instance ofIHandlerListener
listening for changes to properties of this instance.- Parameters:
handlerListener
- the instance to unregister. Must not benull
. If an attempt is made to unregister an instance which is not already registered with this instance, no operation is performed.
-
getHandlerLabel
Return the label for this handler. The handler can implement this method to provide a more dynamic label according to the actual action that is performed. When returning null, callers may instead use the invoking command label or a generic label.- Returns:
- name of the Handler, can be null
- Since:
- 3.12
-