Skip to content
Snippets Groups Projects
Commit b09ab4f9 authored by Hernan Ponce de Leon's avatar Hernan Ponce de Leon
Browse files

Merge branch '1326_comments_in_code_specification_m' into 'master'

1326 comments in code specification m

See merge request !15
parents 2f67b204 2dd9b516
No related branches found
No related tags found
1 merge request!151326 comments in code specification m
ActionUtils.java 4553e487264e3d1f86f4767da4a7400cce4b9a5d GREEN
ConstraintsUIUtils.java 69d5e08bbf768baf2790380e36f1020ef826a33e GREEN
CopyPasteUtils.java 66ff2c44bef3bfecc85a6d3109c6b15a8960fa38 GREEN
DataBindingUtils.java 0818014c193a22d5968435e78590368b95138d5e GREEN
DataBindingUtils.java 1d4c4da38227974b94c74b0302d6597f418d0c0a GREEN
DragAndDropUtils.java 7aab91518aa12d76533a345bf6ed0be9ac7ff0e5 GREEN
EObjectSelectionUtils.java 928280b5dd3bb634debc1ac3be9f15b4e45f2683 GREEN
KernelUIUtils.java b038a28a44e17e5bca4d71f5dee70ee92e5324b9 GREEN
......
......@@ -115,7 +115,50 @@ public final class DataBindingUtils {
IConverter textToModelConverter, IValidator textValidator,
IValidator textPostConvertValidator) {
Binding[] bindings = new Binding[3];
return performComplexTextBinding(dbc, control, modelValue, null, modelToTextConverter,
textToModelConverter, textValidator, textPostConvertValidator);
}
/**
* 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[] performComplexTextBinding(DataBindingContext dbc, Control control,
IObservableValue modelValue, IObservableValue modelValueComment,
IConverter modelToTextConverter, IConverter textToModelConverter,
IValidator textValidator, IValidator textPostConvertValidator) {
Binding[] bindings;
if(modelValueComment == null) {
bindings = new Binding[3];
} else {
bindings = new Binding[4];
}
// normal model to control
UpdateValueStrategy modelToTextStrategy =
......@@ -154,6 +197,13 @@ public final class DataBindingUtils {
JFaceObservables.observeControlDecoration((ControlDecoration)data),
bindings[1].getValidationStatus(), null, null);
}
// add the "normal" binding to actually update the comments
if(modelValueComment != null) {
bindings[3] =
dbc.bindValue(observeText(control, SWT.Modify), modelValueComment, null, null);
}
return bindings;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment