Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Add new child command to an existing metamodel without modifying it
Add new child command to an existing metamodel without modifying it [message #1698101] Thu, 11 June 2015 09:05 Go to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

I have a metamodel that I do not own so I can't modify it. In this metamodel, there is an EClass which contain a containment reference. I want to add a command letting me create a child in a specific manner for this reference. I want to be able to open a dialog to let the user configure how this child will be created. The type of the child is a type of the metamodel, I am not trying to create a type from another metamodel which would extend the first one.

For example, I if wanted to apply this to Ecore (which is not my use case), I would like to have a new "create child command" available which would let the user create a new EReference in a configurable manner. Something like this:

http://i.imgur.com/hhXoSj8.png

I am aware of the ChildCreationExtender mechanism but it does not really match my need because the method IChildCreationExtender.getNewChildDescriptors(Object, EditingDomain) expects me to provide a collection of CommandParameter (even if the signature does not say so). With a CommandParameter, I cannot control the execution of the command, I can only provide a value.

Is there a way to provide a new "create child command" (to run arbitrary code which would end up creating a regular child) to an existing metamodel while keeping all the existing behavior of the edit part of the metamodel?

Regards,

Stephane Bégaudeau, Obeo
Re: Add new child command to an existing metamodel without modifying it [message #1698361 is a reply to message #1698101] Mon, 15 June 2015 06:29 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Stephane,

Comments below.

On 11/06/2015 11:05 AM, Stephane Begaudeau wrote:
> Hi,
>
> I have a metamodel that I do not own so I can't modify it. In this
> metamodel, there is an EClass which contain a containment reference. I
> want to add a command letting me create a child in a specific manner
> for this reference. I want to be able to open a dialog to let the user
> configure how this child will be created. The type of the child is a
> type of the metamodel, I am not trying to create a type from another
> metamodel which would extend the first one.
I see.
>
> For example, I if wanted to apply this to Ecore (which is not my use
> case), I would like to have a new "create child command" available
> which would let the user create a new EReference in a configurable
> manner. Something like this:
>
>
>
> I am aware of the
> http://ed-merks.blogspot.fr/2008/01/creating-children-you-didnt-know.html
> mechanism but it does not really match my need because the method
> IChildCreationExtender.getNewChildDescriptors(Object, EditingDomain)
> expects me to provide a collection of CommandParameter (even if the
> signature does not say so). With a CommandParameter, I cannot control
> the execution of the command, I can only provide a value.
Do you need something from the context to create the value? I.e., it's
not sufficient to simply create a fully populated value up front? (That
latter is what most overrides do generally.)
>
> Is there a way to provide a new "create child command" (to run
> arbitrary code which would end up creating a regular child) to an
> existing metamodel while keeping all the existing behavior of the edit
> part of the metamodel?
Not currently no.
>
> Regards,
>
> Stephane Bégaudeau, Obeo


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] Howto remove a resource with Mars M7?
Next Topic:[CDO] Elements choice remains empty in properties view
Goto Forum:
  


Current Time: Thu Mar 28 22:38:04 GMT 2024

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

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

Back to the top