public final class ExecutionEvent extends Object
The data object to pass to the command (and its handler) as it executes. This carries information about the current state of the application, and the application context in which the command was executed.
An execution event carries three blocks of data: the parameters, the trigger, and the application context. How these blocks are used is application dependent. In the Eclipse workbench, the trigger is an SWT event, and the application context contains information about the selection and active part.
Constructor and Description |
---|
ExecutionEvent()
Constructs a new instance of
ExecutionEvent with no
parameters, no trigger and no application context. |
ExecutionEvent(Command command,
Map parameters,
Object trigger,
Object applicationContext)
Constructs a new instance of
ExecutionEvent . |
ExecutionEvent(Map parameters,
Object trigger,
Object applicationContext)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Object |
getApplicationContext()
Returns the state of the application at the time the execution was
triggered.
|
Command |
getCommand()
Returns the command being executed.
|
Object |
getObjectParameterForExecution(String parameterId)
Returns the object represented by the string value of the parameter with
the provided id.
|
String |
getParameter(String parameterId)
Returns the value of the parameter with the given id.
|
Map |
getParameters()
Returns all of the parameters.
|
Object |
getTrigger()
Returns the object that triggered the execution
|
String |
toString()
The string representation of this execution event -- for debugging
purposes only.
|
public ExecutionEvent()
ExecutionEvent
with no
parameters, no trigger and no application context. This is just a
convenience method.public ExecutionEvent(Map parameters, Object trigger, Object applicationContext)
ExecutionEvent(Command, Map, Object, Object)
ExecutionEvent
.parameters
- The parameters to qualify the execution; must not be
null
. This must be a map of parameter ids (String
)
to parameter values (String
).trigger
- The object that triggered the execution; may be
null
.applicationContext
- The state of the application at the time the execution was
triggered; may be null
.public ExecutionEvent(Command command, Map parameters, Object trigger, Object applicationContext)
ExecutionEvent
.command
- The command being executed; may be null
.parameters
- The parameters to qualify the execution; must not be
null
. This must be a map of parameter ids (String
)
to parameter values (String
).trigger
- The object that triggered the execution; may be
null
.applicationContext
- The state of the application at the time the execution was
triggered; may be null
.public final Object getApplicationContext()
null
.public final Command getCommand()
public final Object getObjectParameterForExecution(String parameterId) throws ExecutionException
This is intended to be used in the scope of an
IHandler.execute(ExecutionEvent)
method, so any problem getting
the object value causes ExecutionException
to be thrown.
parameterId
- The id of a parameter to retrieve the object value of.ExecutionException
- if the parameter object value could not be obtained for any
reasonpublic final String getParameter(String parameterId)
parameterId
- The id of the parameter to retrieve; may be null
.null
if the parameter cannot
be found.public final Map getParameters()
null
, but may be empty.public final Object getTrigger()
null
if there was no trigger.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.