Skip to main content



      Home
Home » Eclipse Projects » Sirius » Synchronization problem from Xtext to Sirius
Synchronization problem from Xtext to Sirius [message #1767538] Thu, 06 July 2017 22:23 Go to next message
Eclipse UserFriend
HI,
I met a problem when I use Xtext and Sirius to edit my model.
In my model "my.family", I have 3 elements A B and C. In Xtext editor, it is like this:
Man A,
Man B,
Man C

In the Sirius diagram, there has 3 DNode Instances:
DNode A refers to my.family.members[0]
DNode B refers to my.family.members[1]
DNode C refers to my.family.members[2]

If I insert a element D before B in xtext editor:
Man A,
Man D,
Man B,
Man C

than save the model in xtext editor, the Sirius editor will reload it and synchronize to diagram.
but the location (also size) of B C D will be mismatched:
DNode A refers to my.family.members[0]
the 2nd DNode "B" change name to "D", refers to my.family.members[1]
the 3rd DNode "C" change name to "B", refers to my.family.members[2]
there will be a new DNode "C", and get a random location
(maybe there has a algorithm for this initial location).
It seems in diagram, Man D take place of Man B, Man B take place of Man C, Man C get a new location.
The reason of this problem is the mapping relation between Xtext model elements and Sirius diagram elements, is depend on index of xtext model element, which is very week and unreliable.
If the type of elements are different, the diagram will be more inconceivable, while we editing (insert, delete or change type of element) in xtext editor.

My question is, any one have some idea to solve this problem? Or any solution to enhance the relationship between Xtext model elements and Sirius diagram elements?

best regards!
Re: Synchronization problem from Xtext to Sirius [message #1767711 is a reply to message #1767538] Mon, 10 July 2017 04:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi

It seems you should look for eKeys to allow Sirius to reference your domain elements with something like my.family.members[name='foo'] instead of my.family.members[1]

To do so, you need to set the eKeys property of your containment EReference in your family.ecore metamodel.

Regards,
Re: Synchronization problem from Xtext to Sirius [message #1767714 is a reply to message #1767711] Mon, 10 July 2017 04:40 Go to previous messageGo to next message
Eclipse UserFriend
Dear Maxime Porhel,

Thanks for your guiding, I will try it.

Regards!

[Updated on: Mon, 10 July 2017 04:41] by Moderator

Re: Synchronization problem from Xtext to Sirius [message #1767717 is a reply to message #1767714] Mon, 10 July 2017 05:27 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
Another option is to define the fragment provider for your DSL, this will have the benefit that you won't have to add back the eKeys in the .ecore when Xtext re-generates it.
Jan described the process in a blog post lately:

https://typefox.io/linking-xtext-models-with-other-emf-models
Re: Synchronization problem from Xtext to Sirius [message #1767770 is a reply to message #1767717] Mon, 10 July 2017 21:22 Go to previous message
Eclipse UserFriend
Dear Cedric Brun,

Thanks very much for your reply , I will try it too.

Regards!
Previous Topic:FeatureNotFoundException
Next Topic:The fill color field from properties view not synchronized with sirius graphical element color.
Goto Forum:
  


Current Time: Wed Jul 23 23:13:26 EDT 2025

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

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

Back to the top