Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to add a child reference to a basic class
How to add a child reference to a basic class [message #168649] Fri, 18 January 2008 02:35 Go to next message
Eclipse UserFriend
Originally posted by: avix1000.gmail.com

Hi.

I have a question about adding s child reference to a basic class.

My Model:
Expression (abstract), Plus (extends Expression), Minus (extends
Expression and so on)…

Body hasMany Expression, Declaration has Expression, Function has Body and
hasMany Declaration.


Graphics:
I have a figure for each type of expression.


I want to realize editor that will allow me to create a body and add some
expression to it (Plus, Minus and so on) and will allow me to create a
declaration and add an expression to it. What should I write in my gmfmap
file? I created a node mapping for function. I created a child reference
with node mapping for Declaration in function node. All works fine. Now I
want to create a child reference that will allow me to add any expression
to this declaration. But if I add a child reference I can’t select
a containment feature. How can I do it?



Best Regards, Savkin Viktor.
Re: How to add a child reference to a basic class [message #188632 is a reply to message #168649] Thu, 22 May 2008 10:21 Go to previous message
Eclipse UserFriend
Originally posted by: kheinz57.gmx.de

It seems like you got the same problem as I got.

The editor is able to place
'red round', 'green rectangle' and 'green round' shapes
on the canvas (called 'GesamtMenge')

I build this first:
=======================================
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mengenlehre"
nsURI="mengenlehre" nsPrefix="mengenlehre">
<eClassifiers xsi:type="ecore:EClass" name="RotRund"/>
<eClassifiers xsi:type="ecore:EClass" name="GesamtMenge">
<eStructuralFeatures xsi:type="ecore:EReference" name="gRotRunde"
upperBound="-1"
eType="#//RotRund" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference"
name="gGruenRechteckige" upperBound="-1"
eType="#//GruenRechteckig" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="gGruenRund"
upperBound="-1"
eType="#//GruenRund" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GruenRechteckig"
eSuperTypes="#//Gruen"/>
<eClassifiers xsi:type="ecore:EClass" name="Gruen" abstract="true"/>
<eClassifiers xsi:type="ecore:EClass" name="GruenRund"
eSuperTypes="#//Gruen"/>
</ecore:EPackage>

I did the whole wizard stuff and got a working GMF edit. (BTW: Great thing!)



The second version doesn't work. The difference is that the
the canvas (GesamtMenge) has a reference list to the abstract class
(Gruen)
instead of each derived concred classes GruenRechteckig and GruenRund.
It would be easier to handle it that way.
=======================================
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mengenlehre"
nsURI="mengenlehre" nsPrefix="mengenlehre">
<eClassifiers xsi:type="ecore:EClass" name="RotRund"/>
<eClassifiers xsi:type="ecore:EClass" name="GesamtMenge">
<eStructuralFeatures xsi:type="ecore:EReference" name="gRotRunde"
upperBound="-1"
eType="#//RotRund" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="gGruen"
upperBound="-1"
eType="#//Gruen" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GruenRechteckig"
eSuperTypes="#//Gruen"/>
<eClassifiers xsi:type="ecore:EClass" name="Gruen" abstract="true"/>
<eClassifiers xsi:type="ecore:EClass" name="GruenRund"
eSuperTypes="#//Gruen"/>
</ecore:EPackage>

Savkin Viktor schrieb:
> Hi.
>
> I have a question about adding s child reference to a basic class.
>
> My Model:
> Expression (abstract), Plus (extends Expression), Minus (extends
> Expression and so on)&#8230;
>
> Body hasMany Expression, Declaration has Expression, Function has Body
> and hasMany Declaration.
>
>
> Graphics:
> I have a figure for each type of expression.
>
>
> I want to realize editor that will allow me to create a body and add
> some expression to it (Plus, Minus and so on) and will allow me to
> create a declaration and add an expression to it. What should I write in
> my gmfmap file? I created a node mapping for function. I created a child
> reference with node mapping for Declaration in function node. All works
> fine. Now I want to create a child reference that will allow me to add
> any expression to this declaration. But if I add a child reference I
> can&#8217;t select a containment feature. How can I do it?
>
>
>
> Best Regards, Savkin Viktor.
Previous Topic:Regular command (copy/paste)
Next Topic:How to switch auto size off?
Goto Forum:
  


Current Time: Sun Jun 30 13:49:45 GMT 2024

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

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

Back to the top