EMF Constraint issue [message #1590065] |
Wed, 28 January 2015 15:39  |
Eclipse User |
|
|
|
I followed the standard practice of adding constraint, but when IValidator.validate() executes the constraint is not being executed because it's not being registered. I did some debugging and see that myContraints List in GetBatchConstraintsOperation is empty, but ClientContext has my context present. Also IClientSelector is being called. What could be the issue with failure to add my constraint?
Here is my extension points definitions
<extension
point="org.eclipse.emf.validation.constraintProviders">
<category
id="myCategory"
mandatory="false"
name="Non Empty Reference"/>
<constraintProvider
cache="true"
mode="Live">
<package namespaceUri="http://myNamespace"/>
<constraints categories="myCategory">
<constraint
class="NonEmptyReferenceConstraint"
id="ReferenceNotEmpty"
isEnabledByDefault="true"
lang="Java"
mode="Live"
name="Non Empty References"
severity="ERROR"
statusCode="1">
<description>
All items in an EXT library model should have some unique identifier or name.
</description>
<message>
..been found to have no unique identifier (name or title).
</message>
</constraint>
</constraints>
</constraintProvider>
</extension>
<extension
point="org.eclipse.emf.validation.constraintBindings">
<clientContext
default="false"
id="referenceContext">
<selector class="ValidationDelegateClientSelector"/>
</clientContext>
<binding
context="referenceContext"
category="myCategory"/>
</extension>
Thanks,
Alex
|
|
|
|
Re: EMF Constraint issue [message #1590278 is a reply to message #1590122] |
Wed, 28 January 2015 18:23  |
Eclipse User |
|
|
|
Hi, Alex,
Yes, I would have expected it to have been called under those
circumstances. Such a basic regression should have turned up in the
automated tests, though, so perhaps there was something else at play in
the filtering of the constraints.
Cheers,
Christian
On 2015-01-28 21:23:37 +0000, Alex Kravets said:
> The problem was that I was using IBatchValidator on a Live constraint,
> once I changed to Batch mode, everything worked. However, I did specify:
>
> IBatchValidator validator =
> ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);
> validator.setIncludeLiveConstraints(true);
>
> So shouldn't my constraint be called anyway?
|
|
|
Powered by
FUDForum. Page generated in 0.09873 seconds