Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Getting the line number of the config file
Getting the line number of the config file [message #1749935] Wed, 14 December 2016 06:44 Go to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
I am using xcore, and trying to create my own validator class.
If there is a problem with the config, I want to display an error message like this:
File name(line number): error message

The File name can be taken from the resource's URI, but I did not find any method that will give me the line number in the file where the resource is configured. How do I get the line number?
Re: Getting the line number of the config file [message #1749936 is a reply to message #1749935] Wed, 14 December 2016 06:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11396
Registered: July 2009
Senior Member
hi you have to calculate the line number from the node model. see org.eclipse.xtext.validation.DiagnosticConverterImpl.getLocationData(Diagnostic)

what i dont get is: why dont you simply use xtexts validator infrastructure and let xtext do the job for you


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Getting the line number of the config file [message #1750012 is a reply to message #1749936] Thu, 15 December 2016 06:39 Go to previous message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
I don't mainly rely on the input from the xtext grammar, I have to do some preprocessing before I can check for the validity, thus, I created my own validator.
Or is it possible to use the xtext validator after doing some preprocessing?
Previous Topic:Implementing java web editor
Next Topic:Embedded Editor wont list references to an external Ecore model
Goto Forum:
  


Current Time: Fri Nov 24 13:22:02 GMT 2017

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

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