Home » Modeling » EMF » How to extend a model and create the editor
How to extend a model and create the editor [message #998095] |
Wed, 09 January 2013 06:13  |
Eclipse User |
|
|
|
Hi all,
I have an ecore model, in a first approximation it contains the following classes:
A, which contains a collection of B
B, which contains collections of C, D and E
C, D, E which are abstract classes
I have created a second model whit which I want to extend the first one. It contains
C1, which extends C
D1, which extends D
E1, which extends E
I have also created the genmodels and the generated the model, edit and editor for both the ecore models.
In the genmodel file of the first model I set Generate Model Wizard to false, because I only want to create instances that contains A, B, C1, D1 and E1.
I expected to have an editor that allows me to create this kind of hierarchy:
A<-b<-C1
However I haven't any available editor.
How can I solve my problem?
Did I follow the right approach?
Thanks in advance!
[Updated on: Wed, 09 January 2013 06:13] by Moderator
|
|
|
Re: How to extend a model and create the editor [message #998100 is a reply to message #998095] |
Wed, 09 January 2013 06:21   |
Eclipse User |
|
|
|
Luca,
Probably you want to use what's in this blog:
http://ed-merks.blogspot.de/2008/01/creating-children-you-didnt-know.html
I.e., you probably want and editor for the first model that knows about
creating children that come from the second model. You no doubt want a
wizard for the first model, so you can create an A, and probably don't
want an editor at all for the second model. When following the details
of the blog, keep in mind that plugin.xml doesn't regenerate once it
exists (that's improved in 2.9) so remember to delete the plugin.xml in
both *.edit projects after setting the appropriate properties in both
models and then regenerate.
On 09/01/2013 12:13 PM, Luca Mising name wrote:
> Hi all,
>
> I have an ecore model, in a first approximation it contains the
> following classes:
>
> A, which contains a collection of B
> B, which contains collections of C, D and E
> C, D, E which are abstract classes
>
> I have created a second model whit which I want to extend the first
> one. It contains
> C1, which extends C
> D1, which extends D
> E1, which extends E
>
> I have also created the genmodels and the generated the model, edit
> and editor for both the ecore models.
>
> In the genmodel file of the first model I set Generate Model Wizard to
> false, because I only want to create instances that contains A, B, C1,
> D1 and E1.
>
> I expected to have an editor that allows me to create this kind of
> hierarchy:
> A<-b<-C1
>
> However I haven't any available editor.
>
> How can I solve my problem?
> Did I follow the right approach?
|
|
| |
Re: How to extend a model and create the editor [message #998164 is a reply to message #998107] |
Wed, 09 January 2013 08:24  |
Eclipse User |
|
|
|
Luca,
Comments below.
On 09/01/2013 12:43 PM, Luca Mising name wrote:
> Thanks Ed,
>
> what you suggest works!
>
> Now, what if I would like to have two extensions of the first model
> and decide to use one rather than the other?
If the bundle is installed its extensions will be available. If you
don't want certain ones available, don't install them...
>
> I.e an instance can contain C1,D1,E1 or C2,D2,E2 but not both.
No, not out of the box.
>
> That's why I started with the idea of having an editor for the second
> model and not for the first.
The generated extensible factor will have a method like this:
public Collection<?> getNewChildDescriptors(Object object,
EditingDomain editingDomain)
{
return childCreationExtenderManager.getNewChildDescriptors(object,
editingDomain);
}
So you could specialize such a thing for two different cases, hard
coding the use of the helper from the desired extender.
>
> Thanks again,
> Luca
|
|
|
Goto Forum:
Current Time: Wed Jul 23 13:50:07 EDT 2025
Powered by FUDForum. Page generated in 0.07748 seconds
|