Compartments in 2 step meta model [message #199057] |
Sat, 26 July 2008 11:59  |
Eclipse User |
|
|
|
Originally posted by: ML1984.gmx.de
This is a multi-part message in MIME format.
--------------090202090504070802070701
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
I am a student assistant at university and I would like to ask a question:
Suppose, there are three (meta model = ecore) classes: A, B and C. Objects of
type A reference exactly 1 B Object, objects of type B reference an arbitrary
number of C objects (example given as attachment).
I want to visualize only objects of type A and C. The latter should be nested in
objects of type A via compartments.
How can that be achieved (in the mapping model)?
By creating an object of type A:
- a corresponding object of type B should be created and
- a link between both of them.
I know merging A and B would simplify (and solve) the problem, but the given
meta model is just an easier version of the real project. Merging the two nodes
is not possible in our project.
Thanks in advance,
Mark
--------------090202090504070802070701
Content-Type: text/xml;
name="Test.gmftool"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Test.gmftool"
<?xml version="1.0" encoding="UTF-8"?>
<gmftool:ToolRegistry xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
<palette
title="TestdiagramPalette">
<tools
xsi:type="gmftool:ToolGroup"
title="Testdiagram">
<tools
xsi:type="gmftool:CreationTool"
title="A"
description="Create new A">
<smallIcon
xsi:type="gmftool:DefaultImage"/>
<largeIcon
xsi:type="gmftool:DefaultImage"/>
</tools>
<tools
xsi:type="gmftool:CreationTool"
title="C"
description="Create new C">
<smallIcon
xsi:type="gmftool:DefaultImage"/>
<largeIcon
xsi:type="gmftool:DefaultImage"/>
</tools>
</tools>
</palette>
</gmftool:ToolRegistry>
--------------090202090504070802070701
Content-Type: text/xml;
name="Test.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Test.ecore"
<?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="Testdiagram"
nsURI="test" nsPrefix="">
<eClassifiers xsi:type="ecore:EClass" name="A" eSuperTypes="#//Element">
<eStructuralFeatures xsi:type="ecore:EReference" name="b" lowerBound="1" eType="#//B"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="B" eSuperTypes="#//Element">
<eStructuralFeatures xsi:type="ecore:EReference" name="c" upperBound="-1" eType="#//C"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="C" eSuperTypes="#//Element"/>
<eClassifiers xsi:type="ecore:EClass" name="Element"/>
<eClassifiers xsi:type="ecore:EClass" name="Diagram">
<eStructuralFeatures xsi:type="ecore:EReference" name="elements" upperBound="-1"
eType="#//Element"/>
</eClassifiers>
</ecore:EPackage>
--------------090202090504070802070701
Content-Type: text/xml;
name="Test.gmfgraph"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Test.gmfgraph"
<?xml version="1.0" encoding="UTF-8"?>
<gmfgraph:Canvas xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gmfgraph="http://www.eclipse.org/gmf/2006/GraphicalDefinition" name="Testdiagram">
<figures
name="Default">
<descriptors
name="AFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="AFigure"/>
</descriptors>
<descriptors
name="CFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="CFigure"/>
</descriptors>
</figures>
<nodes
name="A"
figure="AFigure"/>
<nodes
name="C"
figure="CFigure"/>
</gmfgraph:Canvas>
--------------090202090504070802070701--
|
|
|
Re: Compartments in 2 step meta model [message #199074 is a reply to message #199057] |
Sun, 27 July 2008 07:57   |
Eclipse User |
|
|
|
Originally posted by: lwrage.sei.cmu.edu
Hi,
Sorry, I don't have an answer to this question, but I want to do the exect
same thing. I just want to emphasize that this is not a unique situation.
- Lutz
"Mark L." <ML1984@gmx.de> wrote in message
news:g6fhk7$t8l$1@build.eclipse.org...
> Hi,
>
> I am a student assistant at university and I would like to ask a question:
> Suppose, there are three (meta model = ecore) classes: A, B and C. Objects
> of
> type A reference exactly 1 B Object, objects of type B reference an
> arbitrary
> number of C objects (example given as attachment).
>
> I want to visualize only objects of type A and C. The latter should be
> nested in
> objects of type A via compartments.
>
> How can that be achieved (in the mapping model)?
>
> By creating an object of type A:
> - a corresponding object of type B should be created and
> - a link between both of them.
>
> I know merging A and B would simplify (and solve) the problem, but the
> given
> meta model is just an easier version of the real project. Merging the two
> nodes
> is not possible in our project.
>
> Thanks in advance,
> Mark
>
------------------------------------------------------------ --------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <gmftool:ToolRegistry xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
> <palette
> title="TestdiagramPalette">
> <tools
> xsi:type="gmftool:ToolGroup"
> title="Testdiagram">
> <tools
> xsi:type="gmftool:CreationTool"
> title="A"
> description="Create new A">
> <smallIcon
> xsi:type="gmftool:DefaultImage"/>
> <largeIcon
> xsi:type="gmftool:DefaultImage"/>
> </tools>
> <tools
> xsi:type="gmftool:CreationTool"
> title="C"
> description="Create new C">
> <smallIcon
> xsi:type="gmftool:DefaultImage"/>
> <largeIcon
> xsi:type="gmftool:DefaultImage"/>
> </tools>
> </tools>
> </palette>
> </gmftool:ToolRegistry>
>
------------------------------------------------------------ --------------------
> <?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="Testdiagram"
> nsURI="test" nsPrefix="">
> <eClassifiers xsi:type="ecore:EClass" name="A" eSuperTypes="#//Element">
> <eStructuralFeatures xsi:type="ecore:EReference" name="b"
> lowerBound="1" eType="#//B"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="B" eSuperTypes="#//Element">
> <eStructuralFeatures xsi:type="ecore:EReference" name="c"
> upperBound="-1" eType="#//C"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="C" eSuperTypes="#//Element"/>
> <eClassifiers xsi:type="ecore:EClass" name="Element"/>
> <eClassifiers xsi:type="ecore:EClass" name="Diagram">
> <eStructuralFeatures xsi:type="ecore:EReference" name="elements"
> upperBound="-1"
> eType="#//Element"/>
> </eClassifiers>
> </ecore:EPackage>
>
------------------------------------------------------------ --------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <gmfgraph:Canvas xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:gmfgraph="http://www.eclipse.org/gmf/2006/GraphicalDefinition"
> name="Testdiagram">
> <figures
> name="Default">
> <descriptors
> name="AFigure">
> <actualFigure
> xsi:type="gmfgraph:Rectangle"
> name="AFigure"/>
> </descriptors>
> <descriptors
> name="CFigure">
> <actualFigure
> xsi:type="gmfgraph:Rectangle"
> name="CFigure"/>
> </descriptors>
> </figures>
> <nodes
> name="A"
> figure="AFigure"/>
> <nodes
> name="C"
> figure="CFigure"/>
> </gmfgraph:Canvas>
>
|
|
|
|
|
|
|
|
Re: Compartments in 2 step meta model [message #200019 is a reply to message #199863] |
Mon, 04 August 2008 05:34  |
Eclipse User |
|
|
|
Hello Mark L.,
I suppose you have a meta-model like this:
EClass “A” with EReference “b”
EClass “B” with EReference “cs”
EClass C
and you are going to implement derived feature of EClass “A” called “a_cs”.
In this case the method itself should be very simple like: getB.getCs() (in
addition you have to probably wrap these elements into appropriate EMF collection)
In case somebody add/remove C instance to the existing B instance EMF will
fire appropriate notification and custom code should listen for this notification
and fire one indicating the value of derived feature (a_cs) was changed.
You can add “listener” for each EMF object (including particular B instance)
by calling myB.eAdapters().add(<ListenerInstance>)
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.04880 seconds