Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » ILocationInFileProvider Fails to Get Correct Position(INode does not exist for semantic element.)
ILocationInFileProvider Fails to Get Correct Position [message #1219754] Thu, 05 December 2013 16:08
Philip Alldredge is currently offline Philip AlldredgeFriend
Messages: 14
Registered: February 2013
Junior Member
I am editing an XtextResource semantically without the xtext document being open. After editing, I would like to find the position in the text document of one of the semantic objects I have added to the model and then open the editor.

I have attempted to use ILocationInFileProvider and NodeModelUtil to get this information. However, NodeModelUtil returns null unless I first manually open the text file. Once I have manually opened the text file then I can close the xtext editor and my code can now find the correct location.

I have also attempted to use XtextResource.getParseResult with unforutnate results. The parse results contains the semantic element accessible by navigating etRootASTElement(), but does not contain a corresponding node as provided by getRootNode().getAsTreeIterable().

In this particular case, I can work around the issue by loading the resource into a new resource set, but that seems inefficient and I believe it could cause issues in the future.

Does anyone have any suggestions on how to do what I'm attempting? Is there a way to force xtext to refresh the node model without opening the editor?

Thank you
Previous Topic:Problem Executing the Standalone jar
Next Topic:How to use Xtext 2.5 new Full Maven Support in own code generator shipped as maven plugin?
Goto Forum:

Current Time: Thu Nov 26 10:45:11 GMT 2020

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

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

Back to the top