Skip to content
Snippets Groups Projects
Commit 26d1a570 authored by reaboi's avatar reaboi
Browse files

1326 comments in code specification m


YELLOW

Signed-off-by: default avatarreaboi <reaboi@fortiss.org>
parent 388c1054
No related branches found
No related tags found
2 merge requests!151326 comments in code specification m,!141326 comments in code specification m
This commit is part of merge request !14. Comments created here will be created in the context of that merge request.
ActionUtils.java 4553e487264e3d1f86f4767da4a7400cce4b9a5d GREEN
ConstraintsUIUtils.java 69d5e08bbf768baf2790380e36f1020ef826a33e GREEN
CopyPasteUtils.java 66ff2c44bef3bfecc85a6d3109c6b15a8960fa38 GREEN
DataBindingUtils.java 83d5db7e58da9e3081f9d8f406532b6d35f6deaf RED
DataBindingUtils.java 1d4c4da38227974b94c74b0302d6597f418d0c0a YELLOW
DragAndDropUtils.java 7aab91518aa12d76533a345bf6ed0be9ac7ff0e5 GREEN
EObjectSelectionUtils.java 928280b5dd3bb634debc1ac3be9f15b4e45f2683 GREEN
KernelUIUtils.java b038a28a44e17e5bca4d71f5dee70ee92e5324b9 GREEN
......
......@@ -115,46 +115,8 @@ public final class DataBindingUtils {
IConverter textToModelConverter, IValidator textValidator,
IValidator textPostConvertValidator) {
Binding[] bindings = new Binding[3];
// normal model to control
UpdateValueStrategy modelToTextStrategy =
new UpdateValueStrategy(true, UpdateValueStrategy.POLICY_UPDATE)
.setConverter(modelToTextConverter);
// use POLICY_UPDATE to actually perform the update
UpdateValueStrategy textToModelStrategyWithUpdate =
new UpdateValueStrategy(true, UpdateValueStrategy.POLICY_UPDATE)
.setConverter(textToModelConverter).setAfterGetValidator(textValidator)
.setAfterConvertValidator(textPostConvertValidator);
// add the "normal" binding to actually update the model
bindings[0] =
dbc.bindValue(observeText(control, SWT.Modify), modelValue,
textToModelStrategyWithUpdate, modelToTextStrategy);
// here it is important to only use POLICY_CONVERT, to not write through
// to the model
UpdateValueStrategy textToModelStrategyNoUpdate =
new UpdateValueStrategy(true, UpdateValueStrategy.POLICY_CONVERT)
.setConverter(textToModelConverter).setAfterGetValidator(textValidator)
.setAfterConvertValidator(textPostConvertValidator);
// perform a binding which only serves for validation purposes
bindings[1] =
dbc.bindValue(observeText(control, SWT.Modify), modelValue,
textToModelStrategyNoUpdate, new UpdateValueStrategy(
UpdateValueStrategy.POLICY_NEVER));
// add validation of required/supported
final Object data = control.getData(DECORATION_KEY);
if(data instanceof ControlDecoration) {
bindings[2] =
dbc.bindValue(
JFaceObservables.observeControlDecoration((ControlDecoration)data),
bindings[1].getValidationStatus(), null, null);
}
return bindings;
return performComplexTextBinding(dbc, control, modelValue, null, modelToTextConverter,
textToModelConverter, textValidator, textPostConvertValidator);
}
/**
......@@ -185,14 +147,18 @@ public final class DataBindingUtils {
* @return the array of constructed bindings
*/
// TODO(HP): is it not possible to have a single method that can deal with the code
// specification with or without comments?
public static Binding[] performComplexTextAndCommentBinding(DataBindingContext dbc,
Control control, IObservableValue modelValue, IObservableValue modelValueComment,
public static Binding[] performComplexTextBinding(DataBindingContext dbc, Control control,
IObservableValue modelValue, IObservableValue modelValueComment,
IConverter modelToTextConverter, IConverter textToModelConverter,
IValidator textValidator, IValidator textPostConvertValidator) {
Binding[] bindings = new Binding[4];
Binding[] bindings;
if(modelValueComment == null) {
bindings = new Binding[3];
} else {
bindings = new Binding[4];
}
// normal model to control
UpdateValueStrategy modelToTextStrategy =
......@@ -210,10 +176,6 @@ public final class DataBindingUtils {
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 =
......@@ -222,7 +184,7 @@ public final class DataBindingUtils {
.setAfterConvertValidator(textPostConvertValidator);
// perform a binding which only serves for validation purposes
bindings[2] =
bindings[1] =
dbc.bindValue(observeText(control, SWT.Modify), modelValue,
textToModelStrategyNoUpdate, new UpdateValueStrategy(
UpdateValueStrategy.POLICY_NEVER));
......@@ -230,11 +192,18 @@ public final class DataBindingUtils {
// add validation of required/supported
final Object data = control.getData(DECORATION_KEY);
if(data instanceof ControlDecoration) {
bindings[3] =
bindings[2] =
dbc.bindValue(
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