Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext model(Getting deltas for Xtext model)
Xtext model [message #1611517] Wed, 11 February 2015 12:17 Go to next message
Luis De Bello is currently offline Luis De BelloFriend
Messages: 95
Registered: January 2015
Member
Hi guys,

I am working with one grammar from xtext and I would like to create a tree structure based on the document, however I do not want to traverse the whole structure for every change ,so I was looking for a way of detecting the delta between one version and the next one. I used a listener IXtextModelListener but when I did resource.getContents().get(0) was giving me new objects, my expectation was to receive the same object with more children because I am modifying some leaf nodes instead of affecting the root node.

I would like to know if someone had to deal with a similar problem or if someone can provide me some lights on this.

Of course another possibility could be to keep the previous document and compare it with the new one when the listener is fired but I am not sure if that is the best way to do it

Thanks in advance
Re: Xtext model [message #1611559 is a reply to message #1611517] Wed, 11 February 2015 12:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14668
Registered: July 2009
Senior Member
Hi,

xtext does not produce model based deltas


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext model [message #1611670 is a reply to message #1611559] Wed, 11 February 2015 14:37 Go to previous messageGo to next message
Luis De Bello is currently offline Luis De BelloFriend
Messages: 95
Registered: January 2015
Member
Hi Christian,

Thanks for the answer, so I will have to regenerated the tree every time

Regards,
Luis
Re: Xtext model [message #1611723 is a reply to message #1611670] Wed, 11 February 2015 15:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14668
Registered: July 2009
Senior Member
Maybe you can use the Node Model (NodeModelUtils.findActualNodeFor(object).getText() to calculate hashes for the text of model elements.
Then store the hashes in the tree nodes.
thus you could at least keep parts of the tree



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext model [message #1611729 is a reply to message #1611670] Wed, 11 February 2015 15:26 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14668
Registered: July 2009
Senior Member
maybe you could use hash(NodeModelUtils.findActualNodeFor(object).getText() ) to build something like that yourself

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Problem adding custom feature & operations with implementations to Xtext generated ECore model
Next Topic:Folders: source, model, target, ...?
Goto Forum:
  


Current Time: Fri Apr 26 18:49:07 GMT 2024

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

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

Back to the top