Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2017-07-20 23:01:34 +0000
committerNicolas FAUVERGUE2018-07-26 09:23:26 +0000
commitdc7bec32ef1cbba17c97a77e1b28f7866b6747f3 (patch)
treea8f0bddc5e65d12e913c75e8ae6995457992889a
parent3e5515be88c0effc49a73e05a53dab4acad08dd3 (diff)
downloadorg.eclipse.papyrus-dc7bec32ef1cbba17c97a77e1b28f7866b6747f3.tar.gz
org.eclipse.papyrus-dc7bec32ef1cbba17c97a77e1b28f7866b6747f3.tar.xz
org.eclipse.papyrus-dc7bec32ef1cbba17c97a77e1b28f7866b6747f3.zip
Bug 333862 - [Composite structure diagram] Inconsistency when moving a port from one property to another
- Assure that port view is removed, if it is no longer valid (port does not belong do part's type due to move) - It is still not possible to change the port owner graphically. But this is not a critical issue and probably difficult to implement, since it would conflict with the border-item-locator. (and also not possible for ports directly attached to classes). Might be fixed later (enhancement) Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr>
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/ClassifierHelperAdvice.java27
1 files changed, 25 insertions, 2 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/ClassifierHelperAdvice.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/ClassifierHelperAdvice.java
index 39ef7d8b243..14171c43701 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/ClassifierHelperAdvice.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/ClassifierHelperAdvice.java
@@ -286,14 +286,37 @@ public class ClassifierHelperAdvice extends AbstractEditHelperAdvice {
@SuppressWarnings("unchecked")
final Iterator<EObject> it = request.getElementsToMove().keySet().iterator();
+ final EObject targetContainer = request.getTargetContainer();
while (it.hasNext()) {
final EObject eObject = it.next();
if (eObject instanceof Generalization) {
viewsToDestroy.addAll(getViewsToDestroy(eObject));
viewsToDestroy.addAll(getViewsAccordingToGeneralization((Generalization) eObject));
- } else if (eObject instanceof Feature || eObject instanceof Classifier) {
- viewsToDestroy.addAll(getViewsAccordingToEObject(eObject, request.getTargetContainer()));
+ }
+ else if (eObject instanceof Port) {
+ // remove view of ports attached to parts, if the port changes its owner.
+ for (View viewToDestroy : getViewsToDestroy(eObject)) {
+ View parentView = ViewUtil.getContainerView(viewToDestroy);
+ if (parentView.getElement() instanceof Property) {
+ Property part = (Property) parentView.getElement();
+ boolean destroy = true;
+ // check if the view does not need to be destroyed since the port is still
+ // owned by the partType or one of its super-classes
+ if (part.getType() instanceof org.eclipse.uml2.uml.Class) {
+ org.eclipse.uml2.uml.Class partType = (org.eclipse.uml2.uml.Class) part.getType();
+ if (partType == targetContainer || partType.getGenerals().contains(targetContainer)) {
+ destroy = false;
+ }
+ }
+ if (destroy) {
+ viewsToDestroy.add(viewToDestroy);
+ }
+ }
+ }
+ }
+ else if (eObject instanceof Feature || eObject instanceof Classifier) {
+ viewsToDestroy.addAll(getViewsAccordingToEObject(eObject, targetContainer));
}
}

Back to the top