Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Validation fragments
Validation fragments [message #1696918] Fri, 29 May 2015 11:36 Go to next message
Anakreontas Mentis is currently offline Anakreontas MentisFriend
Messages: 85
Registered: October 2014
Member
My project's Generate.mwe2 file contains a fragment for validation:
fragment = validation.ValidatorFragment auto-inject {
// composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
which produced an xtend file named MyDslValidator.xtend.
I defined methods in the xtend class annotated with @check but they don't seem to apply. If I enter invalid input (which is syntactically correct) eclipse does not report errors or warnings.

The documentation also refers to a second fragment named org.eclipse.xtext.generator.validation.JavaValidatorFragment. This resulted in a Java file under the validation package. Except for the implementation language, what is the difference between the two fragments?
Re: Validation fragments [message #1696919 is a reply to message #1696918] Fri, 29 May 2015 11:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13876
Registered: July 2009
Senior Member
How does your check rule look like

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Validation fragments [message #1696923 is a reply to message #1696919] Fri, 29 May 2015 12:00 Go to previous message
Anakreontas Mentis is currently offline Anakreontas MentisFriend
Messages: 85
Registered: October 2014
Member
My bad. Ignore this question.

I had a misconception about validation. In the xtext implementation I provided a Boolean method that returned true if the invariant hold. When I added the fragment for the Java validator, the generated file contained an example that showed I should implement void methods and use the warning and error methods to indicate problems.
Previous Topic:Get absolute path of .mydsl file in doGenerate(Resource resource, IFileSystemAccess fsa)
Next Topic:Content Assist Contexts
Goto Forum:
  


Current Time: Sat Apr 10 20:05:40 GMT 2021

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

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

Back to the top