Non lazy Ocl Validation through Dynamic Constaint Provider [message #64498] |
Thu, 06 November 2008 16:34  |
Eclipse User |
|
|
|
Hi all,
I'm using EMF Validation framework with both Java and OCL constraints.
Since the ocl constraints I'm using are a little bit complex, I do the
same thing than in org.eclipse.emf.validation.examples.ocl by using ".ocl"
files.
Everything works fine, but from I'm trying to obtain some early
enabling/disabling of constraints/categories.
This works fine for "Static" provided constraints (Java or [CDATA]-OCL),
but I noticed that dynamic provided constraints (.ocl files) aren't loaded
at start-up but just at the beginning of the first validation.
So until I start the validation, the preference page won't contain my
dynamic-provided constraints and I won't be able to enable/disable them
(or their categories).
Is it possible to have an early "loading" of dynamic-provided constraints
in order to fill preferences pages?
Thanks!
Regards, Franco
|
|
|
Re: Non lazy Ocl Validation through Dynamic Constaint Provider [message #64522 is a reply to message #64498] |
Thu, 06 November 2008 17:19  |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
Hi, Franco,
This is an EMF Validation question, so I have included the EMF newsgroup
in my reply.
The preference page is "hacked" to force initialization of the
plugin.xml constraints if they haven't already been loaded. This works
because the ZML provider is known to be static.
Other providers cannot be assumed to be static: attempting, for
example, to force a provider that extracts constraints from UML Profiles
would be difficult if no profiles are loaded, yet. And in what resource
set, anyway?
However, there is a work-around that I have tried, myself: the
ConstraintSelectionBlock together with the IConstraintFilter API
provides a way for you to define your own preference page, for your
application, that includes only constraints of interest to you. For
example, the constraints provided by your OCL-document provider.
Because this is your own preference page, you can have it trigger
initialization of your OCL provider, to load all of its constraints, in
much the same way that the stock preference page does with the
XmlConstraintProvider.
Unfortunately, this does require adding another preference page that
looks much like the shared preference page. It's rather too bad that
the default page still exists; perhaps we could create a Capability that
can optionally suppress it?
HTH,
Christian
Franco Bergomi wrote:
> Hi all,
> I'm using EMF Validation framework with both Java and OCL constraints.
> Since the ocl constraints I'm using are a little bit complex, I do the
> same thing than in org.eclipse.emf.validation.examples.ocl by using
> ".ocl" files.
>
> Everything works fine, but from I'm trying to obtain some early
> enabling/disabling of constraints/categories.
> This works fine for "Static" provided constraints (Java or [CDATA]-OCL),
> but I noticed that dynamic provided constraints (.ocl files) aren't
> loaded at start-up but just at the beginning of the first validation.
>
> So until I start the validation, the preference page won't contain my
> dynamic-provided constraints and I won't be able to enable/disable them
> (or their categories).
>
> Is it possible to have an early "loading" of dynamic-provided
> constraints in order to fill preferences pages?
>
> Thanks!
> Regards, Franco
>
|
|
|
Powered by
FUDForum. Page generated in 0.03620 seconds