|
|
Re: Run CompleteOCL Validation manually [message #761591 is a reply to message #761354] |
Tue, 06 December 2011 17:40 |
Hauke Fuhrmann Messages: 333 Registered: July 2009 |
Senior Member |
|
|
Hi Ed,
note that I'm not using a standalone application. It is a usual Eclipse
Application.
I use the same earlyStartup code below for the standard EMF Tree Editor
as for my custom code (which is simply executed by pressing a Button).
I was inspired bythe Eclipse help
http://help.eclipse.org/indigo/topic/org.eclipse.ocl.doc/help/Integration.html?path=44_1_7_2#Integration-CompleteOCL
So I would think that registering the validators is correct.
So I guess I execute the validation wrong. Is there another way to call
the built-in validation for EMF?
Cheers,
Hauke
Am 06.12.2011 11:37, schrieb Ed Willink:
> Hi Hauke
>
> It's not clear to me that you have emulated the automated Eclipse plugin
> registrations in your standalone code.
>
> I have often found validations not occurring too. I find the best
> approach is to run two debuggers; one on working code and the other on
> non-working code, and see where they diverge.
>
> Regards
>
> Ed Willink
>
> On 06/12/2011 09:51, Hauke Fuhrmann wrote:
>> Hi there,
>>
>> I try to execute CompleteOLC validation of some of my EObjects
>> programmatically from some Eclipse code.
>>
>> First, I have some Eclipse earlyStartup to register the OCL file
>>
>> @Override
>> public void earlyStartup() {
>> URI oclURI = URI.createPlatformResourceURI("myPath",false);
>> EValidator validator =
>> new CompleteOCLEObjectValidator(MyPackage.eINSTANCE, oclURI);
>> EValidator.Registry.INSTANCE.put(MyPackage.eINSTANCE,validator);
>> }
>>
>> This works fine for validation in the standard EMF tree editor. The
>> OCL constraints are working fine.
>> Now I do this from my own code:
>>
>> MyEObject o = MyFactory.eINSTANCE.createMyEObject();
>> IValidator<EObject> validator =
>> ModelValidationService.getInstance()
>> .newValidator(EvaluationMode.BATCH);
>> IStatus status = validator.validate(infra);
>>
>> Afterwards the status says:
>> "Status OK: org.eclipse.emf.validation code=10 No constraints were
>> evaluated. null"
>>
>> Why are no constraints evaluated? Do I have to call validation
>> differently?
>>
>> Cheers,
>> Hauke
>
|
|
|
Re: Run CompleteOCL Validation manually [message #761598 is a reply to message #761591] |
Tue, 06 December 2011 17:59 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
HI Hauke
It's perhaps five years since I looked at EMFv. It never seemed to do
anything useful for me and as I now realize, it's OCL support was one of
many false starts that ultimately led to EMF delegates in Helios.
I always invoke validation using Diagnostician.validate.
Perhaps EMF validation has some bit rot. If you get
Diagnostician.validate to work you might care to report back on why
ModelValidationService is different.
Regards
Ed Willink
On 06/12/2011 17:40, Hauke Fuhrmann wrote:
> Hi Ed,
>
> note that I'm not using a standalone application. It is a usual
> Eclipse Application.
>
> I use the same earlyStartup code below for the standard EMF Tree
> Editor as for my custom code (which is simply executed by pressing a
> Button).
>
> I was inspired bythe Eclipse help
> http://help.eclipse.org/indigo/topic/org.eclipse.ocl.doc/help/Integration.html?path=44_1_7_2#Integration-CompleteOCL
>
> So I would think that registering the validators is correct.
>
> So I guess I execute the validation wrong. Is there another way to
> call the built-in validation for EMF?
>
> Cheers,
> Hauke
>
> Am 06.12.2011 11:37, schrieb Ed Willink:
>> Hi Hauke
>>
>> It's not clear to me that you have emulated the automated Eclipse plugin
>> registrations in your standalone code.
>>
>> I have often found validations not occurring too. I find the best
>> approach is to run two debuggers; one on working code and the other on
>> non-working code, and see where they diverge.
>>
>> Regards
>>
>> Ed Willink
>>
>> On 06/12/2011 09:51, Hauke Fuhrmann wrote:
>>> Hi there,
>>>
>>> I try to execute CompleteOLC validation of some of my EObjects
>>> programmatically from some Eclipse code.
>>>
>>> First, I have some Eclipse earlyStartup to register the OCL file
>>>
>>> @Override
>>> public void earlyStartup() {
>>> URI oclURI = URI.createPlatformResourceURI("myPath",false);
>>> EValidator validator =
>>> new CompleteOCLEObjectValidator(MyPackage.eINSTANCE, oclURI);
>>> EValidator.Registry.INSTANCE.put(MyPackage.eINSTANCE,validator);
>>> }
>>>
>>> This works fine for validation in the standard EMF tree editor. The
>>> OCL constraints are working fine.
>>> Now I do this from my own code:
>>>
>>> MyEObject o = MyFactory.eINSTANCE.createMyEObject();
>>> IValidator<EObject> validator =
>>> ModelValidationService.getInstance()
>>> .newValidator(EvaluationMode.BATCH);
>>> IStatus status = validator.validate(infra);
>>>
>>> Afterwards the status says:
>>> "Status OK: org.eclipse.emf.validation code=10 No constraints were
>>> evaluated. null"
>>>
>>> Why are no constraints evaluated? Do I have to call validation
>>> differently?
>>>
>>> Cheers,
>>> Hauke
>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03259 seconds