Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Validation fragments
Validation fragments [message #1696918] Fri, 29 May 2015 07:36 Go to next message
Eclipse UserFriend
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 07:52 Go to previous messageGo to next message
Eclipse UserFriend
How does your check rule look like
Re: Validation fragments [message #1696923 is a reply to message #1696919] Fri, 29 May 2015 08:00 Go to previous message
Eclipse UserFriend
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: Sun Jul 06 06:51:30 EDT 2025

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

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

Back to the top