Skip to content
Snippets Groups Projects
Commit c7429b61 authored by Simon Barner's avatar Simon Barner
Browse files

Merge branch 'master' of https://git.fortiss.org/af3/kernel.git into 3672

parents 8be86a1a 4a3039eb
No related branches found
No related tags found
No related merge requests found
DerivedAnnotationBaseStaticImpl.java 0b5a8e36f66c937b1659f0b73a0cf0428337e364 GREEN
DerivedAnnotationBaseStaticImpl.java 25b4a0b00fe68a1027ee81e52697e03988862373 GREEN
LibraryElementBaseStaticImpl.java 13222726153d5159994866795b059a4cc3522434 GREEN
......@@ -37,21 +37,20 @@ public class DerivedAnnotationBaseStaticImpl {
* @return See above.
*/
public static <T> T getValue(IDerivedAnnotation<T> annotation) {
T derivedValue = null;
if(annotation.getUserAnnotatedValue() != null) {
if(annotation.isUserAnnotatedValuePreferred()) {
// User annotated value is available and preferred -> return it
return annotation.getUserAnnotatedValue();
}
derivedValue = annotation.getDerivedValue();
if(derivedValue == null) {
// Derived value would be preferred, but it is not available -> return user
// annotated value
return annotation.getUserAnnotatedValue();
}
T userAnnotatedValue = annotation.getUserAnnotatedValue();
if(annotation.isUserAnnotatedValuePreferred() && userAnnotatedValue != null) {
// User annotated value is preferred and exists.
return userAnnotatedValue;
}
// Use cached result of derived value if it is available
return derivedValue != null ? derivedValue : annotation.getDerivedValue();
T derivedValue = annotation.getDerivedValue();
if(derivedValue != null) {
// User annotated value is not preferred: use the derived value.
return derivedValue;
}
// Derived value does not exist: return the user annotated value, even if it is not
// preferred. If neither the derived or the user annotated values exist, we return null.
return userAnnotatedValue;
}
}
......@@ -10,7 +10,7 @@ ModelEditorBindingBase.java 4c5ac569c0b6e7678fc8191096b26dfd09fdcb98 GREEN
ModelElementHandlerBase.java 384727748f125c9d43f19d9c0eba4ba1be5a7a26 GREEN
MultiEObjectActionBase.java 9e237d8ea640c4194e4877af4a9cfce88698e543 GREEN
NamedCommentedModelElementHandlerBase.java 681b98b50b362f01abb7a36f108f4f11b9e51829 GREEN
PropertySectionBase.java 7b893ca28d86a415d9fc7a818e65c04ed244e896 GREEN
PropertySectionBase.java 20fb1daea544123ea941743aafeb9ac59daf5356 GREEN
TutorialStepUIAtomicBase.java cea2a158158b476de2108d2309afcf47f217b6d9 GREEN
TutorialStepUIAtomicWithWhitelistBase.java a9788ae514f62d27169c737ef59fb583234b5d43 GREEN
TutorialStepUICompositeBase.java 8225210eacb5b88de47d78280c5819f572f00ffa GREEN
......
......@@ -25,6 +25,7 @@ import static org.eclipse.core.databinding.conversion.StringToNumberConverter.to
import static org.fortiss.tooling.kernel.ui.databinding.FloatValidator.FLOAT_VALIDATOR;
import static org.fortiss.tooling.kernel.ui.databinding.IntValidator.INT_VALIDATOR;
import static org.fortiss.tooling.kernel.ui.databinding.NumberPositiveValidator.NUMBER_POSITIVE_VALIDATOR;
import static org.fortiss.tooling.kernel.ui.databinding.NumberPositiveZeroValidator.NUMBER_POSITIVE_ZERO_VALIDATOR;
import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.DECORATION_KEY;
import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.performComplexTextBinding;
import static org.fortiss.tooling.kernel.ui.util.WidgetsFactory.createTextWithUndo;
......@@ -448,6 +449,11 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
bindIntegerValue(text, observedValue, NUMBER_POSITIVE_VALIDATOR);
}
/** Binds a positive or zero integer value. */
protected void bindPositiveOrZeroIntegerValue(Control text, IObservableValue<?> observedValue) {
bindIntegerValue(text, observedValue, NUMBER_POSITIVE_ZERO_VALIDATOR);
}
/** Binds a integer value. */
protected void bindIntegerValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator) {
......
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