Create two behaviours to add an element in an EMF editor [message #106063] |
Fri, 04 January 2008 14:43 |
Eclipse User |
|
|
|
Originally posted by: marion.di-giacomo.cea.fr
Hi,
I have a problem with the creation of my elements in my EMF editor.
When I create an element, I would like to create two children.
So I modified the 'create' method in the factory class and called the
'create' methods of the two children.
But when I open a file which has already an element with its two children,
there are more than two created elements (the loaded elements and the
elements created in the factory class).
I would like to know how I can modify the behaviour of my editor in order
to have the two loaded elements when I open the editor, and two
default children when I create a new element. Maybe should I modify the
action of the menu bar ? I find an easy way to do it.
Thanks,
Marion
|
|
|
Re: Create two behaviours to add an element in an EMF editor [message #106212 is a reply to message #106063] |
Fri, 04 January 2008 19:22 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Marion,
Next time you should ask EMF questions on the EMF newsgroup.
news://news.eclipse.org/eclipse.tools.emf
You can specialize the wizard itself so that when you create a new
object in createInitialModel you create one with additional children.
In terms of create commands within the editor, you can specialize the
collectNewChildDescriptors method in the XyzItemProvider to create new
instances that have children or have other features already set on them;
you don't need to use commands for doing that prepopulation.
Marion Di Giacomo wrote:
> Hi,
>
> I have a problem with the creation of my elements in my EMF editor.
> When I create an element, I would like to create two children.
> So I modified the 'create' method in the factory class and called the
> 'create' methods of the two children. But when I open a file which has
> already an element with its two children, there are more than two
> created elements (the loaded elements and the elements created in the
> factory class).
> I would like to know how I can modify the behaviour of my editor in
> order to have the two loaded elements when I open the editor, and
> two default children when I create a new element. Maybe should I
> modify the action of the menu bar ? I find an easy way to do it.
> Thanks,
>
> Marion
>
|
|
|
Re: Create two behaviours to add an element in an EMF editor [message #613923 is a reply to message #106063] |
Fri, 04 January 2008 19:22 |
Ed Merks Messages: 33236 Registered: July 2009 |
Senior Member |
|
|
Marion,
Next time you should ask EMF questions on the EMF newsgroup.
news://news.eclipse.org/eclipse.tools.emf
You can specialize the wizard itself so that when you create a new
object in createInitialModel you create one with additional children.
In terms of create commands within the editor, you can specialize the
collectNewChildDescriptors method in the XyzItemProvider to create new
instances that have children or have other features already set on them;
you don't need to use commands for doing that prepopulation.
Marion Di Giacomo wrote:
> Hi,
>
> I have a problem with the creation of my elements in my EMF editor.
> When I create an element, I would like to create two children.
> So I modified the 'create' method in the factory class and called the
> 'create' methods of the two children. But when I open a file which has
> already an element with its two children, there are more than two
> created elements (the loaded elements and the elements created in the
> factory class).
> I would like to know how I can modify the behaviour of my editor in
> order to have the two loaded elements when I open the editor, and
> two default children when I create a new element. Maybe should I
> modify the action of the menu bar ? I find an easy way to do it.
> Thanks,
>
> Marion
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03255 seconds