Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCéline Janssens2015-06-15 07:42:35 +0000
committerCamille Letavernier2015-06-19 18:43:10 +0000
commit91ce29500a4bf117bd221df0d603ca3e9de24c57 (patch)
treeca958517c1133ac6713b9b2365294ca1d53b39d5 /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition
parent5ac42f0f1add359105c1fb865a742ea52d25bec3 (diff)
downloadorg.eclipse.papyrus-91ce29500a4bf117bd221df0d603ca3e9de24c57.tar.gz
org.eclipse.papyrus-91ce29500a4bf117bd221df0d603ca3e9de24c57.tar.xz
org.eclipse.papyrus-91ce29500a4bf117bd221df0d603ca3e9de24c57.zip
Bug 470039: [Stereotype Display] Refresh issues when changing the
visibility of stereotypes from the properties view https://bugs.eclipse.org/bugs/show_bug.cgi?id=470039 - Add listeners on the notation Structure. (and remove when not required anymore) - Refresh display when structure has been modified - Update Persistency (add or remove) - Fix refresh issue when EAnnotation to force visiblility is added. Change-Id: I5cc86a534df2e4ac5f43200819eaf4e30e912124 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=470032 Signed-off-by: Céline Janssens <Celine.Janssens@all4tec.net> Reviewed-on: https://git.eclipse.org/r/50281 Tested-by: Hudson CI Reviewed-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net> Reviewed-by: Camille Letavernier <camille.letavernier@cea.fr>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java2
3 files changed, 59 insertions, 8 deletions
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 f437485fbf2..6937c24bce1 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
@@ -98,6 +98,8 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
refreshStereotypeCommentStructure();
}
}
+
+
}
/**
@@ -145,9 +147,14 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
if (!stereotypeList.isEmpty()) {
comment = createCommentNode();
if (comment != null) {
+
for (Stereotype stereotype : stereotypeList) {
refreshStereotypeCompartmentStructure(stereotype);
+ getDiagramEventBroker().addNotificationListener(helper.getStereotypeCompartment(comment, stereotype), this);
+
refreshStereotypeBraceStructure(stereotype);
+ getDiagramEventBroker().addNotificationListener(helper.getStereotypeBraceCompartment(comment, stereotype), this);
+
}
}
@@ -157,6 +164,24 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
/**
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractAppliedStereotypeDisplayEditPolicy#removeListener()
+ *
+ */
+ @Override
+ public void removeListener() {
+
+ if (!stereotypeList.isEmpty()) {
+ if (null != comment) {
+ for (Stereotype stereotype : stereotypeList) {
+ getDiagramEventBroker().removeNotificationListener(helper.getStereotypeCompartment(comment, stereotype), this);
+ getDiagramEventBroker().removeNotificationListener(helper.getStereotypeBraceCompartment(comment, stereotype), this);
+ }
+ }
+ }
+
+ }
+
+ /**
* @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy#refreshStereotypeDisplay()
*
*/
@@ -220,9 +245,8 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
BasicCompartment compartment = helper.getStereotypeCompartment(comment, stereotype);
if (compartment == null) { // No Compartment Exist for this Stereotype
createAppliedStereotypeCompartment(stereotype);
- createAppliedStereotypeProperties(stereotype);
-
}
+ createAppliedStereotypeProperties(stereotype);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java
index d1ca5491691..d55f3cdaf91 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java
@@ -66,6 +66,8 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
if (!stereotypeList.isEmpty()) {
for (Stereotype stereotype : stereotypeList) {
refreshStereotypeCompartmentStructure(stereotype);
+ getDiagramEventBroker().addNotificationListener(helper.getStereotypeCompartment(hostView, stereotype), this);
+
}
}
}
@@ -79,6 +81,30 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
// Nothing to refresh
}
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractAppliedStereotypeDisplayEditPolicy#removeListener()
+ *
+ */
+ @Override
+ public void removeListener() {
+ // Remove Listener for Compartment and properties
+ if (!stereotypeList.isEmpty()) {
+ for (Stereotype stereotype : stereotypeList) {
+ Node compartment = helper.getStereotypeCompartment(hostView, stereotype);
+
+ if (null != compartment && null != stereotype) {
+ getDiagramEventBroker().removeNotificationListener(compartment, this);
+ EList<Property> properties = stereotype.allAttributes();
+ for (Property property : properties) {
+ getDiagramEventBroker().removeNotificationListener(helper.getStereotypeProperty(hostView, stereotype, property), this);
+
+ }
+
+
+ }
+ }
+ }
+ }
/**
* Refresh The StereotypeCompartment notation structure.
@@ -90,11 +116,10 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
protected void refreshStereotypeCompartmentStructure(Stereotype stereotype) {
BasicCompartment compartment = helper.getStereotypeCompartment(hostView, stereotype);
- if (compartment == null) { // No Label Exist for this Stereotype
+ if (null == compartment) { // No Compartment Exist for this Stereotype
createAppliedStereotypeCompartment(stereotype);
- createAppliedStereotypeProperties(stereotype);
-
}
+ createAppliedStereotypeProperties(stereotype);
}
/**
@@ -124,11 +149,13 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
protected void createAppliedStereotypeProperties(final Stereotype stereotype) {
Node compartment = helper.getStereotypeCompartment(hostEditPart.getNotationView(), stereotype);
- if (compartment != null && stereotype != null) {
+ if (null != compartment && null != stereotype) {
EList<Property> properties = stereotype.allAttributes();
for (Property property : properties) {
createAppliedStereotypeProperty(compartment, property);
+ getDiagramEventBroker().addNotificationListener(helper.getStereotypeProperty(hostView, stereotype, property), this);
+
}
@@ -148,7 +175,7 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
protected void createAppliedStereotypeProperty(Node compartment, Property property) {
// if stereotype is null all property of stereotype has to be removed!
- if (property != null && !property.getName().startsWith(Extension.METACLASS_ROLE_PREFIX)) {
+ if (null != property && !property.getName().startsWith(Extension.METACLASS_ROLE_PREFIX)) {
if (!helper.isPropertyExist(compartment, property)) {
// go through each stereotype property
executeAppliedStereotypePropertyViewCreation(hostEditPart, compartment, property);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java
index a558e71a7b6..80538d75aef 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java
@@ -42,7 +42,7 @@ public class AppliedStereotypeCompartmentForCommentShapeEditPolicy extends Appli
*/
@Override
public void activate() {
- // TODO Auto-generated method stub
+
super.activate();
}

Back to the top