Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Validation in Xtext(Validation in Xtext)
icon5.gif  Validation in Xtext [message #1694390] Tue, 05 May 2015 04:38 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi All,

We use Diagnostician.INSTANCE.validate() method if we manually want to trigger the editor.

Is it possible to filter it for error types?

I mean to say, can we validate only the validations which produces errors but not warnings ?


Thanks for any help Smile


Arshad
Re: Validation in Xtext [message #1694392 is a reply to message #1694390] Tue, 05 May 2015 05:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

no you have to build that yourself. (maybe you can abuse the existing IssueSeveritiesProvider/ConfigurableIssueCodesProvider/IssueSeverities for that)

what is the reason for doing that?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Validation in Xtext [message #1694401 is a reply to message #1694392] Tue, 05 May 2015 06:55 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi Christian,
Thanks for your reply.

Actually I have 2 grammars , one with extension .model1 and second one with .model2.

.model2 files refer data from .model1 files.

And suppose, if .model1 files have errors then I do not want to continue generation for .model2 file.

I detect these problems by calling Diagnostician.INSTANCE.validate() method from validator class of .model2 file for the referred content of .model1 files.

So at this stage, if .model1 files have errors, I notify this in .model2 file saying that the referred file has errors OTHERWISE it continues generating outputs which ends up in many problems/exceptions.

So I needed this.

Do you see a better approach than this ?



Regards,
Arshad


Arshad
Re: Validation in Xtext [message #1694402 is a reply to message #1694401] Tue, 05 May 2015 06:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
id rather implement the generator failsafe

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Validation in Xtext [message #1694410 is a reply to message #1694390] Tue, 05 May 2015 07:52 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Arshad,

you may want to use the IResourceValidator instead of the diagnostician
singleton. The resource validation will also include errors on the
resource level and configure the diagnostician properly before it
invokes that one.

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Find help at http://xtext.itemis.com or xtext(@)itemis.com
Blog: zarnekow.blogspot.com
Twitter: @szarnekow
Google+: https://www.google.com/+SebastianZarnekow
icon5.gif  Re: Validation in Xtext [message #1694417 is a reply to message #1694410] Tue, 05 May 2015 08:29 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi Sebastian,

Thanks for your reply.

But is there any execution time related differences between IResourceValidator and Diagnostician ?


Regards,
Arshad


Arshad
Re: Validation in Xtext [message #1694432 is a reply to message #1694417] Tue, 05 May 2015 09:40 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
I don't understand the question. What do you refer to by 'execution-time
related'? The IResourceValidator will provide the correct result while
Diagnostician.INSTANCE will not provide the correct result, e.g. it
misses all Resource.getErrors

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Find help at http://xtext.itemis.com or xtext(@)itemis.com
Blog: zarnekow.blogspot.com
Twitter: @szarnekow
Google+: https://www.google.com/+SebastianZarnekow
Previous Topic:JvmModel without Xbase?
Next Topic:xtext-utils updates?
Goto Forum:
  


Current Time: Tue Apr 23 08:47:12 GMT 2024

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

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

Back to the top