Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Non lazy Ocl Validation through Dynamic Constaint Provider
Non lazy Ocl Validation through Dynamic Constaint Provider [message #64498] Thu, 06 November 2008 21:34 Go to next message
Franco Bergomi is currently offline Franco Bergomi
Messages: 2
Registered: July 2009
Junior Member
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 22:19 Go to previous message
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
>
Previous Topic:Check of OCL constraints embedded in UML2 profile
Next Topic:How to define collection type of variable
Goto Forum:
  


Current Time: Mon Oct 20 04:46:41 GMT 2014

Powered by FUDForum. Page generated in 0.10117 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software