Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
kernel
Commits
94bf4ac6
Commit
94bf4ac6
authored
Aug 01, 2018
by
reaboi
Browse files
1326 comments in code specification m
YELLOW Signed-off-by:
reaboi
<
reaboi@fortiss.org
>
parent
2f67b204
Changes
2
Hide whitespace changes
Inline
Side-by-side
org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings
View file @
94bf4ac6
ActionUtils.java 4553e487264e3d1f86f4767da4a7400cce4b9a5d GREEN
ActionUtils.java 4553e487264e3d1f86f4767da4a7400cce4b9a5d GREEN
ConstraintsUIUtils.java 69d5e08bbf768baf2790380e36f1020ef826a33e GREEN
ConstraintsUIUtils.java 69d5e08bbf768baf2790380e36f1020ef826a33e GREEN
CopyPasteUtils.java 66ff2c44bef3bfecc85a6d3109c6b15a8960fa38 GREEN
CopyPasteUtils.java 66ff2c44bef3bfecc85a6d3109c6b15a8960fa38 GREEN
DataBindingUtils.java
0818014c193a22d5968435e78
59
0
36
8b95138d5e GREEN
DataBindingUtils.java
6451a7c71d7e4e89
5936
53159cfec35f45a426c9 YELLOW
DragAndDropUtils.java 7aab91518aa12d76533a345bf6ed0be9ac7ff0e5 GREEN
DragAndDropUtils.java 7aab91518aa12d76533a345bf6ed0be9ac7ff0e5 GREEN
EObjectSelectionUtils.java 928280b5dd3bb634debc1ac3be9f15b4e45f2683 GREEN
EObjectSelectionUtils.java 928280b5dd3bb634debc1ac3be9f15b4e45f2683 GREEN
KernelUIUtils.java b038a28a44e17e5bca4d71f5dee70ee92e5324b9 GREEN
KernelUIUtils.java b038a28a44e17e5bca4d71f5dee70ee92e5324b9 GREEN
...
...
org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java
View file @
94bf4ac6
...
@@ -157,6 +157,85 @@ public final class DataBindingUtils {
...
@@ -157,6 +157,85 @@ public final class DataBindingUtils {
return
bindings
;
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
)
.
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
);
// 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
)
.
setConverter
(
textToModelConverter
).
setAfterGetValidator
(
textValidator
)
.
setAfterConvertValidator
(
textPostConvertValidator
);
// perform a binding which only serves for validation purposes
bindings
[
2
]
=
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
[
3
]
=
dbc
.
bindValue
(
JFaceObservables
.
observeControlDecoration
((
ControlDecoration
)
data
),
bindings
[
1
].
getValidationStatus
(),
null
,
null
);
}
return
bindings
;
}
/**
/**
* Performs a complex binding of a cell editor control to a model element. The
* Performs a complex binding of a cell editor control to a model element. The
* validation is performed on modification (i.e. always), while model
* validation is performed on modification (i.e. always), while model
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment