Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to add ChildDescriptors for EObjects which are in a different Plugins
How to add ChildDescriptors for EObjects which are in a different Plugins [message #1708208] Mon, 14 September 2015 16:07 Go to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
Hi,

what is the best way to register a new childDescriptor for EObjects which are within another plugin?

The only way i can think of is to add custom code to collectNewChildDescriptors of parent plugin. But this would stop the plugging approach since the child plugin needs to be added as dependency. Also i want to have the childcollectors still generated.

I also tried to add a extension point where i tried to receive the EObject with "createExecutableExtension" of IConfigurationElement. Unfortunately it throws an exception: can not access a member of class ... with modifiers "protected"

Maybe there's an more elegant way...

Thanks in advance
Philippe

Re: How to add ChildDescriptors for EObjects which are in a different Plugins [message #1708228 is a reply to message #1708208] Mon, 14 September 2015 18:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30559
Registered: July 2009
Senior Member
Phil,

Maybe
http://ed-merks.blogspot.com/2008/01/creating-children-you-didnt-know.html
addresses this issue.


On 14/09/2015 6:07 PM, Phil Wim wrote:
> Hi,
>
> what is the best way to register a new childDescriptor for EObjects
> which are within another plugin?
>
> The only way i can think of is to add custom code to
> collectNewChildDescriptors of parent plugin. But this would stop the
> plugging approach since the child plugin needs to be added as
> dependency. Also i want to have the childcollectors still generated.
>
> I also tried to add a extension point where i tried to receive the
> EObject with "createExecutableExtension" of IConfigurationElement.
> Unfortunately it throws an exception: can not access a member of class
> ... with modifiers "protected"
>
> Maybe there's an more elegant way...
>
> Thanks in advance
> Philippe
>
>
Re: How to add ChildDescriptors for EObjects which are in a different Plugins [message #1708275 is a reply to message #1708228] Tue, 15 September 2015 07:16 Go to previous messageGo to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
Ed,

I knew there would be an easy solution.

Thanks for pointing me out, that's exactly what i was looking for.

Phil


Re: How to add ChildDescriptors for EObjects which are in a different Plugins [message #1708295 is a reply to message #1708228] Tue, 15 September 2015 08:23 Go to previous messageGo to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
Hey Ed,

for a situation where I want to extend an an eclass which is within the extended plugin this approach works like a charm.

What if I already referenced an eclass in the plugin to extend?

Let's assume i have three plugins.

Plugin A
EClass Worker

Plugin B
EClass Server with EReference 0..n Worker

Plugin C
SpecialWorker extends Worker

Now i like to see SpecialWorker as child of Server. But when i'm setting Plugin B package property "Extensible Provider Factory" to true and SpecialWorker package property "Child Creation Extenders" also true. Nothing changed. No Special Worker in child creation context.

Now i thought Plugin B needs both properties set to true, because it's passing eclass worker trough. Also not succesfull.

Is this scenario possible at all?
Re: How to add ChildDescriptors for EObjects which are in a different Plugins [message #1708298 is a reply to message #1708295] Tue, 15 September 2015 09:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30559
Registered: July 2009
Senior Member
Phil,

What you show below is trickier. C knows nothing of B so it doesn't
know to generate child creation extenders for it. If B's GenModel knew
about C's GenPackage as a usedGenPackages, then it would generate the
right things... In the past I've considered making it possible to add
an additional kind of "usedGenPackages" reference for this specific
purpose, but I've done no work for it. One approach to kind of hack it
is to add C's GenPackage to B'c usedGenPackages manually. It might
create undesirable dependencies in package initialization and the
manifest, but you could let it generate the child extension stuff and
then you could mark then so they aren't merged away once you remove C's
GenPackage and regenerate again...

On 15/09/2015 10:23 AM, Phil Wim wrote:
> Hey Ed,
>
> for a situation where I want to extend an an eclass which is within
> the extended plugin this approach works like a charm.
> What if I already referenced an eclass in the plugin to extend?
> Let's assume i have three plugins.
>
> Plugin A
> EClass Worker
>
> Plugin B
> EClass Server with EReference 0..n Worker
>
> Plugin C
> SpecialWorker extends Worker
>
> Now i like to see SpecialWorker as child of Server. But when i'm
> setting Plugin B package property "Extensible Provider Factory" to
> true and SpecialWorker package property "Child Creation Extenders"
> also true. Nothing changed. No Special Worker in child creation context.
> Now i thought Plugin B needs both properties set to true, because it's
> passing eclass worker trough. Also not succesfull.
>
> Is this scenario possible at all?
Re: How to add ChildDescriptors for EObjects which are in a different Plugins [message #1708301 is a reply to message #1708298] Tue, 15 September 2015 10:02 Go to previous messageGo to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
Do i need to set usedGenPackages directly in xml?

Without testing it, is my assumption correct that project specific extensions are not possible with the above described structure? This extension is just for a small project and couldn't be used in other projects.
Re: How to add ChildDescriptors for EObjects which are in a different Plugins [message #1708336 is a reply to message #1708301] Tue, 15 September 2015 15:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30559
Registered: July 2009
Senior Member
Phil,

Comments below.

On 15/09/2015 12:02 PM, Phil Wim wrote:
> Do i need to set usedGenPackages directly in xml?
Pretty much. I'm not sure the reload wizard lets you load a GenModel
and select a GenPackage that isn't actually used/needed.
> Without testing it, is my assumption correct that project specific
> extensions are not possible with the above described structure?
Sorry, I'm not sure exactly what you mean...
> This extension is just for a small project and couldn't be used in
> other projects.
Re: How to add ChildDescriptors for EObjects which are in a different Plugins [message #1708343 is a reply to message #1708336] Tue, 15 September 2015 16:30 Go to previous message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
Ed,

thanks for your assistance. I reworked my models and now it's working as expected... Rolling Eyes

Previous Topic:eContainer in other resource
Next Topic:reduce loading time of an xmi file
Goto Forum:
  


Current Time: Thu Oct 24 04:41:23 GMT 2019

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

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

Back to the top