| Summary: | [e4] clicking on activation button in task list activates wrong task | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Steffen Pingel <steffen.pingel> | ||||
| Component: | Mylyn | Assignee: | Steffen Pingel <steffen.pingel> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | P3 | CC: | emoffatt, pwebster, remy.suen | ||||
| Version: | unspecified | ||||||
| Target Milestone: | 3.5 | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | 328165 | ||||||
| Bug Blocks: | 321278, 336432 | ||||||
| Attachments: |
|
||||||
|
Description
Steffen Pingel
This the code that programmatically invokes the command. Object is set to the task to be activated: EvaluationContext context = new EvaluationContext(service.getCurrentState(), object); context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, new StructuredSelection(object)); service.executeCommandInContext(new ParameterizedCommand(command, null), event, context); In the command handler the following code is invoked which gets the old selection of the task list which has the wrong task: selection = HandlerUtil.getCurrentSelection(event) It seems that LegacyHandlerService.executeCommandInContext() simply ignores the context since it does not extend LegacyEvalContext. Is there already an e4 bug for this? (In reply to comment #1) > Is there already an e4 bug for this? No, there isn't. Although Paul has changed some of those services recently so this might no longer be a problem. Please open one anyway. (In reply to comment #2) > Although Paul has changed some of those services recently so > this might no longer be a problem. Actually, looking at the code now, I don't think this is going to make a difference. You can try... IEvaluationContext context = context.createContextSnapshot(true); context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, new StructuredSelection(object)); service.executeCommandInContext(new ParameterizedCommand(command, null), event, context); (In reply to comment #3) > Actually, looking at the code now, I don't think this is going to make a > difference. You can try... Actually, no, this code is bad too. What do you exactly mean by "The selected task activated but not the clicked task as expected." anyway? The selection is not what you have clicked on? Created attachment 181209 [details]
fix
(In reply to comment #5) > Created an attachment (id=181209) [details] > fix That actually works? I am baffled. :o (In reply to comment #4) > (In reply to comment #3) > > Actually, looking at the code now, I don't think this is going to make a > > difference. You can try... > > Actually, no, this code is bad too. What do you exactly mean by "The selected > task activated but not the clicked task as expected." anyway? The selection is > not what you have clicked on? The selection that is set in the evaluation context is not what ends up in the command handler. Your suggestion worked perfectly. That way the created evaluation context actually extends the expected legacy class. Thanks! |