Commit 94bf4ac6 authored by reaboi's avatar reaboi
Browse files

1326 comments in code specification m

Signed-off-by: default avatarreaboi <>
parent 2f67b204 4553e487264e3d1f86f4767da4a7400cce4b9a5d GREEN 69d5e08bbf768baf2790380e36f1020ef826a33e GREEN 66ff2c44bef3bfecc85a6d3109c6b15a8960fa38 GREEN 0818014c193a22d5968435e78590368b95138d5e GREEN 6451a7c71d7e4e89593653159cfec35f45a426c9 YELLOW 7aab91518aa12d76533a345bf6ed0be9ac7ff0e5 GREEN 928280b5dd3bb634debc1ac3be9f15b4e45f2683 GREEN b038a28a44e17e5bca4d71f5dee70ee92e5324b9 GREEN
......@@ -157,6 +157,85 @@ public final class DataBindingUtils {
return bindings;
* Performs a complex binding of a text control to a model element. The
* validation is performed on modification (i.e. always), while model
* updates are only performed on focus out (if validation works). There is
* no validation support from model to text, as the model is considered to
* be always consistent. If the control has a {@link ControlDecoration} stored under the
* {@link #DECORATION_KEY} key, this is used to visualize
* the validation result.
* @param dbc
* the data binding context to be used
* @param control
* the SWT control
* @param modelValue
* the model element value to be observed
* @param modelValueComment
* the model element comment value to be observed
* @param modelToTextConverter
* the converter from the element to the control's text
* @param textToModelConverter
* the converter from the control's text to the element
* @param textValidator
* the validator for the control's text
* @param textPostConvertValidator
* the validator for the text after conversion
* @return the array of constructed bindings
public static Binding[] performComplexTextAndCommentBinding(DataBindingContext dbc,
Control control, IObservableValue modelValue, IObservableValue modelValueComment,
IConverter modelToTextConverter, IConverter textToModelConverter,
IValidator textValidator, IValidator textPostConvertValidator) {
Binding[] bindings = new Binding[4];
// normal model to control
UpdateValueStrategy modelToTextStrategy =
new UpdateValueStrategy(true, UpdateValueStrategy.POLICY_UPDATE)
// use POLICY_UPDATE to actually perform the update
UpdateValueStrategy textToModelStrategyWithUpdate =
new UpdateValueStrategy(true, UpdateValueStrategy.POLICY_UPDATE)
// add the "normal" binding to actually update the model
bindings[0] =
dbc.bindValue(observeText(control, SWT.Modify), modelValue,
textToModelStrategyWithUpdate, modelToTextStrategy);
// add the "normal" binding to actually update the comments
bindings[1] =
dbc.bindValue(observeText(control, SWT.Modify), modelValueComment, null, null);
// here it is important to only use POLICY_CONVERT, to not write through
// to the model
UpdateValueStrategy textToModelStrategyNoUpdate =
new UpdateValueStrategy(true, UpdateValueStrategy.POLICY_CONVERT)
// perform a binding which only serves for validation purposes
bindings[2] =
dbc.bindValue(observeText(control, SWT.Modify), modelValue,
textToModelStrategyNoUpdate, new UpdateValueStrategy(
// add validation of required/supported
final Object data = control.getData(DECORATION_KEY);
if(data instanceof ControlDecoration) {
bindings[3] =
bindings[1].getValidationStatus(), null, null);
return bindings;
* Performs a complex binding of a cell editor control to a model element. The
* validation is performed on modification (i.e. always), while model
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment