Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Adding a Part from another plug-in to a Perspective
Adding a Part from another plug-in to a Perspective [message #791932] Mon, 06 February 2012 12:36 Go to next message
Christoph Keimel is currently offline Christoph Keimel
Messages: 354
Registered: December 2010
Location: Germany
Senior Member
Hello

Please consider the following architecture of plug-ins:
- app
- contrib.a
- contrib.b

app ist the basic application. It has a TrimmedWindow, a PerspectiveStack and a basic Perspective with a PartStack (stack.main) in its application model.

contrib.a contributes a Part (contrib.a.part) to be shown in the main PartStack (stack.main).

contrib.b contributes a second perspective to the PerspectiveStack. This Perspective also wants to use the Part (contrib.a.part) contributed in contrib.a.

Could you please advice me on how to best share parts in this way.

Thank you!
Christoph


Re: Adding a Part from another plug-in to a Perspective [message #791959 is a reply to message #791932] Mon, 06 February 2012 13:11 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5331
Registered: July 2009
Senior Member
To share a part instance between stacks you need to contribute the MPart
to the sharedElements of the MTrimmedWindow and *link* them into the
Stack using MPlaceholder!

If the Part is contributed through contrib.a you need to add a
dependency to it in contrib.b's MANIFEST.MF to ensure the contrib.a
fragment is merged before contrib.b.

To reference an Element in contrib.b inside the Placeholder you need to
"import" it into the fragment. I've just tried this and it gives me an
exception in the editor :-(

I've logged https://bugs.eclipse.org/bugs/show_bug.cgi?id=370713

Tom

Am 06.02.12 13:36, schrieb Christoph Keimel:
> Hello
>
> Please consider the following architecture of plug-ins:
> - app
> - contrib.a
> - contrib.b
>
> app ist the basic application. It has a TrimmedWindow, a
> PerspectiveStack and a basic Perspective with a PartStack (stack.main)
> in its application model.
> contrib.a contributes a Part (contrib.a.part) to be shown in the main
> PartStack (stack.main).
>
> contrib.b contributes a second perspective to the PerspectiveStack. This
> Perspective also wants to use the Part (contrib.a.part) contributed in
> contrib.a.
>
> Could you please advice me on how to best share parts in this way.
>
> Thank you!
> Christoph
>
>
>
Re: Adding a Part from another plug-in to a Perspective [message #791984 is a reply to message #791932] Mon, 06 February 2012 13:40 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph Keimel
Messages: 354
Registered: December 2010
Location: Germany
Senior Member
Hi Tom

Thanks for the quick reply. I wanted to verify the bug you posted.

Contributing to the sharedElements in contrib.a works. I can also use a Placeholder to add the Part to a PartStack in contrib.a.

I can then add a Part from contrib.a to the Imports-Node in contrib.b. I can also find the ID of the Part I want to import. I run into Problems when I want to create the Placeholder: Unfortunately I can not see this Part when I press the "Find..." button next to the "Reference" attribute.

I don't get an exception though either. Maybe my XMI-Editor is too old (from /e4/updates/0.11)?

Is it possible to manually add the reference in the XMI to the <children xsi:type="advanced:Placeholder" ... > element?

Greetings
Christoph
Re: Adding a Part from another plug-in to a Perspective [message #791996 is a reply to message #791984] Mon, 06 February 2012 13:49 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5331
Registered: July 2009
Senior Member
It's exactly that Exception that I describe in the bug. The "Find ..."
button in the PlaceHolder-Editor is none functional.

You can naturally edit the file manually I guess the XMI-Definition has
to look like this:

<imports xsi:type="basic:Part" xmi:id="_UtzqgFDDEeG1afXU1XNLJA"
elementId="fff"/>
.....
<children xsi:type="advanced:Placeholder"
xmi:id="_QWfsAFDDEeG1afXU1XNLJA" ref="_UtzqgFDDEeG1afXU1XNLJA"/>

where the value of ref is the element from the imports above.

Tom

Am 06.02.12 14:40, schrieb Christoph Keimel:
> Hi Tom
>
> Thanks for the quick reply. I wanted to verify the bug you posted.
>
> Contributing to the sharedElements in contrib.a works. I can also use a
> Placeholder to add the Part to a PartStack in contrib.a.
>
> I can then add a Part from contrib.a to the Imports-Node in contrib.b. I
> can also find the ID of the Part I want to import. I run into Problems
> when I want to create the Placeholder: Unfortunately I can not see this
> Part when I press the "Find..." button next to the "Reference" attribute.
> I don't get an exception though either. Maybe my XMI-Editor is too old
> (from /e4/updates/0.11)?
>
> Is it possible to manually add the reference in the XMI to the <children
> xsi:type="advanced:Placeholder" ... > element?
> Greetings
> Christoph
Re: Adding a Part from another plug-in to a Perspective [message #792039 is a reply to message #791996] Mon, 06 February 2012 14:40 Go to previous message
Christoph Keimel is currently offline Christoph Keimel
Messages: 354
Registered: December 2010
Location: Germany
Senior Member
Hi Tom,

thanks again! Now my perspectives are up and running.

Christoph
Previous Topic:Adding an new Perspective in a fragment
Next Topic:Error adding a part
Goto Forum:
  


Current Time: Mon Sep 22 08:26:19 GMT 2014

Powered by FUDForum. Page generated in 0.02562 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software