Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Validating string list items under a parent object.
Validating string list items under a parent object. [message #1271249] Fri, 14 March 2014 16:33 Go to next message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
Registered: March 2010
Location: UK
Member
If I have the following definition in my model::

Attribute : (=> name=QualifiedName '[' ']' ) (( '='  (values+=STRING)? (',' values+=STRING)* ';') 


Now (for example), if I want to validate all values against a whitelist of values (for example "one", "two", "three").

I'm struggling to find a way to underline the correct item(s), I can only find a way to add an error flag to the parent object (in this case 'Attribute'). This is because the 'error' method within the validation class can only take EObject or EStructuralFeature and when the validation fails, I only have instances of String and the parent class.

Is there a way that I can use the parent class, and the text content or index of a child string within the EList (with name 'values'), and underline the correct item that failed the validation (without changing the type of the values from STRING to some other containing object)?

Re: Validating string list items under a parent object. [message #1271277 is a reply to message #1271249] Fri, 14 March 2014 18:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi this works out of the box. There are error methods that accept an
index besides the estructuralfeature

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Validating string list items under a parent object. [message #1271304 is a reply to message #1271277] Fri, 14 March 2014 19:42 Go to previous message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
Registered: March 2010
Location: UK
Member
Christian Dietrich wrote on Sat, 15 March 2014 03:08
Hi this works out of the box. There are error methods that accept an
index besides the estructuralfeature

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de



Thank you. A total non-issue. Sorry.
Previous Topic:Simplified include
Next Topic:Common Terminal-Grammar generates Compile-Errors
Goto Forum:
  


Current Time: Fri Apr 19 11:59:04 GMT 2024

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

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

Back to the top