Package org.eclipse.core.commands
Class ExecutionEvent
java.lang.Object
org.eclipse.core.commands.ExecutionEvent
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.
- Since:
- 3.1
-
Constructor Summary
ConstructorDescriptionConstructs a new instance ofExecutionEvent
with no parameters, no trigger and no application context.ExecutionEvent
(Map parameters, Object trigger, Object applicationContext) Deprecated.ExecutionEvent
(Command command, Map parameters, Object trigger, Object applicationContext) Constructs a new instance ofExecutionEvent
. -
Method Summary
Modifier and TypeMethodDescriptionfinal Object
Returns the state of the application at the time the execution was triggered.final Command
Returns the command being executed.final Object
getObjectParameterForExecution
(String parameterId) Returns the object represented by the string value of the parameter with the provided id.final String
getParameter
(String parameterId) Returns the value of the parameter with the given id.final Map
Returns all of the parameters.final Object
Returns the object that triggered the executionfinal String
toString()
The string representation of this execution event -- for debugging purposes only.
-
Constructor Details
-
ExecutionEvent
public ExecutionEvent()Constructs a new instance ofExecutionEvent
with no parameters, no trigger and no application context. This is just a convenience method.- Since:
- 3.2
-
ExecutionEvent
Deprecated.Constructs a new instance ofExecutionEvent
.- Parameters:
parameters
- The parameters to qualify the execution; must not benull
. This must be a map of parameter ids (String
) to parameter values (String
).trigger
- The object that triggered the execution; may benull
.applicationContext
- The state of the application at the time the execution was triggered; may benull
.
-
ExecutionEvent
Constructs a new instance ofExecutionEvent
.- Parameters:
command
- The command being executed; may benull
.parameters
- The parameters to qualify the execution; must not benull
. This must be a map of parameter ids (String
) to parameter values (String
).trigger
- The object that triggered the execution; may benull
.applicationContext
- The state of the application at the time the execution was triggered; may benull
.- Since:
- 3.2
-
-
Method Details
-
getApplicationContext
Returns the state of the application at the time the execution was triggered.- Returns:
- The application context; may be
null
.
-
getCommand
Returns the command being executed.- Returns:
- The command being executed.
- Since:
- 3.2
-
getObjectParameterForExecution
Returns the object represented by the string value of the parameter with the provided id.This is intended to be used in the scope of an
IHandler.execute(ExecutionEvent)
method, so any problem getting the object value causesExecutionException
to be thrown.- Parameters:
parameterId
- The id of a parameter to retrieve the object value of.- Returns:
- The object value of the parameter with the provided id.
- Throws:
ExecutionException
- if the parameter object value could not be obtained for any reason- Since:
- 3.2
-
getParameter
Returns the value of the parameter with the given id.- Parameters:
parameterId
- The id of the parameter to retrieve; may benull
.- Returns:
- The parameter value;
null
if the parameter cannot be found.
-
getParameters
Returns all of the parameters.- Returns:
- The parameters; never
null
, but may be empty.
-
getTrigger
Returns the object that triggered the execution- Returns:
- The trigger;
null
if there was no trigger.
-
toString
The string representation of this execution event -- for debugging purposes only. This string should not be shown to an end user.
-
ExecutionEvent(Command, Map, Object, Object)