According to the javadoc of TitleAreaDialogSupport.create(TitleAreaDialog, DataBindingContext), the error message will not be shown at the time of creation, but the outcome is just opposite. Another issue is that if no error is found, the dialog message would be blank. My code is roughly as below:
DataBindingContext ctx = new DataBindingContext();
IObservableValue uiOv = null, modelOv = null;
Binding binding = null;
uiOv = WidgetProperties.selection().observe(aCombo);
modelOv = PojoProperties.value("aProperty").observe(mdoel);
binding = ctx.bindValue(uiOv, modelOv, new UpdateValueStrategy()
.setBeforeSetValidator(new IValidator() {
@Override
public IStatus validate(Object value) {
if (value == null || "".equals(value))
return ValidationStatus.info(infoMessage);
return ValidationStatus.ok();
}
}), null);
ControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
// the rest of the binding boilerplate code is ommitted.
TitleAreaDialogSupport.create(this, ctx);
[Updated on: Wed, 11 April 2012 13:47]
Report message to a moderator