|
Re: Cancel EVL validation that is in progress [message #987746 is a reply to message #987705] |
Tue, 27 November 2012 21:36 |
|
Hi Maarten,
It depends on how you're launching the EVL script from your job. Since you're running the EVL script from Eclipse, you're probably calling EclipseContextManager#setup to set up Eclipse integration for the context of the EVL module, right?
There's a version of setup that takes both the IEolContext and an IProgressMonitor. If you tie up the return value of the IProgressMonitor#isCanceled() method to the cancel button, the EVL script should be cancelled properly when the user hits the cancel button.
That's pretty much how the cancel button is implemented for all the E*L launch configurations, basically.
As for the progress bar, I don't think we have anything in Epsilon for that. Could you file a feature request for that? How should we measure progress? Should we measure progress by the number of checked constraints, or by the number of checked objects? I think the second option won't scale well to large models, though.
No problem,
Antonio
|
|
|
Re: Cancel EVL validation that is in progress [message #987808 is a reply to message #987746] |
Wed, 28 November 2012 09:09 |
Maarten Bezemer Messages: 117 Registered: February 2012 |
Senior Member |
|
|
Antonio Garcia-Dominguez wrote on Tue, 27 November 2012 22:36
It depends on how you're launching the EVL script from your job. Since you're running the EVL script from Eclipse, you're probably calling EclipseContextManager#setup to set up Eclipse integration for the context of the EVL module, right?
Not exactly, the validator is created using
IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);
...
validator.validate(myObject);
During validation my model constraint (provided using the org.eclipse.emf.validation.constraintProviders extension) is found.
In the validate() method I use (a slightly modified version of) the Eclipse diagnostican:
EObject target = ctx.getTarget();
Diagnostician diagnostician = new MyDiagnostician();
Diagnostic diagnostics = diagnostician.validate(target);
The diagnostican class finds the EVL constraint files using the used instances of the extension org.eclipse.epsilon.evl.emf.validation and the actual validation (using the EMF Validation framework) is performed.
Hm... now I wrote this down: this seems a little complicated just to get validation working...
Antonio Garcia-Dominguez
There's a version of setup that takes both the IEolContext and an IProgressMonitor. If you tie up the return value of the IProgressMonitor#isCanceled() method to the cancel button, the EVL script should be cancelled properly when the user hits the cancel button.
So, I do not have this setup() method I believe..?
I try to keep the EMF validation in the loop, so the validator shows in the Eclipse 'Model Validation' preferences, so the user is able to disable them. And to be able to get regular notifications of the validation result using the IValidationListener interface.
I do need another method to activate the EVL validations? (preferably while keep using the Eclipse/EMF validation framework)
Antonio Garcia-Dominguez
As for the progress bar, I don't think we have anything in Epsilon for that. Could you file a feature request for that? How should we measure progress? Should we measure progress by the number of checked constraints, or by the number of checked objects? I think the second option won't scale well to large models, though.
Hm... I did not think of a measure for the amount of work...
Checking by the amount of constraints might be an option, as it is probably easier to get the total amount than the total amount of (nested) objects that needs to be checked? (Especially since the complete resource is currently validated). Also after parsing the EVL files, the number of validation rules is probably known already?
Only thing is, I register a unknown/certain amount of EVL validators. The total progress of one validation cycle, should keep this amount in mind...? Also possible as org.eclipse.epsilon.evl.emf.validation.EValidatorPopulator registers all my validators.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02742 seconds