Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Le Fevre2017-08-23 13:16:17 +0000
committerPatrick Tessier2017-09-21 12:54:29 +0000
commit3e3c61cab51913c345e1838253cd644c0595c7d7 (patch)
tree8c36750708ea9b6b92edbaeebecd530e72588fa2 /plugins/uml
parent3d9fa51ba009bac2e5888768a6840a07b0698ede (diff)
downloadorg.eclipse.papyrus-3e3c61cab51913c345e1838253cd644c0595c7d7.tar.gz
org.eclipse.papyrus-3e3c61cab51913c345e1838253cd644c0595c7d7.tar.xz
org.eclipse.papyrus-3e3c61cab51913c345e1838253cd644c0595c7d7.zip
Bug 477724 - Unsetting the type of an attribute deletes the attribute
itself if attribute created through association Actions -remove only the association -create unit test Test -manual test in remote rcp -uml.service.types.tests execution all Review -very strange behavior with commands in the command stack Change-Id: I6f8301c08b94d20ff4ebed17fae41dedd1410e9f Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=477724 Signed-off-by: Francois Le Fevre <francois.le-fevre@cea.fr>
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/PropertyHelperAdvice.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/PropertyHelperAdvice.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/PropertyHelperAdvice.java
index 51d223332fe..ac90c7e3283 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/PropertyHelperAdvice.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/PropertyHelperAdvice.java
@@ -128,7 +128,6 @@ public class PropertyHelperAdvice extends AbstractEditHelperAdvice {
@Override
protected ICommand getBeforeSetCommand(SetRequest request) {
ICommand gmfCommand = super.getBeforeSetCommand(request);
- ;
EObject elementToEdit = request.getElementToEdit();
@@ -154,19 +153,21 @@ public class PropertyHelperAdvice extends AbstractEditHelperAdvice {
}
}
- // Type set to null implies the property should be removed from association member ends (if related to an Association)
+ // Type set to null implies the property should be kept and the association deleted: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=477724
if ((elementToEdit instanceof Property) && !(elementToEdit instanceof Port) && (request.getFeature() == UMLPackage.eINSTANCE.getTypedElement_Type()) && (request.getValue() == null)) {
Property propertyToEdit = (Property) elementToEdit;
Association relatedAssociation = propertyToEdit.getAssociation();
if (relatedAssociation != null) {
// General case, delete the ConnectorEnd
- DestroyReferenceRequest destroyRefRequest = new DestroyReferenceRequest(relatedAssociation, UMLPackage.eINSTANCE.getAssociation_MemberEnd(), propertyToEdit, false);
IElementEditService provider = ElementEditServiceUtils.getCommandProvider(relatedAssociation);
if (provider != null) {
- // Add current EObject destroy reference command to the global command
- ICommand destroyMemberRefCommand = provider.getEditCommand(destroyRefRequest);
- gmfCommand = CompositeCommand.compose(gmfCommand, destroyMemberRefCommand);
+ DestroyElementRequest destroyRequest = new DestroyElementRequest(relatedAssociation, false);
+ List<EObject> ps = new ArrayList<EObject>();
+ ps.add(propertyToEdit);
+ destroyRequest.setParameter(org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants.DEPENDENTS_TO_KEEP, ps);
+ ICommand destroyCommand = provider.getEditCommand(destroyRequest);
+ gmfCommand = CompositeCommand.compose(gmfCommand, destroyCommand);
}
}
}

Back to the top