|
Re: Validation: generating error messages [message #625449 is a reply to message #625310] |
Wed, 22 September 2010 08:32 |
Sebastian Zarnekow 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?
|
|
|
Powered by
FUDForum. Page generated in 0.02329 seconds