Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » [Databinding] Example for binding enabled state of control to validationStatus of DataBindingContext
[Databinding] Example for binding enabled state of control to validationStatus of DataBindingContext [message #312994] Tue, 27 February 2007 10:18 Go to next message
Eclipse UserFriend
Hi,

is there any example, how to bind the enabled state of a Control to the
validation state of a Databinding(Context). AFAIR I have seen such a example
somewhere but I can't find it anymore.

Typical usecase:
Save button should only be enabled, if no validation errors have occoured!
Re: [Databinding] Example for binding enabled state of control to validationStatus of DataBindingCon [message #313005 is a reply to message #312994] Tue, 27 February 2007 11:30 Go to previous messageGo to next message
Eclipse UserFriend
How to bind to the validation status is answered in the FAQ[1]. It isn't
your exact use case but it's close.

-brad

[1]
http://wiki.eclipse.org/index.php/JFace_Data_Binding_FAQ#How _do_I_bind_to_the_ValidationError_of_a_Binding_or_DataBindin gContext.3F
Re: [Databinding] Example for binding enabled state of control to validationStatus of DataBindingCon [message #313140 is a reply to message #312994] Sat, 03 March 2007 00:17 Go to previous message
Eclipse UserFriend
https://bugs.eclipse.org/bugs/show_bug.cgi?id=175901
contains code that does something very similar for a wizard page.

Another way of doing it, if you don't mind using non-API (ControlUpdater),
you can write:
IObservableValue mergedStatus =
new AggregateValidationStatus(dbc.getBindings,
AggregateValidationStatus.MAX_SEVERITY);
new ControlUpdater(button) {
public void updateControl() {
button.setEnabled(((IStatus)mergedStatus.getValue()).isOk()) ;
}
}

That should do the trick.

"Wolfgang Herr" <herr@tambas.at> schrieb im Newsbeitrag
news:es1i3c$tns$1@utils.eclipse.org...
> Hi,
>
> is there any example, how to bind the enabled state of a Control to the
> validation state of a Databinding(Context). AFAIR I have seen such a
> example somewhere but I can't find it anymore.
>
> Typical usecase:
> Save button should only be enabled, if no validation errors have occoured!
>
Previous Topic:Version specific ant scripts
Next Topic:Adding an action / best practice
Goto Forum:
  


Current Time: Wed Nov 05 05:25:25 EST 2025

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

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

Back to the top