| Summary: | ExecutionEvent trigger is not passed on to handler | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Jesper Eskilson <jesper.eskilson> |
| Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | bsd, david, pwebster |
| Version: | 4.2.1 | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
Calling the Command object directly is not really supported, as it's a low level API that's used to implement the workbench behaviour (and as you're seeing, the workbench can implement things differently). But I think I might have a fix for this in Kepler. PW Well, one solution would be to allow arbitrary objects in the "parameters" map, and not restrict it to strings. Anyway, I kludged around this by passing a unique key into a static map as a parameter instead. The handler can then retrieve the actual object by looking up the key in the map. I'd be glad if I could some day get rid of that kludge. *** Bug 487130 has been marked as a duplicate of this bug. *** I think this can be accomplished by modifying HandlerServiceHandler#execute() to pass along the trigger in the staticContext, and E4HandlerProxy and HandlerServiceImpl to pull the trigger out. Currently E4HandlerProxy and LegacyHandlerService assume the trigger is only an SWT Event. I just tested if it would work if I wrap my trigger in a SWTEventObject, unfortunately it doesn't work. Is there any other workaround for now? I just realized now, that the parameters get lost as well. I tried Jesper Eskilsons workaround but the parameter map is always empty in the ExecutionEvent of the execute-Method. I guess this is a bug as well. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
I'm invoking a Command programmatically like this: Object myTrigger = ... ICommandService cs = ... Command cmd = cs.getCommand(id) ExecutionEvent event = new ExecutionEvent(cmd, Collections.emptyMap(), myTrigger, null); cmd.executeWithChecks(event); In the handler I retrieve the trigger like this: @Override public Object execute(ExecutionEvent event) throws ExecutionException { Object myTrigger = event.getTrigger(); // myTrigger is now null } In Indigo this worked fine (I get the same object as specified in the ExecutionEvent), but in Juno, getTrigger() returns null in the handler. I tried to follow the path of the event object, but I got lost deep in the e4 compatibility layers. The API docs for ExecutionEvent seems to indicate that using the trigger like this is ok: "How these blocks are used is application dependent".