Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 11:13 Go to next message
Luca Gherardi is currently offline Luca GherardiFriend
Messages: 62
Registered: November 2010
Member
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 11:13]

Report message to a moderator

Re: How to extend a model and create the editor [message #998100 is a reply to message #998095] Wed, 09 January 2013 11:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
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?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to extend a model and create the editor [message #998107 is a reply to message #998100] Wed, 09 January 2013 11:43 Go to previous messageGo to next message
Luca Gherardi is currently offline Luca GherardiFriend
Messages: 62
Registered: November 2010
Member
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?

I.e an instance can contain C1,D1,E1 or C2,D2,E2 but not both.

That's why I started with the idea of having an editor for the second model and not for the first.

Thanks again,
Luca
Re: How to extend a model and create the editor [message #998164 is a reply to message #998107] Wed, 09 January 2013 13:24 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[EMF] Custom model validation constraints are not invoked
Next Topic:[CDO] CDO+db4o run from RCP application
Goto Forum:
  


Current Time: Tue Apr 16 13:24:14 GMT 2024

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

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

Back to the top