Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratischenko2015-10-06 15:46:16 -0400
committerGerrit Code Review @ Eclipse.org2015-10-23 06:00:16 -0400
commit4d07d5cc4d2c44a629adb6cdf23f3e8a2646bdc9 (patch)
treec27b83edba6230a4fb0e7f9f6b769616ea070d68 /plugins
parenta2f524782c92b69d1c316bc454285a97a08273b1 (diff)
downloadorg.eclipse.papyrus-4d07d5cc4d2c44a629adb6cdf23f3e8a2646bdc9.tar.gz
org.eclipse.papyrus-4d07d5cc4d2c44a629adb6cdf23f3e8a2646bdc9.tar.xz
org.eclipse.papyrus-4d07d5cc4d2c44a629adb6cdf23f3e8a2646bdc9.zip
Bug 473837 - [CSS][Deployment Diagram][BMM] Symbol compartment is not
visible when a stereotyped element is created inside a Package. for NodeEditPart: - fix showing shape compartment for RondedCompartmentFigure and NodeNamedFigure - fix stereotype compartment Change-Id: I81a0902244e66eccbaf4fb81d91b4e1da434e3c2 Signed-off-by: atischenko <tischenko@montages.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeEditPolicyProvider.java23
3 files changed, 33 insertions, 4 deletions
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 d55f3cdaf91..200eb779d27 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
@@ -43,7 +43,7 @@ import org.eclipse.uml2.uml.Stereotype;
public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNodeLabelDisplayEditPolicy {
/** constant for this edit policy role */
- public final static String STEREOTYPE_LABEL_POLICY = "AppliedStereotypeCompartmentEditPolicy"; //$NON-NLS-1$
+ public final static String STEREOTYPE_COMPARTMENT_POLICY = "AppliedStereotypeCompartmentEditPolicy"; //$NON-NLS-1$
/**
* Creates a new AppliedStereotype display edit policy
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java
index 62b08c44fad..f1a7acc22a4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java
@@ -23,9 +23,11 @@ import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPolicies
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCommentEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypeMultilinePropertyEditPart;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCommentEditPolicy;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCompartmentEditPolicy;
@@ -53,9 +55,13 @@ public class CustomEditPolicyProvider extends AbstractProvider implements IEditP
}
if (editPart instanceof NamedElementEditPart || editPart instanceof AbstractCommentEditPart) {
- editPart.installEditPolicy(AppliedStereotypeCompartmentEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeCompartmentEditPolicy());
-
-
+ editPart.installEditPolicy(AppliedStereotypeCompartmentEditPolicy.STEREOTYPE_COMPARTMENT_POLICY, new AppliedStereotypeCompartmentEditPolicy());
+ }
+ if (editPart instanceof NodeEditPart) {
+ NodeEditPart nodeEP = (NodeEditPart) editPart;
+ if (nodeEP.getPrimaryShape() instanceof RoundedCompartmentFigure) {
+ editPart.installEditPolicy(AppliedStereotypeCompartmentEditPolicy.STEREOTYPE_COMPARTMENT_POLICY, new AppliedStereotypeCompartmentEditPolicy());
+ }
}
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeEditPolicyProvider.java
index 8756031ba12..effe8a15ab7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeEditPolicyProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeEditPolicyProvider.java
@@ -14,14 +14,18 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.symbols.provider;
+import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ShapeCompartmentEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure;
/**
* Edit policy provider for the shape compartement
@@ -45,6 +49,11 @@ public class ShapeEditPolicyProvider extends AbstractProvider implements IEditPo
return true;
}
+ // Provides for NodeEditParts with figures which can contain shapes
+ if (isNodeEPWithSymbolCompartmentFigure(gep)) {
+ return true;
+ }
+
return false;
}
@@ -57,5 +66,19 @@ public class ShapeEditPolicyProvider extends AbstractProvider implements IEditPo
if (editPart instanceof NamedElementEditPart) { // add to Block Property Composite and Block Composite
editPart.installEditPolicy(ShapeCompartmentEditPolicy.SHAPE_COMPARTMENT_EDIT_POLICY, new ShapeCompartmentEditPolicy());
}
+ if (isNodeEPWithSymbolCompartmentFigure((IGraphicalEditPart)editPart)) {
+ editPart.installEditPolicy(ShapeCompartmentEditPolicy.SHAPE_COMPARTMENT_EDIT_POLICY, new ShapeCompartmentEditPolicy());
+ }
+ }
+
+ /**
+ * @return true if figure contain container for shape elements and container edit part is a NodeEditPart
+ */
+ private boolean isNodeEPWithSymbolCompartmentFigure(IGraphicalEditPart ep) {
+ if (ep instanceof NodeEditPart) {
+ IFigure figure = ((NodeEditPart) ep).getPrimaryShape();
+ return figure instanceof RoundedCompartmentFigure || figure instanceof NodeNamedElementFigure;
+ }
+ return false;
}
}

Back to the top