Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Validation: generating error messages(But what does 'feature' do?)
icon5.gif  Validation: generating error messages [message #625310] Wed, 22 September 2010 08:13 Go to next message
Bodo is currently offline BodoFriend
Messages: 27
Registered: August 2010
Junior Member
In the validation path, one can issue error messages via the method call 'error'. The form I use is:

protected void error(String string, EObject source, Integer feature)

Now, I wonder, what one can path trough this message by the 3rd parameter 'feature'? In the example, a value form xxxPackage is chosen corresponding somehow to the grammar rule.

But what does this parameter do?
Re: Validation: generating error messages [message #625449 is a reply to message #625310] Wed, 22 September 2010 08:32 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Bodo,

EMF generates a bunch of integer constants in the package that identify
features of your metamodel.
Consider the following example:

entity FOO {

}

where foo is the value of the name property of your entity. If a
validation marks the name as invalid (because it's all uppercase) you
want to identify the invalid attribute together with the invalid object.
So you'd call error("Invalid name", checkedEntity,
MyDslPackage.ENTITY__NAME). The editor will underline only FOO. If you
skip the feature and pass null, the complete entity will be underlined.

Hope that clarifies things.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 22.09.10 10:13, schrieb Bodo:
> In the validation path, one can issue error messages via the method call
> 'error'. The form I use is:
>
> protected void error(String string, EObject source, Integer feature)
> Now, I wonder, what one can path trough this message by the 3rd
> parameter 'feature'? In the example, a value form xxxPackage is chosen
> corresponding somehow to the grammar rule.
>
> But what does this parameter do?
Previous Topic:FeatureEList cannot be cast to BasicEList
Next Topic:FeatureEList cannot be cast to BasicEList
Goto Forum:
  


Current Time: Fri Apr 26 10:09:46 GMT 2024

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

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

Back to the top