Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Validation] Dynamic constraints?
[Validation] Dynamic constraints? [message #514961] Wed, 17 February 2010 10:17 Go to next message
Patrick Konemann is currently offline Patrick KonemannFriend
Messages: 116
Registered: July 2009
Senior Member
Hi newsgroup,

I found the EMF Validation example (using OCL) in the Eclipse help.
Very useful, thank you!

All constraints are specified during design time AFAIK.
But I would like to define additional (and maybe modify existing) constraints during runtime!
Is that possible with EMF Validation?

The problem is, if I understood it correctly, that all constraints are loaded from constraint providers (which are defined as extensions) and loaded only once.
In other words, I cannot see how I could add a new constraint after the first validation was executed.

Any ideas whether that is possible at all?

Cheers
Patrick
Re: [Validation] Dynamic constraints? [message #515040 is a reply to message #514961] Wed, 17 February 2010 14:31 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Patrick,

I'm glad that the example was helpful.

I can think of two possible avenues for you to try. Constraints can be
dynamically removed from the registry (which is where the preference
page finds them), so if your provider detects some condition that
obsoletes a constraint, it can remove that constraint's descriptor from
the registry. It would be possible, then, to add it back later should
the need arise, and possibly with a different implementation.

I suspect, though, that probably your constraints are more dynamic than
this and don't need to be exposed to the user through the registry and
the preference page. In that case, a constraint provider can offer up
entirely new unregistered constraints every time that it is called upon.
These would be transient, and need only exist for the duration of the
validation operation.

I am assuming, of course, that (a) the framework didn't assume that
constraints were registered when last I worked on it, and (b) nobody has
changed that in the mean-time. It shouldn't be too hard to test this
theory by modifying the OCL example that uses a dynamic constraint
provider to load a *.ocl document. See if you can re-parse the OCL on
each invocation, creating throw-away (unregistered) constraint objects.

HTH,

Christian


On 17/02/10 05:17 AM, Patrick Könemann wrote:
> Hi newsgroup,
>
> I found the EMF Validation example (using OCL) in the Eclipse help.
> Very useful, thank you!
>
> All constraints are specified during design time AFAIK.
> But I would like to define additional (and maybe modify existing)
> constraints during runtime!
> Is that possible with EMF Validation?
>
> The problem is, if I understood it correctly, that all constraints are
> loaded from constraint providers (which are defined as extensions) and
> loaded only once.
> In other words, I cannot see how I could add a new constraint after the
> first validation was executed.
>
> Any ideas whether that is possible at all?
>
> Cheers
> Patrick
Re: [Validation] Dynamic constraints? [message #515260 is a reply to message #515040] Thu, 18 February 2010 09:49 Go to previous messageGo to next message
Patrick Konemann is currently offline Patrick KonemannFriend
Messages: 116
Registered: July 2009
Senior Member
Thank you Christian!

Comments inline.

Patrick


On 17-02-2010 15:31, Christian W. Damus wrote:
> Hi, Patrick,
>
> I'm glad that the example was helpful.
>
> I can think of two possible avenues for you to try. Constraints can be
> dynamically removed from the registry (which is where the preference
> page finds them), so if your provider detects some condition that
> obsoletes a constraint, it can remove that constraint's descriptor from
> the registry. It would be possible, then, to add it back later should
> the need arise, and possibly with a different implementation.

I didn't even know about the preference page ;-)

>
> I suspect, though, that probably your constraints are more dynamic than
> this and don't need to be exposed to the user through the registry and
> the preference page. In that case, a constraint provider can offer up
> entirely new unregistered constraints every time that it is called upon.
> These would be transient, and need only exist for the duration of the
> validation operation.

That sounds great! You're right, I probably do not need the registry.
In my case, the OCL constraints are not stored in some file but the user maintains them in a list during runtime.
So my first guess was to override AbstractConstraintProvider.getBatchConstraints. But then it happens that getBatchConstraints is called only once for the first validation. The validation framework apparently caches the constraints.

Making a constraint transient... how?
I just figured out that I can also remove constraints from the category, is that what you mean?
I tried adding all my constraints to a category, so the validation considers them (like in the example).
Then I removed them by calling Category.removeConstraint and started the validation again. Unfortunately the constraints are still checked. :-(

Could you maybe be more specific on how I can create these transient constraints or how I can remove constraints?


>
> I am assuming, of course, that (a) the framework didn't assume that
> constraints were registered when last I worked on it, and (b) nobody has
> changed that in the mean-time. It shouldn't be too hard to test this
> theory by modifying the OCL example that uses a dynamic constraint
> provider to load a *.ocl document. See if you can re-parse the OCL on
> each invocation, creating throw-away (unregistered) constraint objects.
>
> HTH,
>
> Christian
>
>
> On 17/02/10 05:17 AM, Patrick Könemann wrote:
>> Hi newsgroup,
>>
>> I found the EMF Validation example (using OCL) in the Eclipse help.
>> Very useful, thank you!
>>
>> All constraints are specified during design time AFAIK.
>> But I would like to define additional (and maybe modify existing)
>> constraints during runtime!
>> Is that possible with EMF Validation?
>>
>> The problem is, if I understood it correctly, that all constraints are
>> loaded from constraint providers (which are defined as extensions) and
>> loaded only once.
>> In other words, I cannot see how I could add a new constraint after the
>> first validation was executed.
>>
>> Any ideas whether that is possible at all?
>>
>> Cheers
>> Patrick
>
Re: [Validation] Dynamic constraints? [message #515351 is a reply to message #515260] Thu, 18 February 2010 09:52 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Patrick,

Sorry, I had forgotten about the cache. By default, the constraints
produced by providers are cached, but that can be disabled. The
<constraintProvider> element in the extension point schema has a "cache"
attribute which I see is still documented in the SDK as "for internal
use only." You should ignore that and set it to "false". :-)

You don't actually need to assign constraints to any categories,
especially if you don't need them to appear in the preference page.

If you use the default implementation of the IConstraintDescriptor
interface (AbstractConstraintDescriptor) then you will find that it adds
itself to the registry. You can avoid that by implementing the
interface, yourself. Or, you might be able to just remove the
descriptor from the registry post facto. The latter approach seems
somehow sloppy to me.

HTH,

Christian


On 18/02/10 04:49 AM, Patrick Könemann wrote:
> Thank you Christian!
>
> Comments inline.
>
> Patrick
>
>
> On 17-02-2010 15:31, Christian W. Damus wrote:
>> Hi, Patrick,
>>
>> I'm glad that the example was helpful.
>>
>> I can think of two possible avenues for you to try. Constraints can be
>> dynamically removed from the registry (which is where the preference
>> page finds them), so if your provider detects some condition that
>> obsoletes a constraint, it can remove that constraint's descriptor from
>> the registry. It would be possible, then, to add it back later should
>> the need arise, and possibly with a different implementation.
>
> I didn't even know about the preference page ;-)
>
>>
>> I suspect, though, that probably your constraints are more dynamic than
>> this and don't need to be exposed to the user through the registry and
>> the preference page. In that case, a constraint provider can offer up
>> entirely new unregistered constraints every time that it is called upon.
>> These would be transient, and need only exist for the duration of the
>> validation operation.
>
> That sounds great! You're right, I probably do not need the registry.
> In my case, the OCL constraints are not stored in some file but the user
> maintains them in a list during runtime.
> So my first guess was to override
> AbstractConstraintProvider.getBatchConstraints. But then it happens that
> getBatchConstraints is called only once for the first validation. The
> validation framework apparently caches the constraints.
>
> Making a constraint transient... how?
> I just figured out that I can also remove constraints from the category,
> is that what you mean?
> I tried adding all my constraints to a category, so the validation
> considers them (like in the example).
> Then I removed them by calling Category.removeConstraint and started the
> validation again. Unfortunately the constraints are still checked. :-(
>
> Could you maybe be more specific on how I can create these transient
> constraints or how I can remove constraints?
>
>
>>
>> I am assuming, of course, that (a) the framework didn't assume that
>> constraints were registered when last I worked on it, and (b) nobody has
>> changed that in the mean-time. It shouldn't be too hard to test this
>> theory by modifying the OCL example that uses a dynamic constraint
>> provider to load a *.ocl document. See if you can re-parse the OCL on
>> each invocation, creating throw-away (unregistered) constraint objects.
>>
>> HTH,
>>
>> Christian
>>
>>
>> On 17/02/10 05:17 AM, Patrick Könemann wrote:
>>> Hi newsgroup,
>>>
>>> I found the EMF Validation example (using OCL) in the Eclipse help.
>>> Very useful, thank you!
>>>
>>> All constraints are specified during design time AFAIK.
>>> But I would like to define additional (and maybe modify existing)
>>> constraints during runtime!
>>> Is that possible with EMF Validation?
>>>
>>> The problem is, if I understood it correctly, that all constraints are
>>> loaded from constraint providers (which are defined as extensions) and
>>> loaded only once.
>>> In other words, I cannot see how I could add a new constraint after the
>>> first validation was executed.
>>>
>>> Any ideas whether that is possible at all?
>>>
>>> Cheers
>>> Patrick
>>
>
Re: [Validation] Dynamic constraints? [message #515373 is a reply to message #515351] Thu, 18 February 2010 15:31 Go to previous messageGo to next message
Patrick Konemann is currently offline Patrick KonemannFriend
Messages: 116
Registered: July 2009
Senior Member
Christian, thank you again!

I came across the cache-attribute quite some time ago but I forgot about it because I indeed thought it is "for internal use only" ;-)
Now I can implement IConstraintDescriptor.getBatchConstraints and I have all the flexibility I need.
There I should probably also do some caching for performance reasons :-)

One last question about categories and validation result presentation:
I saw it somewhere (can't remember where) that the validation results are structured as a tree (with two levels only) in the validation dialog. How can I do that? With categories? I saw that there are different ways of showing validation results:
- ErrorDialog.openError - taking IStatus as parameter
- DiagnosticDialog.openProblem - taking Diagnostic as parameter

I would like to have 3 constraint providers. Then the results of each provider should be grouped in the validation dialog.
Is that possible with both, IStatus and Diagnostics?
Maybe someone knows the answer right away, otherwise I'll have to try both ways...

Cheers
Patrick


On 18-02-2010 15:28, Christian W. Damus wrote:
> Hi, Patrick,
>
> Sorry, I had forgotten about the cache. By default, the constraints
> produced by providers are cached, but that can be disabled. The
> <constraintProvider> element in the extension point schema has a "cache"
> attribute which I see is still documented in the SDK as "for internal
> use only." You should ignore that and set it to "false". :-)
>
> You don't actually need to assign constraints to any categories,
> especially if you don't need them to appear in the preference page.
>
> If you use the default implementation of the IConstraintDescriptor
> interface (AbstractConstraintDescriptor) then you will find that it adds
> itself to the registry. You can avoid that by implementing the
> interface, yourself. Or, you might be able to just remove the descriptor
> from the registry post facto. The latter approach seems somehow sloppy
> to me.
>
> HTH,
>
> Christian
>
>
> On 18/02/10 04:49 AM, Patrick Könemann wrote:
>> Thank you Christian!
>>
>> Comments inline.
>>
>> Patrick
>>
>>
>> On 17-02-2010 15:31, Christian W. Damus wrote:
>>> Hi, Patrick,
>>>
>>> I'm glad that the example was helpful.
>>>
>>> I can think of two possible avenues for you to try. Constraints can be
>>> dynamically removed from the registry (which is where the preference
>>> page finds them), so if your provider detects some condition that
>>> obsoletes a constraint, it can remove that constraint's descriptor from
>>> the registry. It would be possible, then, to add it back later should
>>> the need arise, and possibly with a different implementation.
>>
>> I didn't even know about the preference page ;-)
>>
>>>
>>> I suspect, though, that probably your constraints are more dynamic than
>>> this and don't need to be exposed to the user through the registry and
>>> the preference page. In that case, a constraint provider can offer up
>>> entirely new unregistered constraints every time that it is called upon.
>>> These would be transient, and need only exist for the duration of the
>>> validation operation.
>>
>> That sounds great! You're right, I probably do not need the registry.
>> In my case, the OCL constraints are not stored in some file but the user
>> maintains them in a list during runtime.
>> So my first guess was to override
>> AbstractConstraintProvider.getBatchConstraints. But then it happens that
>> getBatchConstraints is called only once for the first validation. The
>> validation framework apparently caches the constraints.
>>
>> Making a constraint transient... how?
>> I just figured out that I can also remove constraints from the category,
>> is that what you mean?
>> I tried adding all my constraints to a category, so the validation
>> considers them (like in the example).
>> Then I removed them by calling Category.removeConstraint and started the
>> validation again. Unfortunately the constraints are still checked. :-(
>>
>> Could you maybe be more specific on how I can create these transient
>> constraints or how I can remove constraints?
>>
>>
>>>
>>> I am assuming, of course, that (a) the framework didn't assume that
>>> constraints were registered when last I worked on it, and (b) nobody has
>>> changed that in the mean-time. It shouldn't be too hard to test this
>>> theory by modifying the OCL example that uses a dynamic constraint
>>> provider to load a *.ocl document. See if you can re-parse the OCL on
>>> each invocation, creating throw-away (unregistered) constraint objects.
>>>
>>> HTH,
>>>
>>> Christian
>>>
>>>
>>> On 17/02/10 05:17 AM, Patrick Könemann wrote:
>>>> Hi newsgroup,
>>>>
>>>> I found the EMF Validation example (using OCL) in the Eclipse help.
>>>> Very useful, thank you!
>>>>
>>>> All constraints are specified during design time AFAIK.
>>>> But I would like to define additional (and maybe modify existing)
>>>> constraints during runtime!
>>>> Is that possible with EMF Validation?
>>>>
>>>> The problem is, if I understood it correctly, that all constraints are
>>>> loaded from constraint providers (which are defined as extensions) and
>>>> loaded only once.
>>>> In other words, I cannot see how I could add a new constraint after the
>>>> first validation was executed.
>>>>
>>>> Any ideas whether that is possible at all?
>>>>
>>>> Cheers
>>>> Patrick
>>>
>>
>
Re: [Validation] Dynamic constraints? [message #515405 is a reply to message #515373] Thu, 18 February 2010 16:47 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Patrick,

Categories are only grouping metadata for constraints. The preference
page organizes constraints by categories, but you can also use them for
your own purposes. Nothing provided "in the box" organizes validation
results by category.

Your constraints can, if you wish, provide complex status results by
creating multi-statuses using the appropriate ConstraintStatus factory
methods. Whatever kind of status is return by a constraint is glommed
into a multi-status by the validator, for another level of aggregation.
So, I wouldn't expect only one level of nesting in the ErrorDialog's
rendering of the validation result.

If you need to group results by provider, then you will need to
rearrange the children of the validator's multi-status result, yourself.
As each individual result implements the IConstraintStatus interface,
you can trace results to their originating constraints. Presumably you
will be able to trace your constraints to their providers (since your
providers are creating them) to accomplish your sort.

Cheers,

Christian


On 18/02/10 10:31 AM, Patrick Könemann wrote:
> Christian, thank you again!
>
> I came across the cache-attribute quite some time ago but I forgot about
> it because I indeed thought it is "for internal use only" ;-)
> Now I can implement IConstraintDescriptor.getBatchConstraints and I have
> all the flexibility I need.
> There I should probably also do some caching for performance reasons :-)
>
> One last question about categories and validation result presentation:
> I saw it somewhere (can't remember where) that the validation results
> are structured as a tree (with two levels only) in the validation
> dialog. How can I do that? With categories? I saw that there are
> different ways of showing validation results:
> - ErrorDialog.openError - taking IStatus as parameter
> - DiagnosticDialog.openProblem - taking Diagnostic as parameter
>
> I would like to have 3 constraint providers. Then the results of each
> provider should be grouped in the validation dialog.
> Is that possible with both, IStatus and Diagnostics?
> Maybe someone knows the answer right away, otherwise I'll have to try
> both ways...
>
> Cheers
> Patrick
>

--------8<--------
Re: [Validation] Dynamic constraints? [message #515766 is a reply to message #515405] Sat, 20 February 2010 16:02 Go to previous messageGo to next message
Patrick Konemann is currently offline Patrick KonemannFriend
Messages: 116
Registered: July 2009
Senior Member
Hi Christian,

Thank you very much!
That was very helpful.

Have a nice weekend
Patrick


On 18-02-2010 17:47, Christian W. Damus wrote:
> Hi, Patrick,
>
> Categories are only grouping metadata for constraints. The preference
> page organizes constraints by categories, but you can also use them for
> your own purposes. Nothing provided "in the box" organizes validation
> results by category.
>
> Your constraints can, if you wish, provide complex status results by
> creating multi-statuses using the appropriate ConstraintStatus factory
> methods. Whatever kind of status is return by a constraint is glommed
> into a multi-status by the validator, for another level of aggregation.
> So, I wouldn't expect only one level of nesting in the ErrorDialog's
> rendering of the validation result.
>
> If you need to group results by provider, then you will need to
> rearrange the children of the validator's multi-status result, yourself.
> As each individual result implements the IConstraintStatus interface,
> you can trace results to their originating constraints. Presumably you
> will be able to trace your constraints to their providers (since your
> providers are creating them) to accomplish your sort.
>
> Cheers,
>
> Christian
>
>
> On 18/02/10 10:31 AM, Patrick Könemann wrote:
>> Christian, thank you again!
>>
>> I came across the cache-attribute quite some time ago but I forgot about
>> it because I indeed thought it is "for internal use only" ;-)
>> Now I can implement IConstraintDescriptor.getBatchConstraints and I have
>> all the flexibility I need.
>> There I should probably also do some caching for performance reasons :-)
>>
>> One last question about categories and validation result presentation:
>> I saw it somewhere (can't remember where) that the validation results
>> are structured as a tree (with two levels only) in the validation
>> dialog. How can I do that? With categories? I saw that there are
>> different ways of showing validation results:
>> - ErrorDialog.openError - taking IStatus as parameter
>> - DiagnosticDialog.openProblem - taking Diagnostic as parameter
>>
>> I would like to have 3 constraint providers. Then the results of each
>> provider should be grouped in the validation dialog.
>> Is that possible with both, IStatus and Diagnostics?
>> Maybe someone knows the answer right away, otherwise I'll have to try
>> both ways...
>>
>> Cheers
>> Patrick
>>
>
> --------8<--------
Re: [Validation] Dynamic constraints? [message #519336 is a reply to message #515351] Mon, 08 March 2010 09:46 Go to previous messageGo to next message
Patrick Konemann is currently offline Patrick KonemannFriend
Messages: 116
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020803070707050400010101
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi Christian,

I'm sorry to bother you again. But for some unknown reason, without categories, I cannot get the validation working at all.
Attached is a minimalistic example of a ConstraintProvider creating one dummy constraint registered for Ecore models.

IConstraintProvider.getBatchConstraints is called as expected (also multiple times if cache = false) :-)
IModelConstraint.validate, on the other hand, is never called.

Any idea of what is missing?

Best regards
Patrick


On 18-02-2010 15:28, Christian W. Damus wrote:
> You don't actually need to assign constraints to any categories,
> especially if you don't need them to appear in the preference page.
>
> If you use the default implementation of the IConstraintDescriptor
> interface (AbstractConstraintDescriptor) then you will find that it adds
> itself to the registry. You can avoid that by implementing the
> interface, yourself. Or, you might be able to just remove the descriptor
> from the registry post facto. The latter approach seems somehow sloppy
> to me.
>
> HTH,
>
> Christian

--------------020803070707050400010101
Content-Type: application/octet-stream;
name="ValidationTest.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="ValidationTest.zip"

UEsDBBQACAAIAC58aDwAAAAAAAAAAAAAAAAZAAAAVmxpYWRhdGlvblRlc3Qv LmNsYXNzcGF0
aJWQwWoCMRCGzxX6DkvuztZCoYfdSikrVKiKbr2WmAzrtHESJ4no21dLpaUH obf5h28+hr8a
7jeu2KFE8lyrAdyoAtl4S9zV6rUd9e/V8OG6VxmnYww6rY/h6ichJzkUH8S2 VsazKk7LWnnp
AI2jEBHebQKnM5v10QnjefP2NJ20j8+TZl7+5YgTCmsHFle5g0zflyiwSJqt Frt8aQ8By/Ht
oukP4E6V/34oWATjBUFwm0nQzlzuiOMlVRRzVp3GC6TPKeR0hlfEX3BV/i7w E1BLBwhPww7k
zwAAAHYBAABQSwMEFAAIAAgALnxoPAAAAAAAAAAAAAAAABcAAABWbGlhZGF0 aW9uVGVzdC8u
cHJvamVjdL2ST08DIRDFz5r4HZq9C3rzQLeJNr1pTFq9jzCuNDAQYBs/voCs ZrMx8WC8zXsz
jx//xObdmtUJQ9SO1t01u+pWSNIpTcO6ezrsLm+6TX9xLnxwR5Rpi1EG7VOe zu6ZILDYPxsN
Cop3wJgEr2bpSmctUuoFn6ritqViFXymXkZt1N6jLKrJuxwFUtVpQBcGhtJo H5EdVWLShVzA
CWoAw/cWcgLCMBZ2bJrPDcEXlF9xvUJ2D6Rf85Fv/xe7l29o4U+gzZmuPPPS GLBNf4oF/tGM
g6aH2iz0OvRTYPY8tMhMdSF+/YX5J/sAUEsHCPVhsWHpAAAAowIAAFBLAwQU AAgACAAufGg8
AAAAAAAAAAAAAAAAHwAAAFZsaWFkYXRpb25UZXN0L2J1a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RhdGlvbi9U ZXN0Q29uc3Ry
YWludFByb3ZpZGVyLmphdmFQSwUGAAAAAAkACQD4AgAAJRUAAAAA
--------------020803070707050400010101--
Re: [Validation] Dynamic constraints? [message #519481 is a reply to message #519336] Mon, 08 March 2010 23:24 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Patrick,

Sorry, I don't really have the time (or the set-up) to look at code
attachments.

However, this does sound like the classic "client context" problem. I
think your constraints are being filtered out by the validator because
it can't find a client-context matching the model elements to be
validated with the constraints that it found. I think categories are a
common way to bind constraints to client-contexts (my memory is fading),
but the binding can be done on a per-constraint basis, too ... see
whether you can set up those bindings in your constraint provider.

You might also search back in the newsgroup archive to see other cases
where the client-context bindings (lack thereof) have tripped people up.
There may be more than one solution.

HTH,

Christian


On 08/03/10 09:40 AM, Patrick Könemann wrote:
> Hi Christian,
>
> I'm sorry to bother you again. But for some unknown reason, without
> categories, I cannot get the validation working at all.
> Attached is a minimalistic example of a ConstraintProvider creating one
> dummy constraint registered for Ecore models.
>
> IConstraintProvider.getBatchConstraints is called as expected (also
> multiple times if cache = false) :-)
> IModelConstraint.validate, on the other hand, is never called.
>
> Any idea of what is missing?
>
> Best regards
> Patrick
>
>
> On 18-02-2010 15:28, Christian W. Damus wrote:
>> You don't actually need to assign constraints to any categories,
>> especially if you don't need them to appear in the preference page.
>>
>> If you use the default implementation of the IConstraintDescriptor
>> interface (AbstractConstraintDescriptor) then you will find that it adds
>> itself to the registry. You can avoid that by implementing the
>> interface, yourself. Or, you might be able to just remove the descriptor
>> from the registry post facto. The latter approach seems somehow sloppy
>> to me.
>>
>> HTH,
>>
>> Christian
Re: [Validation] Dynamic constraints? [message #519523 is a reply to message #519481] Tue, 09 March 2010 08:31 Go to previous messageGo to next message
Patrick Konemann is currently offline Patrick KonemannFriend
Messages: 116
Registered: July 2009
Senior Member
Hi Christian,

Thanks a lot, I got it working!
Comments below.


On 09-03-2010 00:24, Christian W. Damus wrote:
> Hi, Patrick,
>
> Sorry, I don't really have the time (or the set-up) to look at code
> attachments.

Sure, that's totally ok!

>
> However, this does sound like the classic "client context" problem. I
> think your constraints are being filtered out by the validator because
> it can't find a client-context matching the model elements to be
> validated with the constraints that it found.

I had the client context working, the problem was the binding - see below.

> I think categories are a
> common way to bind constraints to client-contexts (my memory is fading),
> but the binding can be done on a per-constraint basis, too ...

True, the binding can be defined for a *constraint* or for a *category*.
However, since I have dynamic constraints, their ids are unknown during design time. Hence, I cannot define these ids in the binding definition in the plugin.xml.
What I would have needed is a binding for a *ConstraintProvider* - and that is apparently not possible.

So what I did is to add a Category again for each constraint provider.
Defining the bindings for each category finally worked! :-) :-) :-)

Thank you again!
Patrick
Re: [Validation] Dynamic constraints? [message #519626 is a reply to message #519523] Tue, 09 March 2010 14:20 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Patrick,

I'm glad you got this working. I hope, though, that the necessity of
categories isn't a problem for you (that they won't get in your way or
clutter your UI). Really, though, they shouldn't be necessary:
categories are supposed to be optional. Probably, you have found a bug.

Being able to define context bindings to constraint providers would add
an undesirable coupling: consumers of constraints (applications that
identify themselves via client-contexts) shouldn't care who supplies the
constraints.

cW

On 09/03/10 03:31 AM, Patrick Könemann wrote:
> Hi Christian,
>
> Thanks a lot, I got it working!
> Comments below.

--------8<--------
Previous Topic:[EMF.Edit] custom icons
Next Topic:Removing EList element doesn't kill References from Other Objects
Goto Forum:
  


Current Time: Thu Apr 25 08:36:45 GMT 2024

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

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

Back to the top