Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2018-11-26 04:28:33 -0500
committerPatrick Tessier2018-11-27 10:16:00 -0500
commit52faf3e1e56dd5154d314dc89266d310ff91bcec (patch)
tree81fbd82cf7e5d9af2404432200c7de642304bfd7
parent234420be93126a27cf40ec89348ef571e49a32c8 (diff)
downloadorg.eclipse.papyrus-52faf3e1e56dd5154d314dc89266d310ff91bcec.tar.gz
org.eclipse.papyrus-52faf3e1e56dd5154d314dc89266d310ff91bcec.tar.xz
org.eclipse.papyrus-52faf3e1e56dd5154d314dc89266d310ff91bcec.zip
Bug 540815 - [Property view] Upper multiplicity is not correctly updated
- handle case that value specifications are initially null (if default multiplicity) Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr>
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java
index 3b98596176d..d91fa4e6911 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010, 2014 CEA LIST and others.
+ * Copyright (c) 2010, 2014, 2018 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -12,6 +12,7 @@
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - 402525
* Christian W. Damus (CEA) - bug 417409
+ * Ansgar Radermacher (CEA) - Bug 540815
*
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.databinding;
@@ -117,8 +118,28 @@ public class MultiplicityObservableValue extends ReferenceCountedObservable.Valu
boolean fireChange = false;
if (event.getSource() == lowerValue || event.getSource() == upperValue) {
fireChange = true;
- lowerValueSpecification = getValueSpecification(lowerValue, UMLPackage.eINSTANCE.getLiteralInteger_Value(), domain);
- upperValueSpecification = getValueSpecification(upperValue, UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value(), domain);
+ IObservableValue<?> newLowerVS = getValueSpecification(lowerValue, UMLPackage.eINSTANCE.getLiteralInteger_Value(), domain);
+ IObservableValue<?> newUpperVS = getValueSpecification(upperValue, UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value(), domain);
+
+ // handle case that property has initially no value specification for upper and lower (bug 540815)
+ if (newLowerVS != lowerValueSpecification) {
+ if (lowerValueSpecification != null) {
+ lowerValueSpecification.removeChangeListener(this);
+ }
+ lowerValueSpecification = newLowerVS;
+ if (lowerValueSpecification != null) {
+ lowerValueSpecification.addChangeListener(this);
+ }
+ }
+ if (newUpperVS != upperValueSpecification) {
+ if (upperValueSpecification != null) {
+ upperValueSpecification.removeChangeListener(this);
+ }
+ upperValueSpecification = newUpperVS;
+ if (upperValueSpecification != null) {
+ upperValueSpecification.addChangeListener(this);
+ }
+ }
}
if (event.getSource() == lowerValueSpecification || event.getSource() == upperValueSpecification) {

Back to the top