Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCéline Janssens2015-05-27 16:25:55 +0000
committerCamille Letavernier2015-06-09 14:43:12 +0000
commit7b82a35e7c2bc41fdd2b8575e3100a5fe6e176ee (patch)
tree3fb6dbcd86862e886738c1d49e2b383e0a264d18
parent34e88bc61097dd05446e894bdcaf3b8dc2c5661c (diff)
downloadorg.eclipse.papyrus-7b82a35e7c2bc41fdd2b8575e3100a5fe6e176ee.tar.gz
org.eclipse.papyrus-7b82a35e7c2bc41fdd2b8575e3100a5fe6e176ee.tar.xz
org.eclipse.papyrus-7b82a35e7c2bc41fdd2b8575e3100a5fe6e176ee.zip
Bug 467979: Unexpected additionnal link present on stereotyped links
https://bugs.eclipse.org/bugs/show_bug.cgi?id=467979 - Fix the creation of multiple comment Views - override refresh method in AppliedStereootypeCommentLinkEditPart because a Link with a null target is not refreshed by default. Change-Id: Id13e96e371fdfc8759ad9d523f29f5940c6759f6 Signed-off-by: Céline Janssens <Celine.Janssens@all4tec.net> Reviewed-on: https://git.eclipse.org/r/48846 Tested-by: Hudson CI Reviewed-by: Benoit Maggi <benoit.maggi@cea.fr> Tested-by: Benoit Maggi <benoit.maggi@cea.fr> Reviewed-by: Camille Letavernier <camille.letavernier@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/AssociationEditPart.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractAppliedStereotypeDisplayEditPolicy.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypesCommentLinkEditPart.java40
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java8
5 files changed, 55 insertions, 1 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/AssociationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/AssociationEditPart.java
index affc5b26088..f1bb55fdce4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/AssociationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/AssociationEditPart.java
@@ -50,6 +50,8 @@ public class AssociationEditPart extends AbstractAssociationEditPart implements
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractAppliedStereotypeDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractAppliedStereotypeDisplayEditPolicy.java
index 321b4bd7297..c66b20129cd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractAppliedStereotypeDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractAppliedStereotypeDisplayEditPolicy.java
@@ -331,7 +331,7 @@ public abstract class AbstractAppliedStereotypeDisplayEditPolicy extends Graphic
if (helper.isStereotypeView(child)) {
if (((View) child).getElement() instanceof Stereotype) {
Stereotype childStereotype = (Stereotype) ((View) child).getElement();
- if (!hostSemanticElement.isStereotypeApplied(childStereotype)) {
+ if (hostSemanticElement != null && !hostSemanticElement.isStereotypeApplied(childStereotype)) {
executeStereotypeViewRemove(hostEditPart, (View) child);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java
index a831e3e7dda..66c068e9987 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java
@@ -213,6 +213,10 @@ public class CommentShapeForAppliedStereotypeEditPolicy extends AbstractAppliedS
if (getUMLElement() == null) {
executeAppliedStereotypeCommentDeletion(domain, commentNode);
}
+
+ if (commentNode.getSourceEdges().size() == 0 && commentNode.getTargetEdges().size() == 0) {
+ executeAppliedStereotypeCommentDeletion(domain, commentNode);
+ }
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypesCommentLinkEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypesCommentLinkEditPart.java
index e0f9ead2547..aca9b0b2fed 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypesCommentLinkEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypesCommentLinkEditPart.java
@@ -18,6 +18,7 @@ import org.eclipse.draw2d.Graphics;
import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.stereotype.edition.Activator;
/**
@@ -66,4 +67,43 @@ public class AppliedStereotypesCommentLinkEditPart extends ConnectionEditPart {
this.setLineStyle(Graphics.LINE_DASH);
}
}
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart#refresh()
+ *
+ */
+ @Override
+ public void refresh() {
+
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ refreshVisuals();
+ refreshChildren();
+ refreshSourceAnchor();
+ refreshTargetAnchor();
+ refreshSourceConnections();
+ refreshTargetConnections();
+ }
+ });
+ } catch (InterruptedException e) {
+ Activator.log.error(e);
+
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart#refreshVisuals()
+ *
+ */
+ @Override
+ protected void refreshVisuals() {
+
+ super.refreshVisuals();
+ if (this.getTarget() == null || this.getSource() == null) {
+ setVisibility(false);
+ }
+ }
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java
index b5e09c80e9c..f437485fbf2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java
@@ -116,6 +116,14 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
if (eventType == Notification.REMOVE && notification.getOldValue().equals(hostView) && object == null) {
executeAppliedStereotypeCommentDeletion(hostEditPart.getEditingDomain(), comment);
}
+
+ if (comment.getTargetEdges() != null) {
+
+ // If the Target View is null then remove the Comment View
+ if (eventType == Notification.REMOVE && notification.getOldValue().equals(hostView) && comment.getTargetEdges().size() == 0) {
+ executeAppliedStereotypeCommentDeletion(hostEditPart.getEditingDomain(), comment);
+ }
+ }
}

Back to the top