Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Synchronization problem from Xtext to Sirius
Synchronization problem from Xtext to Sirius [message #1767538] Fri, 07 July 2017 02:23 Go to next message
mind calm is currently offline mind calmFriend
Messages: 57
Registered: July 2017
Member
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!


Best regards!

by Keep Mind Calm
Re: Synchronization problem from Xtext to Sirius [message #1767711 is a reply to message #1767538] Mon, 10 July 2017 08:17 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
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 08:40 Go to previous messageGo to next message
mind calm is currently offline mind calmFriend
Messages: 57
Registered: July 2017
Member
Dear Maxime Porhel,

Thanks for your guiding, I will try it.

Regards!


Best regards!

by Keep Mind Calm

[Updated on: Mon, 10 July 2017 08:41]

Report message to a moderator

Re: Synchronization problem from Xtext to Sirius [message #1767717 is a reply to message #1767714] Mon, 10 July 2017 09:27 Go to previous messageGo to next message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
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


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: Synchronization problem from Xtext to Sirius [message #1767770 is a reply to message #1767717] Tue, 11 July 2017 01:22 Go to previous message
mind calm is currently offline mind calmFriend
Messages: 57
Registered: July 2017
Member
Dear Cedric Brun,

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

Regards!


Best regards!

by Keep Mind Calm
Previous Topic:FeatureNotFoundException
Next Topic:The fill color field from properties view not synchronized with sirius graphical element color.
Goto Forum:
  


Current Time: Fri Apr 26 03:13:30 GMT 2024

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

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

Back to the top