Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to exclude some specific resource from xtext validation?
How to exclude some specific resource from xtext validation? [message #1734657] Fri, 10 June 2016 08:20 Go to next message
Yuwen Hu is currently offline Yuwen HuFriend
Messages: 6
Registered: July 2014
Junior Member
We have our own java validator to validate resource with some fixed suffix.
like *.yam...

But we want to exclude some specific resources from the validator.
like test-*.yam...

How can we customize the xtext validation framework to achieve this?
Re: How to exclude some specific resource from xtext validation? [message #1734658 is a reply to message #1734657] Fri, 10 June 2016 08:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13207
Registered: July 2009
Senior Member
hi i am note sure "why" you want do do this. and if you really want to stop valiation only
(not parsing, indexing, scoping, ...)

but you may override

org.eclipse.xtext.validation.AbstractInjectableValidator.validate(EClass, EObject, DiagnosticChain, Map<Object, Object>)

and test the EObject's Resource URI


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to exclude some specific resource from xtext validation? [message #1734662 is a reply to message #1734658] Fri, 10 June 2016 08:35 Go to previous messageGo to next message
Yuwen Hu is currently offline Yuwen HuFriend
Messages: 6
Registered: July 2014
Junior Member
Hi Christian,
Thanks for your quickly reply.

Short words for the exclusion reason, our validator checks for our own specific rules. But those rules not applicable for most of the standard resource.
So our target is to only validate the resource which applicable to the specific rules, but exclude all the other resources. (They have the same suffix, so to say).

Any other suggestions to implement our requirement?
Of cause, we can implement filters to filter out specific rules result after validating .
But that cost addition time and cpu to run the validation. So that's not our first choice.
Re: How to exclude some specific resource from xtext validation? [message #1734664 is a reply to message #1734662] Fri, 10 June 2016 08:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13207
Registered: July 2009
Senior Member
i thing your

@Check methods should take care


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to exclude some specific resource from xtext validation? [message #1734672 is a reply to message #1734664] Fri, 10 June 2016 08:51 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13207
Registered: July 2009
Senior Member
or have a look at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(Resource, CheckMode, CancelIndicator)

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:I want here to escape all characters including keywords declared in certain rules
Next Topic:Parsing comma separated list
Goto Forum:
  


Current Time: Wed Nov 20 08:00:04 GMT 2019

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

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

Back to the top