Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » child , EList , containment
child , EList , containment [message #766503] Thu, 15 December 2011 22:36 Go to next message
sohrab Missing name is currently offline sohrab Missing nameFriend
Messages: 17
Registered: November 2011
Junior Member
Hi,

I use .editor plugin of EMF for creating models from 4 ecore files. Some models can be new child for others and for some models I should select from list (like below figure).
why?

http://1.vped.site50.net/images/b318124e37af.jpg

Also I want to design my models in new plugin and convert them to executable codes that are in the MyModel.impl , how I can do it?
thanks.
Re: child , EList , containment [message #766677 is a reply to message #766503] Fri, 16 December 2011 08:43 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Comments below

On 15/12/2011 11:36 PM, sohrab wrote:
> Hi,
>
> I use .editor plugin of EMF for creating models from 4 ecore files.
> Some models can be new child for others and for some models I should
> select from list (like below figure).
> why?
By default only containment references support child creation.
>
>
>
> Also I want to design my models in new plugin and convert them to
> executable codes that are in the MyModel.impl , how I can do it?
That's not an EMF question.
> thanks.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: child , EList , containment [message #766777 is a reply to message #766677] Fri, 16 December 2011 12:18 Go to previous messageGo to next message
sohrab Missing name is currently offline sohrab Missing nameFriend
Messages: 17
Registered: November 2011
Junior Member
Thanks Ed,
1- I have 4 ecore files and when want to add a new child to one model in new plugin, I see all models that are in different ecores. What types of models can be seen in the new child menu for one model?
2- I have these classes in one ecore:
Class S extends EObject
Class A extends S
Class B extends EObject
Class C extends EObject

Class A has this element:
/**
	 * 
	 * @model containment="true"
	 */
	EList<B> getBClasses();


Class B has this element:
	/**
	 * 
	 * @model containment="true"
	 */
	EList<C> getCClasses();

And class C defined like this:
/**
 * 
 * @model 
 */
public interface C  extends EObject {
	/**
	 * 
	 * @model
	 */
	EList<EDataType> getDataTypes();
	/**
	 * 
	 * @model
	 */
	EList<EEnum> getEnums();
	/**
	 * 
	 * @model
	 */
	EList<EClass> getClasses();

}

I can add new child from B in A models, but I can't add C models in B models, only I see cClasses in the properties view like above picture.
when I work with 3 simple model, It works , but in my project that isn't work(A,B,S are very large metamodels).


3- in the new plugin , we can design models and connect together in tree structure. I want use these xml files (e.g. My.EXTLibrary ) and generate emf codes. So EMF can receive these files like an new ecore models and update codes automatically? Or I should parse these files and generate new ecore files and then I can use EMF for generating codes?

[Updated on: Fri, 16 December 2011 12:35]

Report message to a moderator

Re: child , EList , containment [message #766795 is a reply to message #766777] Fri, 16 December 2011 12:48 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Comments below.

On 16/12/2011 1:19 PM, sohrab wrote:
> Thanks Ed, 1- I have 4 ecore files and when want to add a new child
> to one model in new plugin, I see all models that are in different
> ecores. What types of models can be seen in the new child menu for one
> model?
This is likely to be relevant:

http://ed-merks.blogspot.com/2008/01/creating-children-you-didnt-know.html

> 2- I have these classes in one ecore:
> Class S extends EObject
> Class A extends S
> Class B extends EObject
> Class C extends EObject
>
> Class A has this element:
> /**
> * * @model containment="true"
> */
> EList<B> getBClasses();
>
> Class B has this element:
> /**
> * * @model containment="true"
> */
> EList<C> getCClasses();
> And class C defined like this:
>
> /**
> * * @model */
> public interface C extends EObject {
> /**
> * * @model
> */
> EList<EDataType> getDataTypes();
> /**
> * * @model
> */
> EList<EEnum> getEnums();
> /**
> * * @model
> */
> EList<EClass> getClasses();
>
> }
>
> I can add new child from B in A models, but I can't add C models in B
> models, only I see cClasses in the properties view like above picture.
Did you change it from a non-containment to a containment reference at
some point? When the GenModel is created, the defaults are set
appropriately based on that, but they're never changed after that unless
you change them. So fine the GenFeature corresponding to CClasses and
make sure the Children, Child Creation, and Notification are turned on.
> 3- in the new plugin , we can design models and connect together in
> tree structure. I want use these xml files (e.g. My.EXTLibrary ) and
> generate emf codes. So EMF can receive these files like an new ecore
> models and update codes automatically? Or I should parse these files
> and generate new ecore files and then I can use EMF for generating codes?
I'm not sure I follow what you're saying. You should be able to create
new downstream models and if you follow the steps in the blog, those
things can be known to the editor for the base model so that it supports
creation of such newly introduced classes.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: child , EList , containment [message #766871 is a reply to message #766795] Fri, 16 December 2011 15:28 Go to previous messageGo to next message
sohrab Missing name is currently offline sohrab Missing nameFriend
Messages: 17
Registered: November 2011
Junior Member
Thanks Ed,
I read your blog post, I solved child creation problem. But when I want to add new child, I see all Meta models that support by my models references and lists, also other models that inherited them.
Actually I use new plugin environment (tree structure) for designing my models (not metamodels). I wrote my Meta models in empty emf project, after code generation I use new plugin to instantiate models and set their names, couplings, and etc. In this way I have my models design and properties, so if can add .impl codes of models to this structure I have codes for my new models. For example Meta model A, has two instance in new plugin A1 and A2. I want to extend implemented codes from A, to A1 and A2. In this way I have useful models.
Re: child , EList , containment [message #767193 is a reply to message #766871] Sat, 17 December 2011 09:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Comments below.

On 16/12/2011 4:28 PM, sohrab wrote:
> Thanks Ed,
> I read your blog post, I solved child creation problem. But when I
> want to add new child, I see all Meta models that support by my models
> references and lists, also other models that inherited them.
Isn't that correct?
> Actually I use new plugin environment (tree structure) for designing
> my models (not metamodels).
I'm not sure how whether it's meta or not affects anything...
> I wrote my Meta models in empty emf project, after code generation I
> use new plugin to instantiate models and set their names, couplings,
> and etc.
Set the names of the instances and so on?
> In this way I have my models design and properties, so if can add
> .impl codes of models to this structure I have codes for my new models.
My brain is hurting now.
> For example Meta model A, has two instance in new plugin A1 and A2.
What does it mean for an instance to be in a plugin?
> I want to extend implemented codes from A, to A1 and A2.
But the relationship from A to A1 is one of model to instance, so I have
no idea how those instances relate to code or how that code relates to
their model. I'm very confused. This is starting to sound like the
"How to link meta-classes from different meta-models at the model
level?" thread.
> In this way I have useful models.
I really don't understand what you have.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: child , EList , containment [message #770071 is a reply to message #767193] Fri, 23 December 2011 08:51 Go to previous messageGo to next message
sohrab Missing name is currently offline sohrab Missing nameFriend
Messages: 17
Registered: November 2011
Junior Member
Thanks Ed,
I define new metamodels by java annotated interfaces, like this:

http://www.upsara.com/images/r6dk57aocgwmodho19if.png

Then generate genmodel file for them:

http://www.upsara.com/images/q8ne8fv143i0bqj85yl.png

Then generate codes and new plugins for new editor:

http://www.upsara.com/images/9fdeynjk93uc1i3ef23.png

I lunch new editor and create new project, add new model to it:

http://www.upsara.com/images/x3dytuvbn3t35z5xvl6h.png

Add new child and change names and titles.

http://www.upsara.com/images/es28yrgz3c9btpjmh8d4.png

Indeed I create tis file in new editor environment:
<?xml version="1.0" encoding="UTF-8"?>
<myModels:aModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:myModels="http:///myModels.ecore" title="alpha">
  <myb myID="beta"/>
</myModels:aModel>

I want to transform these models (i.e. alpha and beta) to codes like that generated for aModel and bModel (i.e. "aModelImpl.java" and "bModelImpl.java") in "myModels.impl" package.
Can you recommend new materials for reading?
Re: child , EList , containment [message #770087 is a reply to message #770071] Fri, 23 December 2011 09:48 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Comments below.

On 23/12/2011 9:51 AM, sohrab wrote:
> Thanks Ed,
> I define new metamodels by java annotated interfaces, like this:
>
Why aren't you following proper Java naming conventions? Class names
should start with an upper case letter...
>
>
> Then generate genmodel file for them:
>
>
>
> Then generate codes and new plugins for new editor:
>
>
>
> I lunch new editor and create new project, add new model to it:
>
>
>
> Add new child and change names and titles.
>
>
>
> Indeed I create tis file in new editor environment:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <myModels:aModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:myModels="http:///myModels.ecore" title="alpha">
> <myb myID="beta"/>
> </myModels:aModel>
>
> I want to transform these models (i.e. alpha and beta) to codes like
> that generated for aModel and bModel (i.e. "aModelImpl.java" and
> "bModelImpl.java") in "myModels.impl" package.
In what way are they like that?
> Can you recommend new materials for reading?
Most of the code generators use a templating language such Xtend,
Acceleo, or JET, so you could read about those.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: child , EList , containment [message #770102 is a reply to message #770087] Fri, 23 December 2011 10:44 Go to previous message
sohrab Missing name is currently offline sohrab Missing nameFriend
Messages: 17
Registered: November 2011
Junior Member
thanks Ed, I'll study about code generation and try again.
Previous Topic:[EEF] Multiple Tabs in the properties view
Next Topic:Edapt: How to specify namespace URI for different versions of a meta-model
Goto Forum:
  


Current Time: Thu Apr 25 21:26:49 GMT 2024

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

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

Back to the top