Lars, if you want to put a part into a dialog you should be able to use 
the rendering engine directly. The only requirement should be that the 
MPart's context is correctly initialized *before* you call 
'createGui(partComposite, part)'.

You'll need the appropriate MWindow's context and the rendering engine 
(get from the application context through 
IPresentationEngine.class.getName() )

1) Construct the context for the part using the MWindow's context as the 
parent and set it on the part
2) In the dialog's 'createContents' method create a Composite to host the 
Part.
3) call the rendering engine's two arg  'createGui', passing the composite 
and the part

The only problem I see is that we've extended the information the 
rendering engine populates a new context with quite a bit (i.e. we expose 
all interfaces like MUILabel, MContext.. to make them injectable). 
Depending on how much of this extra ;local' info your part needs you may 
have to add what you need to host the part into  its context yourself.

This leads me to wonder whether we should just add a 'parentContext' to 
the current two arg 'createGui' which would allow the part's context 
creation to go through the standard context creation code.

Let me know if you're having problems getting this to work, it should...
Eric




From:
Lars Vogel <[email protected]>
To:
E4 Project developer mailing list <[email protected]>
Date:
03/16/2010 10:24 PM
Subject:
Re: [e4-dev] Re-use of View in Dialog
Sent by:
[email protected]



Thank Remy, I'll give it a try .

2010/3/16 Remy Chi Jian Suen <[email protected]>:
> On Tue, Mar 16, 2010 at 10:01 PM, Lars Vogel <[email protected]> 
wrote:
>> one of the target of e4 was the flexibl re-use of component. I believe
>> I once saw an example where a view was re-used in a dialog.
>
> It should just be a matter of creating an MWindow and then moving the
> MPart over to the MWindow. You may have to force some layout calls but
> that's the basic gist of it.
>
> So first instantiate a new MWindow via the EMF factory, then attach it
> to the application (or as a child of your top-level window), this
> should cause a new Shell to be instantiated, if not you can ask the
> IPresentationEngine to create the window (engine.createGUI(mwindow),
> mwindow.getWidget() should be non-null). Then just add the MPart as a
> children to the MWindow.
>
> Regards,
> Remy
> _______________________________________________
> e4-dev mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/e4-dev
>



-- 
Lars
http://www.vogella.de - Tutorials about Java, Eclipse and Web programming
http://www.twitter.com/vogella - Lars on Twitter
_______________________________________________
e4-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/e4-dev


_______________________________________________
e4-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/e4-dev

Reply via email to