|
Re: EMF Validation: Diagnostician vs. ModelValidationService [message #762015 is a reply to message #761917] |
Wed, 07 December 2011 12:38 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Kauke,
I'm not all the familiar with how the extended validation framework
works. Do you have additional registered constraints in your
plugin.xml? I'm not sure it's intended to invoke the intrinsic
constraints of the core framework...
On 07/12/2011 1:36 AM, Hauke Fuhrmann wrote:
> Hi there,
>
> in an Eclipse Application (yes, running Eclipse Platform), I want to
> call EMF Validation programmatically.
> What is the right way to do it? I found
>
> org.eclipse.emf.validation.service.ModelValidationService
> ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH).validate(eobject);
>
> vs.
> org.eclipse.emf.ecore.util.Diagnostician
> Diagnostician.INSTANCE.validate(eobject);
>
> The first results always an empty Status with
> "Status OK: org.eclipse.emf.validation code=10 No constraints were
> evaluated. null"
> The second results a Diagnostic with proper error messages. So my
> Validator (CompleteOCL) is registered correctly.
>
> In both cases I register my validator with an earlyStartup:
> @Override
> public void earlyStartup() {
> URI oclURI = URI.createPlatformResourceURI("myPath",false);
> EValidator validator =
> new CompleteOCLEObjectValidator(MyPackage.eINSTANCE, oclURI);
> EValidator.Registry.INSTANCE.put(MyPackage.eINSTANCE,validator);
> }
>
> What's the difference between the two approaches. Why is the
> ModelValidationService not seeing my constraints while the
> Diagnostician does? Is it the right way to use the Diagnostician? Why
> are there multiple approaches anyways?
>
> Cheers,
> Hauke
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02619 seconds