Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328165 - Custom evaluation contexts are not passed to command handler
Summary: Custom evaluation contexts are not passed to command handler
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.1 RC4   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 328091
  Show dependency tree
 
Reported: 2010-10-19 13:43 EDT by Steffen Pingel CLA
Modified: 2011-06-21 12:27 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Pingel CLA 2010-10-19 13:43:47 EDT
Mylyn has the following code that programmatically invokes a command:

 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 to retrieve the current selection:

 selection = HandlerUtil.getCurrentSelection(event)

This selection is different from the selection that was set on the context using addVariable(). It seems that LegacyHandlerService.executeCommandInContext() ignores the context since it does not extend LegacyEvalContext.

Eclipse SDK 4.1M2: I20100922-0843
Comment 1 Steffen Pingel CLA 2010-10-19 14:13:53 EDT
For Mylyn we fixed it by using IHandlerService.createContextSnapshot(false) instead of constructing an EvaulationContext directly.
Comment 2 Remy Suen CLA 2011-06-20 16:17:22 EDT
Paul, I think we fixed this with bug 333506? Though I suppose there's also bug 349721 to consider.
Comment 3 Paul Webster CLA 2011-06-21 12:27:49 EDT
Fixed by bug 333506

PW