Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Expression Label Mapping not displayed after reopening of saved diagram
Expression Label Mapping not displayed after reopening of saved diagram [message #553573] Wed, 18 August 2010 05:18 Go to next message
Nimesh Mising name is currently offline Nimesh Mising nameFriend
Messages: 23
Registered: March 2010
Junior Member
Hi,

I have created the Mappins based on an existing Ecore (which is generated from XText). As part of my XText grammar the attribute that I need to display within a node is a child element's property and hence I used Expression Label Mapping element inside my child Node Mapping.

When the diagram is created based on the textual model everything is displayed perfectly. I modify the diagram by changing the co-ordinates (not affecting the underlying model) and save it. It displays fine. I close this file and reopen it and now all the child elements based on Expression Label Mappings have disappeared. Only the connections remain. Even the Feature Label Mappings in Nodes (Top level Node's name) and Connections disappear.

Any pointers to where I should look for debugging this problem would be great help.

Thanks.
Regards,
- Nimesh
Re: Expression Label Mapping not displayed after reopening of saved diagram [message #554017 is a reply to message #553573] Thu, 19 August 2010 17:00 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

which version of GMF are you using?
If it is not the latest perhaps it is related to this bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=281014

Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: Expression Label Mapping not displayed after reopening of saved diagram [message #554134 is a reply to message #554017] Fri, 20 August 2010 09:41 Go to previous messageGo to next message
Nimesh Mising name is currently offline Nimesh Mising nameFriend
Messages: 23
Registered: March 2010
Junior Member
Hi,

I am using tooling and SDK version 2.3.0 and runtime SDK version 1.4.0. I do not think it is related to the bug mentioned because I can see the nodes and edges but not the labels which are linked to the model (elements tag missing in XML).

I tried to trace this issue and now I know why it does not show. But what I do not know is where did I make a mistake because of which this happens.

The basic issue is that the "element" tag is missing from the diagram (when viewed in text editor).

When I initialize the diagram from the xtext model this is what is viewed in the text editor (right click on the diagram file and choose Open With -> Text Editor)
<?xml version="1.0" encoding="UTF-8"?>
<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:entity="http://www.mastek.com/elixirna/system/dsls/Entity" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_tF4sEKw8Ed-8VaJ_IOSN9Q" type="Entity" measurementUnit="Pixel">
  <styles xmi:type="notation:DiagramStyle" xmi:id="_tF4sEaw8Ed-8VaJ_IOSN9Q"/>
  <element xmi:type="entity:Package" href="Second.entities#//@package"/>
</notation:Diagram>


When I change the diagram and save, the "element" tag goes missing for Second.entities#//@package.
<?xml version="1.0" encoding="UTF-8"?>
<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_tF4sEKw8Ed-8VaJ_IOSN9Q" type="Entity" measurementUnit="Pixel">
  <children xmi:type="notation:Node" xmi:id="_tGrWQKw8Ed-8VaJ_IOSN9Q" type="2001">
    <children xmi:type="notation:DecorationNode" xmi:id="_tGrWRaw8Ed-8VaJ_IOSN9Q" type="5002"/>
    <children xmi:type="notation:BasicCompartment" xmi:id="_tGr9UKw8Ed-8VaJ_IOSN9Q" type="7001">
      <styles xmi:type="notation:SortingStyle" xmi:id="_tGr9Uaw8Ed-8VaJ_IOSN9Q"/>
      <styles xmi:type="notation:FilteringStyle" xmi:id="_tGr9Uqw8Ed-8VaJ_IOSN9Q"/>
    </children>
    <styles xmi:type="notation:DescriptionStyle" xmi:id="_tGrWQaw8Ed-8VaJ_IOSN9Q"/>
    <styles xmi:type="notation:FontStyle" xmi:id="_tGrWQqw8Ed-8VaJ_IOSN9Q" fontName="Segoe UI"/>
    <styles xmi:type="notation:LineStyle" xmi:id="_tGrWQ6w8Ed-8VaJ_IOSN9Q"/>
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_tGrWRKw8Ed-8VaJ_IOSN9Q"/>
  </children>
  <children xmi:type="notation:Node" xmi:id="_tGr9U6w8Ed-8VaJ_IOSN9Q" type="2001">
    <children xmi:type="notation:DecorationNode" xmi:id="_tGr9WKw8Ed-8VaJ_IOSN9Q" type="5002"/>
    <children xmi:type="notation:BasicCompartment" xmi:id="_tGr9Waw8Ed-8VaJ_IOSN9Q" type="7001">
      <styles xmi:type="notation:SortingStyle" xmi:id="_tGr9Wqw8Ed-8VaJ_IOSN9Q"/>
      <styles xmi:type="notation:FilteringStyle" xmi:id="_tGr9W6w8Ed-8VaJ_IOSN9Q"/>
    </children>
    <styles xmi:type="notation:DescriptionStyle" xmi:id="_tGr9VKw8Ed-8VaJ_IOSN9Q"/>
    <styles xmi:type="notation:FontStyle" xmi:id="_tGr9Vaw8Ed-8VaJ_IOSN9Q" fontName="Segoe UI"/>
    <styles xmi:type="notation:LineStyle" xmi:id="_tGr9Vqw8Ed-8VaJ_IOSN9Q"/>
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_tGr9V6w8Ed-8VaJ_IOSN9Q" x="312" y="96" height="57"/>
  </children>
  <styles xmi:type="notation:DiagramStyle" xmi:id="_tF4sEaw8Ed-8VaJ_IOSN9Q"/>
</notation:Diagram>
Also missing are the element tags for each of the children.

I manually added the element tags using the text editor. If I view the manually edited file using Diagram editor it displays perfectly. The manually edited XML file is as follows
<?xml version="1.0" encoding="UTF-8"?>
<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:entity="http://www.mastek.com/elixirna/system/dsls/Entity" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_5XgU8KtbEd-05ucACzIa4Q" type="Entity" measurementUnit="Pixel">
  <children xmi:type="notation:Node" xmi:id="_6I-OIKtbEd-05ucACzIa4Q" type="2001">
    <children xmi:type="notation:DecorationNode" xmi:id="_6I-OJatbEd-05ucACzIa4Q" type="5002"/>
    [B]<element xmi:type="entity:Entity" href="Second.entities#//@package.types.0"/>[/B]
    <children xmi:type="notation:BasicCompartment" xmi:id="_6I-OJqtbEd-05ucACzIa4Q" type="7001">
      <styles xmi:type="notation:SortingStyle" xmi:id="_6I-OJ6tbEd-05ucACzIa4Q"/>
      <styles xmi:type="notation:FilteringStyle" xmi:id="_6I-OKKtbEd-05ucACzIa4Q"/>
    </children>
    <styles xmi:type="notation:DescriptionStyle" xmi:id="_6I-OIatbEd-05ucACzIa4Q"/>
    <styles xmi:type="notation:FontStyle" xmi:id="_6I-OIqtbEd-05ucACzIa4Q" fontName="Segoe UI"/>
    <styles xmi:type="notation:LineStyle" xmi:id="_6I-OI6tbEd-05ucACzIa4Q"/>
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6I-OJKtbEd-05ucACzIa4Q" height="61"/>
  </children>
  <children xmi:type="notation:Node" xmi:id="_6I-1MKtbEd-05ucACzIa4Q" type="2001">
    <children xmi:type="notation:DecorationNode" xmi:id="_6I-1NatbEd-05ucACzIa4Q" type="5002"/>
    <element xmi:type="entity:Entity" href="Second.entities#//@package.types.1"/>
    <children xmi:type="notation:BasicCompartment" xmi:id="_6I-1NqtbEd-05ucACzIa4Q" type="7001">
      <styles xmi:type="notation:SortingStyle" xmi:id="_6I-1N6tbEd-05ucACzIa4Q"/>
      <styles xmi:type="notation:FilteringStyle" xmi:id="_6I-1OKtbEd-05ucACzIa4Q"/>
    </children>
    <styles xmi:type="notation:DescriptionStyle" xmi:id="_6I-1MatbEd-05ucACzIa4Q"/>
    <styles xmi:type="notation:FontStyle" xmi:id="_6I-1MqtbEd-05ucACzIa4Q" fontName="Segoe UI"/>
    <styles xmi:type="notation:LineStyle" xmi:id="_6I-1M6tbEd-05ucACzIa4Q"/>
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6I-1NKtbEd-05ucACzIa4Q" x="468" y="96" height="93"/>
  </children>
  <styles xmi:type="notation:DiagramStyle" xmi:id="_5XgU8atbEd-05ucACzIa4Q"/>
  <element xmi:type="entity:Package" href="Second.entities#//@package"/>
</notation:Diagram>


If there are any settings / configuration which would fix this then kindly let me know. If more information needs to be provided for this then kindly let me know.

Thanks.
Regards,
- Nimesh
Re: Expression Label Mapping not displayed after reopening of saved diagram [message #554179 is a reply to message #554134] Fri, 20 August 2010 12:49 Go to previous message
Nimesh Mising name is currently offline Nimesh Mising nameFriend
Messages: 23
Registered: March 2010
Junior Member
Hi,

After debugging this further with other examples that I had prepared / available in OSS I found that the resource returned for my grammar's Object e.g. PackageImpl/EntityImpl is null when things are not working. In the examples when they are working fine the resource returned is XTextResource. The line where this comparison is done is in XMLSaveImpl.sameDocSingle
Resource res = value.eResource();
return res == helper.getResource() || res == null ? SAME_DOC : CROSS_DOC;

Similarly when the ID is being retrieved if the call goes to XTextResource it is able to retrieve the label and hence create the "element" tag.

I am not sure if I missed anything in gmfgraph, gmfmap or gmfgen to ensure that the semantic resource being used by GMF is text. The two attributes that I am aware of in gmfgen I have set it "Same File For Diagram And Model" = false and "Domain File Extension" = "entities" (same as XText model file extension).

Is there something else missing?

Thanks.
Regards,
- Nimesh
Previous Topic:Problem: GMF not visible in modeling build
Next Topic:CoreException / Resource contains no diagram
Goto Forum:
  


Current Time: Fri Apr 26 07:59:22 GMT 2024

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

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

Back to the top