Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2019-01-10 05:29:40 -0500
committervincent lorenzo2019-01-23 03:41:05 -0500
commit84f851475dbcae5030c99bd3c762157551c37d62 (patch)
treeefb75b042fb968b2ef08077890d85d396fdf6cba
parent44a8af04463fed3b21d1830039aec8b452beefd9 (diff)
downloadorg.eclipse.papyrus-84f851475dbcae5030c99bd3c762157551c37d62.tar.gz
org.eclipse.papyrus-84f851475dbcae5030c99bd3c762157551c37d62.tar.xz
org.eclipse.papyrus-84f851475dbcae5030c99bd3c762157551c37d62.zip
Bug 540815 - [Property view] Upper multiplicity is not correctly updated
- Root problem is that ExtensionEnd redefines the lowerBound query (comment in UM2 MM): "The query lowerBound() ... is a redefinition of the default lower bound, which normally, for MultiplicityElements, evaluates to 1 if empty." - Revert to old code for setting multiplicity values, i.e. do not handle default values specifically during setting. This is conformant with what the UML2 plugin does, if setUpper/setLower methods are called. Default values are taken into account by getters and eIsSet methods. Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr> Change-Id: Ide95832d1c20d0bbbad1b5a1385eb4adafde8d9d
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/commands/SetMultiplicityCommand.java24
1 files changed, 8 insertions, 16 deletions
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/commands/SetMultiplicityCommand.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/commands/SetMultiplicityCommand.java
index 7541cb2ad22..51116298e31 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/commands/SetMultiplicityCommand.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/commands/SetMultiplicityCommand.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013, 2018 CEA LIST.
+ * Copyright (c) 2013 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,7 +11,6 @@
*
* Contributors:
* Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
- * Ansgar Radermacher (CEA) - Bug 540815
*
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.commands;
@@ -20,7 +19,6 @@ import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
@@ -46,10 +44,8 @@ public class SetMultiplicityCommand extends CompoundCommand {
private MultiplicityElement element;
static EStructuralFeature lowerFeature = UMLPackage.eINSTANCE.getMultiplicityElement_Lower();
- static EStructuralFeature lowerFeatureVS = UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue();
static EStructuralFeature upperFeature = UMLPackage.eINSTANCE.getMultiplicityElement_Upper();
- static EStructuralFeature upperFeatureVS = UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue();
public SetMultiplicityCommand(MultiplicityElement element, String value) {
if (element == null) {
@@ -71,21 +67,17 @@ public class SetMultiplicityCommand extends CompoundCommand {
this.lowerUpper = lowerUpper;
this.element = element;
- append(getSetCommand(lowerFeature, lowerFeatureVS, lower));
- append(getSetCommand(upperFeature, upperFeatureVS, upper));
+ append(getSetCommand(lowerFeature, lower));
+ append(getSetCommand(upperFeature, upper));
}
- private Command getSetCommand(EStructuralFeature feature, EStructuralFeature featureVS, int value) {
+ private Command getSetCommand(EStructuralFeature feature, int value) {
IElementEditService provider = ElementEditServiceUtils.getCommandProvider(element);
if (provider != null) {
- AbstractEditCommandRequest request;
- if (value == 1) { // default value (see bug 540815)
- request = new SetRequest(element, featureVS, null);
- } else {
- request = new SetRequest(element, feature, value);
- }
- ICommand gmfCommand = provider.getEditCommand(request);
- Command emfCommand = new GMFtoEMFCommandWrapper(gmfCommand);
+ SetRequest request = new SetRequest(element, feature, value);
+ ICommand createGMFCommand = provider.getEditCommand(request);
+
+ Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
return emfCommand;
}

Back to the top