Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext document set content does not update the model immediately(Xtext model update)
Xtext document set content does not update the model immediately [message #1832672] Wed, 23 September 2020 08:45 Go to next message
Georgiana Ecobici is currently offline Georgiana EcobiciFriend
Messages: 23
Registered: July 2019
Junior Member
It is possible to trigger the update of the model after getDocument().set(content)?

The model seems to be updated later, not after updating the document content.
Re: Xtext document set content does not update the model immediately [message #1832675 is a reply to message #1832672] Wed, 23 September 2020 09:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13628
Registered: July 2009
Senior Member
how do you access the model?
maybe you can call a readOnly on the xtextDocument


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext document set content does not update the model immediately [message #1832682 is a reply to message #1832675] Wed, 23 September 2020 09:54 Go to previous messageGo to next message
Georgiana Ecobici is currently offline Georgiana EcobiciFriend
Messages: 23
Registered: July 2019
Junior Member
I access the model like this:
XtextResource resource = provider.getResource();
EList<EObject> content = resource.getContents();
domainModel = (Model) resource.getContents().get(0);

I called document.readOnly like below, I haven't added any code in the process method and now it seems to work:
document.readOnly(new IUnitOfWork.Void<XtextResource>() {
@Override
public void process(XtextResource state) throws Exception {
}
});

Thanks!
Re: Xtext document set content does not update the model immediately [message #1832683 is a reply to message #1832682] Wed, 23 September 2020 09:58 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13628
Registered: July 2009
Senior Member
btw the propery way would be to do the read operation in that work

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Open call hierarchy option
Next Topic:Help with labeling features
Goto Forum:
  


Current Time: Tue Oct 20 17:50:44 GMT 2020

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

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

Back to the top