Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318619 - [UI] createGui should also supply the parent context as well as the Composite
Summary: [UI] createGui should also supply the parent context as well as the Composite
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.0 RC2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-01 10:49 EDT by Eric Moffatt CLA
Modified: 2010-07-24 18:04 EDT (History)
4 users (show)

See Also:


Attachments
Extend createGui with a third parameter 'parentContext' (18.82 KB, patch)
2010-07-05 16:05 EDT, Eric Moffatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Moffatt CLA 2010-07-01 10:49:19 EDT
The current 'createGui(MUIElement element, Object parent)' should have a third element which is the parent context within which the rendering should happen.

The idea of that API is to be able to render 'local' elements (i.e. ones that aren't directly connected to the model such as an MPart in a dialog...). When I tried to do this with an MToolControl we ended up with a 'null' parent context because the model element really has no parent (its 'eContainer' is null).

This would require a change to the IPresentationEngine's API but I think it's well worth it.
Comment 1 Thomas Schindl CLA 2010-07-01 11:00:33 EDT
The other idea that comes to my mind is to add an Dialog-Element to our model which would act as the container. Dialogs are themselves children of a Window.
Comment 2 Thomas Schindl CLA 2010-07-01 11:01:57 EDT
... beside that I guess we don't have too many customers yet for the PresentationEngine, so its unlikely we break existing customers
Comment 3 Thomas Schindl CLA 2010-07-01 11:51:00 EDT
After having discussed this with Eric on IRC I'm +1 if this makes implementing the MToolControl, ... easier. 

I'd still like us to think about the MDialog proposal to bring the Dialogs into our Model (probably it could help us with Keybindings, ...?)
Comment 4 Eric Moffatt CLA 2010-07-05 16:05:54 EDT
Created attachment 173477 [details]
Extend createGui with a third parameter 'parentContext'


I've scraped all of the code that I can see but there may be other bundles that were using the old API. If so you are likely ok to pass null unless the element you're creating *is* an MContext. If the element you're calling creatGui on is in the model structure then you should also be able to use the EModelService's context methods to determine the correct parent context for the element you're trying to render and pass it.
Comment 5 Eric Moffatt CLA 2010-07-05 16:19:52 EDT
Committed in >20100705. Applied the patch.
Comment 6 Eric Moffatt CLA 2010-07-05 16:22:01 EDT
Note that the above fix is only partial. It moves what we had over to using the new API but the various renderers are still using code to 'find' the parent context rather than using the one originally supplied to the 'createGui' call).

Eventually we should have *no* renderer that uses anything except what gets passed in to it...
Comment 7 Boris Bokowski CLA 2010-07-24 18:02:02 EDT
(In reply to comment #5)
> Committed in >20100705. Applied the patch.

Marking as fixed.
Comment 8 Boris Bokowski CLA 2010-07-24 18:04:16 EDT
(In reply to comment #6)
> Note that the above fix is only partial.

Filed bug 320830 for this.