Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Update the node model (INode) xText
Update the node model (INode) xText [message #1785311] Thu, 12 April 2018 10:43 Go to next message
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 3
Registered: February 2018
Junior Member
Hi,

I have a question about updating the node model (INode) xText after adding the object in the embedded editor.

I have Sirius editor and xText editor. The Sirius editor is defined by a double-click on the node that opens the embedded editor (Xtext-Sirius-integration, https://github.com/ObeoNetwork/Xtext-Sirius-integration).

In an embedded editor, I add an object (eg Parameter1). I close the embedded editor (ctrl + enter). Sirius editor has changes, so I will save it.

Then I need to (programmatically) to determine the position of the object (Parameter1) in xText:

ICompositeNode node = NodeModelUtils.findActualNodeFor(Parameter1);


However, the findActualNodeFor method returns null because the INode for Parameter1 is not yet created. When I close the Sirius editor and open again, the findActualNodeFor method returns INode.

If I add the same object directly in the xText editor and save the editor, findActualNodeFor also returns INode.

Do you need to update node model the xText after close the embedded editor?

Thanks for every advice.

Martin
Re: Update the node model (INode) xText [message #1785419 is a reply to message #1785311] Fri, 13 April 2018 15:24 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 440
Registered: July 2009
Senior Member
If you have both an Xtext editor and a Sirius editor opened at the same time on "the same" Xtext model, each editor has its own version of the model in memory. A change made on one copy will not be available immediately and automatically on the other.

If you make a change on the Xtext side, until it is saved it only exist in the memory of the Xtext editor and Sirius can not know about it. When you save the Xtext file, if Sirius has an opened session with that file loaded it will detect the file has changed on disk and automatically reload it so the change is visible inside the session (if you have Sirius representations opened at the time of reload, they will be refreshed automatically, at least when using the default settings).

If you make a model change in the context of Sirius, the change will only be visible on disk after the session is saved. Whether or not the file change is seen by your Xtext editor is more of an Xtext question.


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Update the node model (INode) xText [message #1785426 is a reply to message #1785419] Fri, 13 April 2018 16:33 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

Conventional editors tend to be quite good these days at listening to the platform resource changed notifications to reload on change. An embedded editor is more specialized so it may be that the equivalent external observation/response has not been registered. It could work. Use a debugger to see how an Xtext editor updates, then see where the change notification gets lost for your embedded editor.

Regards

Ed Willink
Ed Willink
Previous Topic:How to display icons on Palette.
Next Topic:Reuse of a Dialog in properties view
Goto Forum:
  


Current Time: Thu Sep 20 07:17:19 GMT 2018

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

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

Back to the top