Add new child command to an existing metamodel without modifying it [message #1698101] |
Thu, 11 June 2015 09:05 |
|
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:
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 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.02590 seconds