Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360815 - [Compatibility] Cannot retrieve model item from within a legacy handler
Summary: [Compatibility] Cannot retrieve model item from within a legacy handler
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-13 09:12 EDT by Remy Suen CLA
Modified: 2019-05-30 00:14 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2011-10-13 09:12:20 EDT
If I have a legacy handler that gets invoked by E4HandlerProxy and I try to use HandlerUtil.getVariable(executionEvent, MItem.class.getName()) to get the model element, 'null' is returned. Is this the expected behaviour?
Comment 1 Paul Webster CLA 2011-10-26 13:18:15 EDT
To avoid churn and relatively unscoped naming collision, the MItem that is executing a command is passed in using a static IEclipseContext.

That means it's available for @Execute, but not in the application context as provided in the ExecutionEvent.

See org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(Event)

PW
Comment 2 Paul Webster CLA 2011-11-02 14:25:21 EDT
I'm not sure what's the best way to expose this, or if we should even try.

One option: if you are using a 3.x handler, you can't really extract the model (you might get little bits, like the MApplication, but other than that we won't promise anything).

Another option: we re-route the MItem and somehow "front" is as a UIElement for IElementUpdaters.

PW
Comment 3 Eclipse Genie CLA 2019-05-30 00:14:02 EDT
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.

If you have further information on the current state of the bug, please add it. 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.