Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2018-11-26 08:59:36 -0500
committerPatrick Tessier2018-11-27 10:14:20 -0500
commit234420be93126a27cf40ec89348ef571e49a32c8 (patch)
treec24a83b93fa38e2da9d5debe56a1544803ae8eb2
parent33dcbab8a204a52646ac4a2d283585abf5bc3e05 (diff)
downloadorg.eclipse.papyrus-234420be93126a27cf40ec89348ef571e49a32c8.tar.gz
org.eclipse.papyrus-234420be93126a27cf40ec89348ef571e49a32c8.tar.xz
org.eclipse.papyrus-234420be93126a27cf40ec89348ef571e49a32c8.zip
Bug 540815 - [Property view] Upper multiplicity is not correctly updated
- Remove value specification for upper and lower, if set to their default value (1) 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/commands/SetMultiplicityCommand.java24
1 files changed, 16 insertions, 8 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 51116298e31..7541cb2ad22 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 CEA LIST.
+ * Copyright (c) 2013, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,6 +11,7 @@
*
* Contributors:
* Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
+ * Ansgar Radermacher (CEA) - Bug 540815
*
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.commands;
@@ -19,6 +20,7 @@ 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;
@@ -44,8 +46,10 @@ 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) {
@@ -67,17 +71,21 @@ public class SetMultiplicityCommand extends CompoundCommand {
this.lowerUpper = lowerUpper;
this.element = element;
- append(getSetCommand(lowerFeature, lower));
- append(getSetCommand(upperFeature, upper));
+ append(getSetCommand(lowerFeature, lowerFeatureVS, lower));
+ append(getSetCommand(upperFeature, upperFeatureVS, upper));
}
- private Command getSetCommand(EStructuralFeature feature, int value) {
+ private Command getSetCommand(EStructuralFeature feature, EStructuralFeature featureVS, int value) {
IElementEditService provider = ElementEditServiceUtils.getCommandProvider(element);
if (provider != null) {
- SetRequest request = new SetRequest(element, feature, value);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
+ 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);
return emfCommand;
}

Back to the top