Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Links disappear after close/open
Links disappear after close/open [message #480563] Mon, 17 August 2009 15:59 Go to next message
No real name is currently offline No real nameFriend
Messages: 8
Registered: July 2009
Junior Member
Hello,

as a test i made a very simple gmf editor to model a graph. In the
Ecore-Model the root element is Graph, the other two elements are Node
and Edge. From Graph to Node and Edge there are composition
associations. Between Node and Edge there is a binary association, a
Node has 0..* edges, and a Edge has 2 nodes.

I generated a Gmf Editor where i have the Node as gmf-nodes, and the
edges as gmf-links. In the Editor i can build nodes and edges and
everything is fine, but when i save, close and open the diagram, the
graphical representation of the edges has disappeared. They still exist
in the model as i can see in the properties.

When i change the association from Edge to Node, so that i have two
associations, i.e. named node1 and node2 the edges don't disappear after
safe, close, open.

Now, is this a bug or did i do something wrong?

Thanks,

Klaus



Here are the models, if there is a better way to show them to you which
is preferred in this newsgroup, please tell me:



graph.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="graph"
nsURI="http://graph/1.0" nsPrefix="graph">
<eClassifiers xsi:type="ecore:EClass" name="Graph">
<eStructuralFeatures xsi:type="ecore:EReference" name="edges"
upperBound="-1"
eType="#//Edge" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="nodes"
upperBound="-1"
eType="#//Node" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Node">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="edges"
upperBound="-1"
eType="#//Edge" eOpposite="#//Edge/nodes"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Edge">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="nodes"
lowerBound="2" upperBound="2"
eType="#//Node" eOpposite="#//Node/edges"/>
</eClassifiers>
</ecore:EPackage>



graph.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="graphPalette">
<tools
xsi:type="gmftool:ToolGroup"
title="graph">
<tools
xsi:type="gmftool:CreationTool"
title="Node"
description="Create new Node">
<smallIcon
xsi:type="gmftool:DefaultImage"/>
<largeIcon
xsi:type="gmftool:DefaultImage"/>
</tools>
<tools
xsi:type="gmftool:CreationTool"
title="Edge"
description="Create new Edge">
<smallIcon
xsi:type="gmftool:DefaultImage"/>
<largeIcon
xsi:type="gmftool:DefaultImage"/>
</tools>
</tools>
</palette>
</gmftool:ToolRegistry>



graph.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="graph">
<figures
name="Default">
<descriptors
name="NodeFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="NodeFigure">
<layout
xsi:type="gmfgraph:FlowLayout"/>
<children
xsi:type="gmfgraph:Label"
name="NodeNameFigure"
text="&lt;...>"/>
</actualFigure>
<accessors
figure="//@figures.0/@descriptors.0/@actualFigure/@children.0 "/>
</descriptors>
<descriptors
name="EdgeFigure">
<actualFigure
xsi:type="gmfgraph:PolylineConnection"
name="EdgeFigure">
<children
xsi:type="gmfgraph:Label"
name="EdgeNameFigure"
text="&lt;...>"/>
</actualFigure>
<accessors
figure="//@figures.0/@descriptors.1/@actualFigure/@children.0 "/>
</descriptors>
</figures>
<nodes
name="Node"
figure="NodeFigure"/>
<connections
name="Edge"
figure="EdgeFigure"/>
<labels
name="NodeName"
figure="NodeFigure"
accessor="//@figures.0/@descriptors.0/@accessors.0"/>
<labels
name="EdgeName"
figure="EdgeFigure"
accessor="//@figures.0/@descriptors.1/@accessors.0"/>
</gmfgraph:Canvas>



graph.gmfmap:

<?xml version="1.0" encoding="UTF-8"?>
<gmfmap:Mapping 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"
xmlns:gmfmap="http://www.eclipse.org/gmf/2008/mappings"
xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
<nodes>
<containmentFeature
href="graph.ecore#//Graph/nodes"/>
<ownedChild>
<domainMetaElement
href="graph.ecore#//Node"/>
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping">
<diagramLabel
href="graph.gmfgraph#NodeName"/>
<features
href="graph.ecore#//Node/name"/>
</labelMappings>
<tool
xsi:type="gmftool:CreationTool"
href="graph.gmftool#//@palette/@tools.0/@tools.0"/>
<diagramNode
href="graph.gmfgraph#Node"/>
</ownedChild>
</nodes>
<links>
<domainMetaElement
href="graph.ecore#//Edge"/>
<containmentFeature
href="graph.ecore#//Graph/edges"/>
<tool
xsi:type="gmftool:CreationTool"
href="graph.gmftool#//@palette/@tools.0/@tools.1"/>
<diagramLink
href="graph.gmfgraph#Edge"/>
<sourceMetaFeature
xsi:type="ecore:EReference"
href="graph.ecore#//Edge/nodes"/>
<linkMetaFeature
xsi:type="ecore:EReference"
href="graph.ecore#//Edge/nodes"/>
</links>
<diagram>
<diagramCanvas
href="graph.gmfgraph#graph"/>
<domainModel
href="graph.ecore#/"/>
<domainMetaElement
href="graph.ecore#//Graph"/>
<palette
href="graph.gmftool#//@palette"/>
</diagram>
</gmfmap:Mapping>
Re: Links disappear after close/open [message #480793 is a reply to message #480563] Tue, 18 August 2009 14:02 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Klaus,

In GMF we usualy use different deatures as source/target metaFeature of LinkMapping,
so there can be some problems.
Can you modify Edge class and introduce two different references there "sourceNode"/"targetNode"
instead of simple "nodes"?
Concerning this use case - I think you can submitt a bug for it.

-----------------
Alex Shatalin
Previous Topic:Figure to a Node
Next Topic:How to automatically create a default node after generating a new diagram
Goto Forum:
  


Current Time: Thu Sep 19 05:04:44 GMT 2024

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

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

Back to the top