Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » child , EList , containment
| |
Re: child , EList , containment [message #766777 is a reply to message #766677] |
Fri, 16 December 2011 12:18 |
sohrab Missing name 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 |
Ed Merks 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 |
sohrab Missing name 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 |
Ed Merks 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 #770087 is a reply to message #770071] |
Fri, 23 December 2011 09:48 |
Ed Merks 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/
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 17:34:21 GMT 2024
Powered by FUDForum. Page generated in 0.04243 seconds
|