[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: DataBinding + Validation Framework

"Matt Biggs" <zebbedi@xxxxxxxxx> wrote in message news:08ca3e8b87dc55ffa55286e5166798ac$1@xxxxxxxxxxxxxxxxxx
Could someone point me in the right direction or advise if its possible to get EMF databinding to use the EMF validation framework as its source for determining validation failures etc?
I've been looking into this recentely as well.

All of the examples explain how to write your own IValidator however this seems like im duplicating alot of code thats already within my model validator.
Some types of databinding validation are not duplications of model validation, e.g. if you bind a Text widget to a numeric attribute, you need to validate that the string is numeric before you can event set it on the model. But I agree that for most things like required attributes, valid ranges, cross attribute constraints, it is nicer to implement them at the model level where they can be reused outside of databinding.

Similarly writing my own IValidator that calls a Diagnostician i guess would work, however i wondered if this could be quite heavyweight?
I think this is the direction you have to go. I'm considering using the EMF Validation Framework (the other one http://help.eclipse.org/ganymede/topic/org.eclipse.emf.validation.doc/references/overview/ValidationOverview.html) instead of Diagnostician because it is more configurable and extensible. It can do fine grained validation (against a single change Notification) and reports problems as IStatus directly. I'm also thinking it may prove easier to work with a ValidationStatusProvider rather than an IValidator. For instance, UpdateValueStrategy works with and afterGet, afterConvert, and beforeSet validator, but doesn't have the notion (as far as I can tell) of an afterSet/model level validator. ValidationStatusProvider (see MultiValidator for an example) looks like the way to handle validation once the target->model update has finished.

I'll follow up if I make any more progress.

-Will