Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to use MPartDescriptor
How to use MPartDescriptor [message #805968] Fri, 24 February 2012 11:02 Go to next message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
I am not sure, but I think the EPartService API has changed from 4.1 to 4.2. At least I don't remember that in 4.1 this service already had the methods createSharedPart.

Anyway, I do know how to define an MPartDescriptor. In 4.1 an MPart for this descriptor was created with EPartService.createPart(id), where id is the identifier of the MPartDescriptor. This part can be found again with EPartService.findPart(id) -- if there is only one.

I don't know whether this is still the way to go with 4.2. The problem is, that one may need do create more than one MPart for one MPartDescriptor. An editor may be one example: one may want to edit different instances of one and the same kind.

Then one is not able to find the MPart corresponding to one particular instance with the id of the MPartDescriptor -- maybe there are more parts with the same id but with different "content". One way to go is using EPartService.getParts() which unfortunately will return all MParts, not only those corresponding to one particular MPartDescriptor. Then one would need to check, whether there is one MPart for the particular MPartDescriptor having a particular "content".

So something is missing that will find an MPart for a given MPartDescriptor with particular "content" or "reference".

My question is, whether MPlaceholder and EPartService.createSharedPart(id) fills this gap, and if so, how one would use it. If not, whether the way described above is the only way to go.
Re: How to use MPartDescriptor [message #805981 is a reply to message #805968] Fri, 24 February 2012 11:24 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5462
Registered: July 2009
Senior Member
Am 24.02.12 12:02, schrieb Karl Weber:
> I am not sure, but I think the EPartService API has changed from 4.1 to
> 4.2. At least I don't remember that in 4.1 this service already had the
> methods createSharedPart.
>
> Anyway, I do know how to define an MPartDescriptor. In 4.1 an MPart for
> this descriptor was created with EPartService.createPart(id), where id
> is the identifier of the MPartDescriptor. This part can be found again
> with EPartService.findPart(id) -- if there is only one.
>
> I don't know whether this is still the way to go with 4.2. The problem
> is, that one may need do create more than one MPart for one
> MPartDescriptor. An editor may be one example: one may want to edit
> different instances of one and the same kind.

You can create as many instance of MPart from an MPartDescriptor! It is
NOT a 1:1 relation - currently no relation between the both is created
which though might make sense to provide a EPartService method (see below).

>
> Then one is not able to find the MPart corresponding to one particular
> instance with the id of the MPartDescriptor -- maybe there are more
> parts with the same id but with different "content". One way to go is

As outlined there's no such 1:1 relation.

> using EPartService.getParts() which unfortunately will return all
> MParts, not only those corresponding to one particular MPartDescriptor.
> Then one would need to check, whether there is one MPart for the
> particular MPartDescriptor having a particular "content".
>

To mimic editors we planned to use MInputPart but because we current
don't have editor support at EAP the EPartService has no such method. We
could maybe add one in the M6 - please file a feature request.

> So something is missing that will find an MPart for a given
> MPartDescriptor with particular "content" or "reference".
>

One could think about an EPartService method to locate all
MPart-Instances created from an MPartDescriptor (e.g. we could store
this relation in the MPart#persistedState) => please file a feature request.

> My question is, whether MPlaceholder and
> EPartService.createSharedPart(id) fills this gap, and if so, how one
> would use it. If not, whether the way described above is the only way to
> go.

No MPlaceholder allows to share MUIElement instances between perspectives.

Tom
Re: How to use MPartDescriptor [message #806091 is a reply to message #805981] Fri, 24 February 2012 14:39 Go to previous message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
Tom Schindl wrote on Fri, 24 February 2012 12:24
Am 24.02.12 12:02, schrieb Karl Weber:
> So something is missing that will find an MPart for a given
> MPartDescriptor with particular "content" or "reference".
>

One could think about an EPartService method to locate all
MPart-Instances created from an MPartDescriptor (e.g. we could store
this relation in the MPart#persistedState) => please file a feature request.


Done
Previous Topic:Eclipse 4: how do perspectives work?
Next Topic:e4 css styling does not work right (Buttons, Text)
Goto Forum:
  


Current Time: Sun Nov 23 04:53:59 GMT 2014

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

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