Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCéline Janssens2015-02-23 10:54:33 +0000
committerCéline Janssens2015-05-06 13:12:47 +0000
commit7d79f366cef733c758d3d21b02103f52eb7c8eec (patch)
treea73df70f298f17d7630cac101808b99b9e4269fe /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition
parentdb0a842e0e90d28754bfc88acd19743223515cc9 (diff)
downloadorg.eclipse.papyrus-7d79f366cef733c758d3d21b02103f52eb7c8eec.tar.gz
org.eclipse.papyrus-7d79f366cef733c758d3d21b02103f52eb7c8eec.tar.xz
org.eclipse.papyrus-7d79f366cef733c758d3d21b02103f52eb7c8eec.zip
Bug 460356: [Stereotype Display] Objective 4c. Display properties into a
comment thanks to CSS. - Refactor EditPolicies - Add creation of Stereotype Structure at the ASLabelDisplayEditPolicy - creation of Comment with new Structure as a copy of the Compartment. - Comment Compartment Displayed and deleted - Small refactor - Default display: All is displayed everywhere by Default Change-Id: Ief7bf1d8b8cbffa8301b0e342c7f26d5c66941b5 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=460356 Signed-off-by: Céline Janssens <Celine.Janssens@all4tec.net>
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/META-INF/MANIFEST.MF6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypeCommentViewCommand.java211
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypePropertyViewCommand.java66
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypeViewCommand.java92
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateStereotypeLabelCommand.java93
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCommentEditPart.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypesCommentEditPart.java)6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java41
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java399
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java420
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java29
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeLabelEditPolicy.java112
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypePropertiesEditPolicy.java58
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypePropertiesEditPartProvider.java6
16 files changed, 485 insertions, 1068 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF
index 23e337b723b..1f463e97171 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF
@@ -1,6 +1,5 @@
Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.stereotype.edition.command,
- org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart,
+Export-Package: org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart,
org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies
Require-Bundle: org.eclipse.gmf.runtime.diagram.ui,
org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0",
@@ -14,7 +13,8 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui,
org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.1.0",
org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.profile;bundle-version="1.1.0"
+ org.eclipse.papyrus.uml.profile;bundle-version="1.1.0",
+ org.eclipse.gmf.runtime.notation
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.1.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml
index 5ff00a3067c..5331d355cfe 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml
@@ -20,7 +20,7 @@
<object
class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)"
id="StereotypePropertiesEditPartProvider">
- <method name="getType()" value="StereotypeCompartment,StereotypeProperty,AppliedStereotypesComment,AppliedStereotypesCommentLink"/>
+ <method name="getType()" value="StereotypeComment,StereotypeCompartment,StereotypeProperty,StereotypeCommentLink"/>
</object>
</editpartProvider>
</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypeCommentViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypeCommentViewCommand.java
deleted file mode 100644
index ce724f0e27e..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypeCommentViewCommand.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.stereotype.edition.command;
-
-import java.util.ArrayList;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.BasicCompartment;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.Connector;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.EObjectValueStyle;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.IdentityAnchor;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
-import org.eclipse.gmf.runtime.notation.TitleStyle;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
-import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
-import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
-import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypesCommentEditPart;
-import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypesCommentLinkEditPart;
-
-/**
- * the goal of this command is to create a comment in the notation that represent a compartment of stereotypes
- *
- */
-public class CreateAppliedStereotypeCommentViewCommand extends RecordingCommand {
-
- protected View owner;
-
- protected EObject base_element;
-
- protected int x;
-
- protected int y;
-
- protected TransactionalEditingDomain domain;
-
- protected Boolean isBorderedElement;
-
- /**
- *
- * Constructor.
- *
- * @param domain
- * @param owner
- * @param StereotypeApplication
- * @param displayit
- */
- public CreateAppliedStereotypeCommentViewCommand(TransactionalEditingDomain domain, View owner, int x, int y, EObject base_Element, boolean isABordererElement) {
- super(domain, "CreateAppliedStereotypeCommentView");
- this.owner = owner;
- this.base_element = base_Element;
- this.x = x;
- this.y = y;
- this.domain = domain;
- this.isBorderedElement = isABordererElement;
-
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void doExecute() {
-
- // create the node
- Node node = NotationFactory.eINSTANCE.createShape();
- node.setVisible(true);
- Bounds bounds = NotationFactory.eINSTANCE.createBounds();
- bounds.setX(x);
- bounds.setY(y);
- node.setLayoutConstraint(bounds);
- TitleStyle ts = NotationFactory.eINSTANCE.createTitleStyle();
- ts.setShowTitle(true);
- node.getStyles().add(ts);
- node.setElement(null);
- node.setType(AppliedStereotypesCommentEditPart.ID);
-
- connectCommentNode(owner, node);
-
-
-
- EObjectValueStyle eObjectValueStyle = (EObjectValueStyle) node.createStyle(NotationPackage.eINSTANCE.getEObjectValueStyle());
- eObjectValueStyle.setEObjectValue(base_element);
- eObjectValueStyle.setName("BASE_ELEMENT");
-
- // create the link
- Connector edge = NotationFactory.eINSTANCE.createConnector();
- edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
- RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
- ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
- points.add(new RelativeBendpoint());
- points.add(new RelativeBendpoint());
- bendpoints.setPoints(points);
- edge.setBendpoints(bendpoints);
- ViewUtil.insertChildView(owner.getDiagram(), edge, -1, true);
- edge.setType(AppliedStereotypesCommentLinkEditPart.ID);
- edge.setElement(base_element);
- IdentityAnchor anchor = NotationFactory.eINSTANCE.createIdentityAnchor();
- edge.setSourceAnchor(anchor);
- anchor = NotationFactory.eINSTANCE.createIdentityAnchor();
- edge.setTargetAnchor(anchor);
- edge.setSource(owner);
- edge.setTarget(node);
- edge.setElement(null);
- eObjectValueStyle = (EObjectValueStyle) edge.createStyle(NotationPackage.eINSTANCE.getEObjectValueStyle());
- eObjectValueStyle.setEObjectValue(base_element);
- eObjectValueStyle.setName("BASE_ELEMENT");
-
- // copy EAnnotation
- final EAnnotation stereotypeAnnotation = owner.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
- EAnnotation stereotypeAnnotationCopy = EcoreUtil.copy(stereotypeAnnotation);
- node.getEAnnotations().add(stereotypeAnnotationCopy);
- RecordingCommand cmd = AppliedStereotypeHelper.getSetAppliedStereotypePropertiesLocalizationCommand(domain, node, UMLVisualInformationPapyrusConstant.STEREOTYPE_COMPARTMENT_LOCATION);
- cmd.execute();
-
- String presentationKind = AppliedStereotypeHelper.getAppliedStereotypePresentationKind(node);
- cmd = AppliedStereotypeHelper.getRemoveAppliedStereotypeCommand(domain, node, AppliedStereotypeHelper.getStereotypesToDisplay(node), presentationKind);
- cmd.execute();
- }
-
- /**
- * add the comment node form the owner
- *
- * @param owner
- * the view from which we want to display a comment stereotype, cannot be null
- * @param commentNode
- * node that represent the comment , cannot be null
- */
- private void connectCommentNode(View owner, Node commentNode) {
-
- // in the case of the edge the comment has to be placed into the common parent of each end
- if (owner instanceof Edge) {
- View viewSource = ((Edge) owner).getSource();
- View viewTarget = ((Edge) owner).getSource();
- // list of source parents
- ArrayList<View> parentsSource = getParentTree(viewSource);
- // list of source targets
- ArrayList<View> parentsTarget = getParentTree(viewTarget);
- View commonParent = null;
- int index = 0;
- // find the common
- while (commonParent == null && index < parentsSource.size()) {
- if (parentsTarget.contains(parentsSource.get(index))) {
- commonParent = parentsSource.get(index);
- if (!(commonParent instanceof BasicCompartment)) {
- commonParent = null;
- }
- }
- index++;
- }
- // a common has been found
- if (commonParent != null) {
- ((Bounds) commentNode.getLayoutConstraint()).setX(100);
- ((Bounds) commentNode.getLayoutConstraint()).setY(100);
- ViewUtil.insertChildView(commonParent, commentNode, ViewUtil.APPEND, true);
- return;
- }
- }
- // generic case
- View econtainer = (View) owner.eContainer();
- // for the case of a port
- if (isBorderedElement) {
- if (econtainer.eContainer() != null) {
- econtainer = (View) econtainer.eContainer();
- }
- }
- ViewUtil.insertChildView(econtainer, commentNode, ViewUtil.APPEND, true);
-
- }
-
- /**
- * @param view
- * the view for which we look for its parents, cannot be null
- * @return the list of parents of a view
- */
- private ArrayList<View> getParentTree(View view) {
- ArrayList<View> parents = new ArrayList<View>();
- View currentView = view;
- while (currentView != null) {
- currentView = (View) currentView.eContainer();
- if (currentView != null) {
- if (!(currentView instanceof DecorationNode) && !(currentView instanceof BasicCompartment)) {
- // parents.addAll(currentView.getChildren());
- }
- parents.add(currentView);
- }
-
- }
- return parents;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypePropertyViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypePropertyViewCommand.java
deleted file mode 100644
index de20ff0f0ec..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypePropertyViewCommand.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotypes Display
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.stereotype.edition.command;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * the goal of this command is to create a basic compartment in the notation that represent a compartment of stereotypes
- *
- */
-public class CreateAppliedStereotypePropertyViewCommand extends RecordingCommand {
-
- protected View owner;
-
- protected Property property;
-
- protected EObject stereotypeApplication;
-
- protected Element element;
-
- public CreateAppliedStereotypePropertyViewCommand(TransactionalEditingDomain domain, View owner, Property property) {
-
- super(domain, "CreateStereotypePropertyView");
- this.owner = owner;
- this.property = property;
-
- }
-
- @Override
- public void doExecute() {
-
- // Create Stereotype Property into Notation Structure
-
- // Create property Label
- DecorationNode propertyLabel = NotationFactory.eINSTANCE.createDecorationNode();
- propertyLabel.setType(StereotypeDisplayUtils.STEREOTYPE_PROPERTY_TYPE);
- propertyLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- propertyLabel.setElement(property);
-
- // Add the new Label to it's owner Object
- ViewUtil.insertChildView(owner, propertyLabel, ViewUtil.APPEND, true);
- propertyLabel.setMutable(true);
-
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypeViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypeViewCommand.java
deleted file mode 100644
index c38574288c0..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateAppliedStereotypeViewCommand.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.stereotype.edition.command;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.StringValueStyle;
-import org.eclipse.gmf.runtime.notation.TitleStyle;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * the goal of this command is to create a basic compartment in the notation that represent a compartment of stereotypes
- *
- */
-public class CreateAppliedStereotypeViewCommand extends RecordingCommand {
-
- protected View node;
-
- protected EObject stereotypeApplication;
-
- protected Node parent;
-
- /**
- *
- * Constructor.
- *
- * @param domain
- * @param node
- * The EditPart view of the Compartment
- * @param StereotypeApplication
- * @param displayit
- */
- public CreateAppliedStereotypeViewCommand(TransactionalEditingDomain domain, View node, EObject stereotypeApplication) {
- super(domain, "CreateStereotypeCompartment");
- this.node = node;
- this.stereotypeApplication = stereotypeApplication;
- parent = StereotypeDisplayHelper.getStereotypeLabel(node, stereotypeApplication);
-
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void doExecute() {
-
-
- Stereotype stereotype = UMLUtil.getStereotype(stereotypeApplication);
-
- // Create the Graphical Compartment
- Node compartment = NotationFactory.eINSTANCE.createBasicCompartment();
- compartment.setVisible(true);
- compartment.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
-
- // Create Title Style
- TitleStyle ts = NotationFactory.eINSTANCE.createTitleStyle();
- ts.setShowTitle(true);
- compartment.getStyles().add(ts);
-
- // Create Stereotype Name Style
- StringValueStyle stereotypeNameStyle = NotationFactory.eINSTANCE.createStringValueStyle();
- stereotypeNameStyle.setName(StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_NAME);
- stereotypeNameStyle.setStringValue(stereotype.getQualifiedName());
- compartment.getStyles().add(stereotypeNameStyle);
-
- // Complete the creation
- compartment.setElement(stereotypeApplication);
- compartment.setType(StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_TYPE);
- ViewUtil.insertChildView(node, compartment, ViewUtil.APPEND, true);
- compartment.setMutable(true);
-
- }
-
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateStereotypeLabelCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateStereotypeLabelCommand.java
deleted file mode 100644
index e2892072532..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/command/CreateStereotypeLabelCommand.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
- * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotypes Display
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.stereotype.edition.command;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.StringValueStyle;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * @author Céline JANSSENS
- *
- */
-public class CreateStereotypeLabelCommand extends RecordingCommand {
-
- private static final String STEREOTYPE_LABEL_COMMAND_NAME = "Stereotype Label Creation Command";
-
-
- protected View owner;
-
- protected EObject stereoApplication;
-
- protected boolean isVisible;
-
- protected Element element;
-
- /**
- * Constructor.
- *
- * @param domain
- * Transactional domain
- * @param owner
- * Owner of the Label Created
- * @param stereoApplication
- * Stereotype application which the Label will be based on
- * @param isVisible
- * if the Label is Visible when created
- */
- public CreateStereotypeLabelCommand(TransactionalEditingDomain domain, View owner, EObject stereoApplication, boolean isVisible) {
- super(domain, STEREOTYPE_LABEL_COMMAND_NAME);
- this.owner = owner;
- this.stereoApplication = stereoApplication;
- this.isVisible = isVisible;
- }
-
- /**
- * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
- *
- */
- @SuppressWarnings("unchecked")
- @Override
- protected void doExecute() {
-
- Stereotype stereotype = UMLUtil.getStereotype(stereoApplication);
- // Create Label
- DecorationNode label = NotationFactory.eINSTANCE.createDecorationNode();
- label.setType(StereotypeDisplayUtils.STEREOTYPE_LABEL_TYPE);
- label.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- label.setElement(stereoApplication);
-
- // Create Stereotype Name Style
- StringValueStyle stereotypeNameStyle = NotationFactory.eINSTANCE.createStringValueStyle();
- stereotypeNameStyle.setName(StereotypeDisplayUtils.STEREOTYPE_LABEL_NAME);
- stereotypeNameStyle.setStringValue(stereotype.getQualifiedName());
- label.getStyles().add(stereotypeNameStyle);
-
- // Add the new Label to it's owner Object
- ViewUtil.insertChildView(owner, label, ViewUtil.APPEND, true);
- label.setMutable(true);
-
-
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypesCommentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCommentEditPart.java
index f1e9df0a5fa..7fd701acc26 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypesCommentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCommentEditPart.java
@@ -41,9 +41,9 @@ import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedSt
*
*/
-public class AppliedStereotypesCommentEditPart extends NodeEditPart implements IGraphicalEditPart, IPrimaryEditPart {
+public class AppliedStereotypeCommentEditPart extends NodeEditPart implements IGraphicalEditPart, IPrimaryEditPart {
- public AppliedStereotypesCommentEditPart(View view) {
+ public AppliedStereotypeCommentEditPart(View view) {
super(view);
}
@@ -144,6 +144,8 @@ public class AppliedStereotypesCommentEditPart extends NodeEditPart implements I
return nodeShape; // use nodeShape itself as contentPane
}
+
+
/**
* @generated
*/
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java
index 8fe929bba42..18c32c0cd37 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java
@@ -9,6 +9,7 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 460356 : Refactor Stereotype Display
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart;
@@ -31,7 +32,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeCompartmentFigure;
-import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypePropertiesEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.util.UMLUtil;
@@ -43,6 +44,8 @@ public class AppliedStereotypeCompartmentEditPart extends ResizeableListCompartm
public static String ID = "AppliedStereotypeCompartment";
+ private static final String NO_STEREOTYPE_COMPARTMENT = "Bad compartement stereotype";
+
public AppliedStereotypeCompartmentEditPart(View view) {
super(view);
}
@@ -52,20 +55,30 @@ public class AppliedStereotypeCompartmentEditPart extends ResizeableListCompartm
return false;
}
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart#refreshBounds()
+ *
+ */
+ @Override
+ protected void refreshBounds() {
+ // nothingToDo
+ }
+
@Override
public String getCompartmentName() {
- Stereotype stereotype = UMLUtil.getStereotype(this.resolveSemanticElement());
+ Stereotype stereotype = UMLUtil.getStereotype(resolveSemanticElement());
if (stereotype != null) {
- return "" + String.valueOf("\u00AB") + stereotype.getName() + String.valueOf("\u00BB");
+ return (StereotypeDisplayUtils.BRACE_LEFT + stereotype.getName() + StereotypeDisplayUtils.BRACE_RIGHT);
}
- return "bad compartement stereotype";
+ return NO_STEREOTYPE_COMPARTMENT;
}
+
/**
- * this method has bee rewritten in order to add its wn figure to ensure to mange it
- * in papyrus Figure.
+ * this method has be rewritten in order to add its own figure to ensure to manage it
+ * in Papyrus Figure.
*
* Adds a constrained flow layout algorithm to the content pane of compartment figure
*
@@ -74,14 +87,17 @@ public class AppliedStereotypeCompartmentEditPart extends ResizeableListCompartm
@Override
public IFigure createFigure() {
ResizableCompartmentFigure rcf;
- if (getParent() == getTopGraphicEditPart()) {
- // replace ResizableCompartmentFigure by it own figure in order to manage it.
+
+
+ // If the EditPart is the direct Children
+ if ((getParent() == getTopGraphicEditPart())) {
+ // replace ResizableCompartmentFigure by its own figure in order to manage it.
rcf = new AppliedStereotypeCompartmentFigure(getCompartmentName(), getMapMode());
} else {
rcf = new NestedResizableCompartmentFigure(getMapMode());
-
}
- if (this.getParent() instanceof AppliedStereotypesCommentEditPart) {
+
+ if (getParent() instanceof AppliedStereotypeCommentEditPart) {
rcf.setBorder(null);
if (rcf.getTextPane().getChildren().size() > 0 && rcf.getTextPane().getChildren().get(0) instanceof WrappingLabel) {
WrappingLabel label = (WrappingLabel) rcf.getTextPane().getChildren().get(0);
@@ -111,7 +127,6 @@ public class AppliedStereotypeCompartmentEditPart extends ResizeableListCompartm
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- installEditPolicy(AppliedStereotypePropertiesEditPolicy.APPLIED_STEREOTYPE_VISIBILITY_COMPARTMENT, new AppliedStereotypePropertiesEditPolicy());
}
@@ -147,10 +162,6 @@ public class AppliedStereotypeCompartmentEditPart extends ResizeableListCompartm
}
}
- @Override
- protected void refreshBounds() {
- }
-
/**
*
* @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart#refreshVisuals()
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java
index 707baebf755..68d9c8c48dc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java
@@ -161,6 +161,7 @@ public class AppliedStereotypeMultilinePropertyEditPart extends CompartmentEditP
* set the text if not
*/
protected void setLabelTextHelper(IFigure figure, String text) {
+
if (figure instanceof FlowPage) {
// remove all children from page.
((FlowPage) figure).removeAll();
@@ -923,7 +924,8 @@ public class AppliedStereotypeMultilinePropertyEditPart extends CompartmentEditP
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#getAdapter(java.lang.Class)
*
* @param key
- * @return
+ * Class for which the adapter is required
+ * @return the adapter Option according to the key class.
*/
@Override
public Object getAdapter(Class key) {
@@ -940,7 +942,7 @@ public class AppliedStereotypeMultilinePropertyEditPart extends CompartmentEditP
/**
- * locator for the multiline Cell
+ * Locator for the multiline Cell
*
*/
static public class MultilineCellEditorLocator implements CellEditorLocator {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java
index 71e87e81ec2..095da1025af 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java
@@ -15,205 +15,233 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.BasicCompartment;
import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.LayoutConstraint;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
-import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
-import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.stereotype.edition.command.CreateAppliedStereotypeCommentViewCommand;
-import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypesCommentLinkEditPart;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateAppliedStereotypeCommentContentCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateAppliedStereotypeCommentViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeLocationEnum;
import org.eclipse.papyrus.uml.tools.listeners.StereotypeElementListener.StereotypeExtensionNotification;
-import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.uml2.uml.Element;
/**
* This editpolicy has in charge to :
* - create or destroy the appliedStereotypesCommentEditpart
* - adapt the information about stereotype display into appliedstereotypeCommentEditPart
- * by using eannotation existing mechanism
+ * by using NamedStyle mechanism into Notation model
+ *
*
*/
public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotypeNodeLabelDisplayEditPolicy {
/** constant for this edit policy role */
- public final static String APPLIED_STEREOTYPE_COMMENT = "Applied_Stereotype_Comment";
+ public final static String APPLIED_STEREOTYPE_COMMENT = "AppliedStereotypeComment";// $NON-NLS-1$
+ protected GraphicalEditPart hostEditPart;
+ private Node node;
+ private Node comment;
/**
- * This method has in charge to refresh the presence of the view that represent the comment
+ * Map between Stereotype Name and StereotypeLabel displayed
*/
- protected void updateAppliedStereotypeCommentShape() {
- String stereotypeLocalizationToDisplay = AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization((View) getHost().getModel());
- String stereotypePropertiesToDisplay = AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay((View) getHost().getModel());
- // look for the AppliedStereotypesCommentEditPart
- if (getAppliedStereotypeCommentNode() == null && (!stereotypePropertiesToDisplay.trim().equals(""))) {
- // test if stereotype has to be display as a comment
- if (stereotypeLocalizationToDisplay.equals(UMLVisualInformationPapyrusConstant.STEREOTYPE_COMMENT_LOCATION)) {
+ private Map<EObject, BasicCompartment> stereotypeCommentMap = new HashMap<EObject, BasicCompartment>();
- if (getHost() instanceof ConnectionEditPart) {
- executeAppliedStereotypeCommentCreation(getHost(), ((ConnectionEditPart) getHost()).getEditingDomain(), ((ConnectionEditPart) getHost()).resolveSemanticElement());
- }
- if (getHost() instanceof GraphicalEditPart) {
- executeAppliedStereotypeCommentCreation(getHost(), ((GraphicalEditPart) getHost()).getEditingDomain(), ((GraphicalEditPart) getHost()).resolveSemanticElement());
- }
- }
- }
- // test if the comment has to be removed
- if (getAppliedStereotypeCommentNode() != null) {
- View commentNode = getAppliedStereotypeCommentNode();
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy#activate()
+ *
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ if (getHost() instanceof GraphicalEditPart) {
+ hostEditPart = (GraphicalEditPart) getHost();
+ node = getNotationNode();
- // 1. the display is not comment
- if (!stereotypeLocalizationToDisplay.equals(UMLVisualInformationPapyrusConstant.STEREOTYPE_COMMENT_LOCATION)) {
- final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(commentNode);
- executeAppliedStereotypeCommentDeletion(domain, commentNode);
- }
+ }
+
+ // if stereotype has been applied, compartment has to be created
+ Element umlElement = getUMLElement();
+ // umlElement may be null if the semantic element has been deleted and the view hasn't been cleaned
+ if (umlElement != null) {
+ Iterator<EObject> iterator = umlElement.getStereotypeApplications().iterator();
+ while (iterator.hasNext()) {
+ final EObject appliedstereotype = iterator.next();
+ createAppliedStereotypeCompartmentComment(appliedstereotype);
- // the result of properties to display is null so no compartment will be created
- String todisplay = StereotypeUtil.getPropertiesValues(stereotypePropertiesToDisplay, getUMLElement());
- if ("".equals(todisplay.trim())) {
- final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(commentNode);
- executeAppliedStereotypeCommentDeletion(domain, commentNode);
}
}
-
}
/**
- * return the number of visible compartment that represent a stereotype
*
- * @param view
- * the container view
- * @param eobject
- * the eobject that represent the container
- * @return the number of visible stereotype compartment
+ * {@inheritedDoc}
*/
- protected int getvisisbleAppliedStereotypeCompartment(View view, EObject eobject) {
- int nbVisibleCompartment = 0;
- @SuppressWarnings("unchecked")
- Iterator<View> iteratorView = view.getChildren().iterator();
- while (iteratorView.hasNext()) {
- View subview = iteratorView.next();
- if (subview.getElement() != null && !subview.getElement().equals(eobject)) {
- nbVisibleCompartment++;
- }
+ @Override
+ public void notifyChanged(Notification notification) {
+
+ final int eventType = notification.getEventType();
+
+ if (eventType == StereotypeExtensionNotification.STEREOTYPE_APPLIED_TO_ELEMENT) {
+ super.notifyChanged(notification);
+
+ getDiagramEventBroker().addNotificationListener((EObject) notification.getNewValue(), this);
+ createAppliedStereotypeCompartmentComment((EObject) notification.getNewValue());
+
+
+ } else if (eventType == StereotypeExtensionNotification.STEREOTYPE_UNAPPLIED_FROM_ELEMENT) {
+ // super.notifyChanged(notification);
+ getDiagramEventBroker().removeNotificationListener((EObject) notification.getOldValue(), this);
+ removeAppliedStereotypeCompartmentComment((EObject) notification.getOldValue());
+
+
+
}
- return nbVisibleCompartment;
+
}
/**
- * this method is use to copy all eAnnotation from the view to the comment in order to display properties of stereotype
+ * @return the stereotypeCommentMap
*/
- protected void delegateEAnnotationInCommentShape() {
- final Node appliedStereotypeComment = getAppliedStereotypeCommentNode();
-
- if (appliedStereotypeComment != null) {
- View originView = getView();
- final EAnnotation stereotypeAnnotation = originView.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
-
- final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(originView);
- final RecordingCommand cmd = new RecordingCommand(domain, "EannotationDelegation") {
-
- @Override
- protected void doExecute() {
- EAnnotation stereotypeAnnotationCopy = EcoreUtil.copy(stereotypeAnnotation);
- appliedStereotypeComment.getEAnnotations().clear();
- appliedStereotypeComment.getEAnnotations().add(stereotypeAnnotationCopy);
- RecordingCommand cmd = AppliedStereotypeHelper.getSetAppliedStereotypePropertiesLocalizationCommand(domain, appliedStereotypeComment, UMLVisualInformationPapyrusConstant.STEREOTYPE_COMPARTMENT_LOCATION);
- cmd.execute();
- String presentationKind = AppliedStereotypeHelper.getAppliedStereotypePresentationKind(getView());
- cmd = AppliedStereotypeHelper.getRemoveAppliedStereotypeCommand(domain, appliedStereotypeComment, AppliedStereotypeHelper.getStereotypesToDisplay(appliedStereotypeComment), presentationKind);
- cmd.execute();
- }
- };
+ public Map<EObject, BasicCompartment> getStereotypeCommentMap() {
+ return stereotypeCommentMap;
+ }
- Display.getCurrent().syncExec(new Runnable() {
- public void run() {
- // use to avoid to put it in the command stack
- try {
- GMFUnsafe.write(domain, cmd);
- } catch (Exception e) {
- Activator.log.error(e);
+ /**
+ * This method creates a node for the compartment of stereotype if it does not exist.
+ *
+ * @param stereotypeApplication
+ * the stereotype application
+ */
+ protected void createAppliedStereotypeCompartmentComment(final EObject stereotypeApplication) {
+
+ Node compartment = helper.getStereotypeCompartment(node, stereotypeApplication);
+ if (compartment != null) {
+ // If the node should be displayed in a Compartment or Brace Comment then create the Comment and its content
+ if (!helper.isEmpty(compartment, StereotypeLocationEnum.IN_COMMENT_BRACE)
+ || (!helper.isEmpty(compartment, StereotypeLocationEnum.IN_COMMENT_COMPARTMENT))) {
+
+ if (helper.getStereotypeComment(node) == null) {
+ // if Comment doesn't exist => Create it and copy the structure from the host
+
+ if (getHost() instanceof ConnectionEditPart) {
+ executeAppliedStereotypeCommentCreation(((ConnectionEditPart) getHost()).resolveSemanticElement());
+ }
+ if (getHost() instanceof GraphicalEditPart) {
+ executeAppliedStereotypeCommentCreation(((GraphicalEditPart) getHost()).resolveSemanticElement());
}
+
}
- });
+
+ executeAppliedStereotypeCommentContent(compartment, stereotypeApplication);
+ }
}
}
/**
- * return the comment nodes that represent stereotype properties
- *
- * @return may be null if nothing is founded
+ * Remove the Compartment into the Comment associated to the stereotypeApplication
+ *
+ * @param stereotypeApplication
+ * the stereotypeApplication associated to the compartment to be deleted
*/
- protected Node getAppliedStereotypeCommentNode() {
- View SemanticView = (View) getHost().getModel();
-
- Edge appliedStereotypeLink = null;
- // look for all links with the id AppliedStereotypesCommentLinkEditPart.ID
- @SuppressWarnings("unchecked")
- Iterator<Edge> edgeIterator = SemanticView.getSourceEdges().iterator();
- while (edgeIterator.hasNext()) {
- Edge edge = edgeIterator.next();
- if (edge.getType().equals(AppliedStereotypesCommentLinkEditPart.ID)) {
- appliedStereotypeLink = edge;
- }
-
+ protected void removeAppliedStereotypeCompartmentComment(EObject stereotypeApplication) {
+ // Remove the Label node
+ BasicCompartment compartment = getStereotypeCommentMap().get(stereotypeApplication);
+ if ((compartment != null) && (TransactionUtil.getEditingDomain(compartment) != null)) {
+ executeAppliedStereotypeCompartmentRemove(hostEditPart, compartment);
+ // Delete entry from the Map
+ deleteInCommentMap(stereotypeApplication);
}
- if (appliedStereotypeLink == null) {
- return null;
+ }
+
+ /**
+ * Add the compartment into the Comment Edit Part
+ *
+ * @param stereotypeApplication
+ * The Stereotype Application associated to the new Compartment
+ */
+ protected void executeAppliedStereotypeCommentContent(Node compartment, EObject stereotypeApplication) {
+ comment = helper.getStereotypeComment(node);
+ if (comment != null) {
+ executeAppliedStereotypeCommentContentCreationCommand(compartment);
+
+ // Store entry in the Map
+ storeInCommentMap(stereotypeApplication, comment);
}
- return (Node) appliedStereotypeLink.getTarget();
+ }
+
+ /**
+ * Create the Comment content based on the original model content
+ *
+ * @param compartment
+ * The original compartment on which is based the Comment compartment to be added into the Comment model
+ */
+ protected void executeAppliedStereotypeCommentContentCreationCommand(Node compartment) {
+ final RecordingCommand cmd = new CreateAppliedStereotypeCommentContentCommand("Applied Stereotype Delegation", comment, hostEditPart, compartment);
+ final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(getView());
+ Display.getCurrent().syncExec(new Runnable() {
+ public void run() {
+ // use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(domain, cmd);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+ });
}
/**
- * the goal of this method is to execute the a command to create a notation node for applied stereotype
- * as "Comment" shape
+ * The goal of this method is to execute the a command to create a notation node for applied stereotype
+ * as "Comment" shape.
*
- * @param editPart
- * the semantic Editpart
* @param appliedstereotype
* the stereotype application
*/
- protected void executeAppliedStereotypeCommentCreation(final EditPart editPart, final TransactionalEditingDomain domain, final EObject semanticElement) {
+ protected void executeAppliedStereotypeCommentCreation(final EObject node) {
+
+ final TransactionalEditingDomain domain = hostEditPart.getEditingDomain();
Display.getCurrent().syncExec(new Runnable() {
public void run() {
int x = 200;
int y = 100;
- if (editPart.getModel() instanceof Node) {
- LayoutConstraint constraint = ((Node) editPart.getModel()).getLayoutConstraint();
+ if (hostEditPart.getModel() instanceof Node) {
+ LayoutConstraint constraint = ((Node) hostEditPart.getModel()).getLayoutConstraint();
if (constraint instanceof Bounds) {
x = x + ((Bounds) constraint).getX();
y = ((Bounds) constraint).getY();
}
}
- if (editPart.getModel() instanceof Edge && ((((Edge) editPart.getModel()).getSource()) instanceof Node)) {
+ if (hostEditPart.getModel() instanceof Edge && ((((Edge) hostEditPart.getModel()).getSource()) instanceof Node)) {
- LayoutConstraint constraint = ((Node) ((Edge) editPart.getModel()).getSource()).getLayoutConstraint();
+ LayoutConstraint constraint = ((Node) ((Edge) hostEditPart.getModel()).getSource()).getLayoutConstraint();
if (constraint instanceof Bounds) {
x = x + ((Bounds) constraint).getX();
y = ((Bounds) constraint).getY() - 100;
@@ -221,11 +249,11 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
}
boolean isBorderElement = false;
- if (editPart instanceof BorderedBorderItemEditPart) {
+ if (hostEditPart instanceof BorderedBorderItemEditPart) {
isBorderElement = true;
}
- if (getAppliedStereotypeCommentNode() == null) {
- CreateAppliedStereotypeCommentViewCommand command = new CreateAppliedStereotypeCommentViewCommand(domain, (View) editPart.getModel(), x, y, semanticElement, isBorderElement);
+ if (helper.getStereotypeComment((View) getHost().getModel()) == null) {
+ CreateAppliedStereotypeCommentViewCommand command = new CreateAppliedStereotypeCommentViewCommand(domain, (View) hostEditPart.getModel(), x, y, node, isBorderElement);
// use to avoid to put it in the command stack
try {
GMFUnsafe.write(domain, command);
@@ -239,7 +267,7 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
}
/**
- * method in oder to delete the comment
+ * In Charge to delete the Comment Node.
*
* @param domain
* the transactional editing domain
@@ -251,7 +279,7 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
Display.getCurrent().syncExec(new Runnable() {
public void run() {
- // because it is asynchrone the comment node maybe become s null
+ // because it is asynchrony the comment node maybe become s null
if (commentNode != null && TransactionUtil.getEditingDomain(commentNode) != null) {
DeleteCommand command = new DeleteCommand(commentNode);
// use to avoid to put it in the command stack
@@ -265,42 +293,123 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
});
}
+
+
/**
+ * This method has in charge to refresh the presence of the view that represent the comment
+ */
+ protected void updateAppliedStereotypeCommentShape() {
+
+
+ // look for the AppliedStereotypesCommentEditPart
+ Node commentNode = helper.getStereotypeComment(node);
+
+ if (helper.hasStereotypeCompartment(node)) {
+
+ // if Comment doesn't exist => Create it and copy the structure from the host
+ if (commentNode == null) {
+
+ if (getHost() instanceof ConnectionEditPart) {
+ executeAppliedStereotypeCommentCreation(((ConnectionEditPart) getHost()).resolveSemanticElement());
+ }
+ if (getHost() instanceof GraphicalEditPart) {
+ executeAppliedStereotypeCommentCreation(((GraphicalEditPart) getHost()).resolveSemanticElement());
+ }
+ }
+
+ } else {
+ // If the host doesn't have compartment remove the Comment if any
+ if (commentNode != null) {
+ final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(commentNode);
+ executeAppliedStereotypeCommentDeletion(domain, commentNode);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy#refreshStereotypeDisplay()
*
- * {@inheritedDoc}
*/
@Override
- public void notifyChanged(Notification notification) {
- // change the label of the figure managed by the host edit part (managed
- // by the parent edit
- // part in general...)
- // it must be changed only if:
- // - the annotation corresponding to the display of the stereotype
- // changes
- // - the stereotype application list has changed
- final int eventType = notification.getEventType();
- if (eventType == StereotypeExtensionNotification.STEREOTYPE_APPLIED_TO_ELEMENT) {
- // a stereotype was applied to the notifier
- // then a new listener should be added to the stereotype application
- getDiagramEventBroker().addNotificationListener((EObject) notification.getNewValue(), this);
- // TODO To be deleted when Bug 455311 fixed: Commented to put the SterotypeDisplay by NamedStyle
- // createAppliedStereotypeCompartment((EObject)notification.getNewValue());
- } else if (eventType == StereotypeExtensionNotification.STEREOTYPE_UNAPPLIED_FROM_ELEMENT) {
- getDiagramEventBroker().removeNotificationListener((EObject) notification.getOldValue(), this);
- cleanStereotypeDisplayInEAnnotation();
- updateAppliedStereotypeCommentShape();
+ protected void refreshStereotypeDisplay() {
+ refreshComment();
+ }
+
+ /**
+ * Refresh The Comment Figure. Delete if empty.
+ */
+ protected void refreshComment() {
+
+ // Refresh to create Comment if CSS Change
+ if (node != null) {
+ if (node.getElement() instanceof Element) {
+ Element elt = (Element) node.getElement();
+ EList<EObject> appliedStereotypes = elt.getStereotypeApplications();
+ for (EObject obj : appliedStereotypes) {
+ getDiagramEventBroker().addNotificationListener(obj, this);
+ createAppliedStereotypeCompartmentComment(obj);
+ }
+ }
}
+ // Delete Comment if empty
+ comment = helper.getStereotypeComment(node);
+ if (comment != null) {
+ if (helper.isCommentEmpty(comment)) {
+ // Delete the Comment Node
+ executeAppliedStereotypeCommentDeletion(hostEditPart.getEditingDomain(), comment);
+ }
+ }
+
+
}
/**
- * {@inheritDoc}
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy#storeInMap(org.eclipse.emf.ecore.EObject, org.eclipse.gmf.runtime.notation.View)
+ *
+ * @param stereotypeApplication
+ * The Application Of the stereotype to be stored
+ * @param node
+ * the Comment Node which contains the Applied Stereotype Compartments
*/
- @Override
- public void refreshDisplay() {
- // do nothing
- // refreshStereotypeDisplay();
+
+ protected void storeInCommentMap(EObject stereotypeApplication, View node) {
+
+ if (stereotypeApplication != null && node != null) {
+ BasicCompartment compartment = helper.getStereotypeCompartment(node, stereotypeApplication);
+ getStereotypeCommentMap().put(stereotypeApplication, compartment);
+
+
+ }
+
}
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy#deleteInMap(org.eclipse.emf.ecore.EObject)
+ *
+ * @param stereotypeApplication
+ */
+
+ protected void deleteInCommentMap(EObject stereotypeApplication) {
+ getStereotypeCommentMap().remove(stereotypeApplication);
+ }
+
+ /**
+ * Get the Node (notation) corresponding to the Host editpart
+ */
+ protected Node getNotationNode() {
+ Node node = null;
+
+ if (hostEditPart != null) {
+ View view = hostEditPart.getNotationView();
+ if (view instanceof Node) {
+ node = (Node) view;
+ }
+ }
+ return node;
+ }
+
+
+
}
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 06681777577..aca154fd354 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
@@ -16,438 +16,108 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies;
-import java.util.Iterator;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.BasicCompartment;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
-import org.eclipse.papyrus.uml.diagram.stereotype.edition.command.CreateAppliedStereotypePropertyViewCommand;
-import org.eclipse.papyrus.uml.diagram.stereotype.edition.command.CreateAppliedStereotypeViewCommand;
-import org.eclipse.papyrus.uml.diagram.stereotype.edition.command.CreateStereotypeLabelCommand;
-import org.eclipse.papyrus.uml.tools.listeners.StereotypeElementListener.StereotypeExtensionNotification;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Extension;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.util.UMLUtil;
/**
* this edit policy can be apply only on {@link IPapyrusEditPart} in order to
* access to primary figure. the primary figure has to be a {@link IPapyrusNodeUMLElementFigure}
+ *
*/
-public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNodeLabelDisplayEditPolicy {
- private GraphicalEditPart editPart;
+public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNodeLabelDisplayEditPolicy {
+ /** constant for this edit policy role */
+ public final static String STEREOTYPE_LABEL_POLICY = "AppliedStereotypeCompartmentEditPolicy"; //$NON-NLS-1$
/**
* Creates a new AppliedStereotype display edit policy
*/
public AppliedStereotypeCompartmentEditPolicy() {
super();
-
- }
-
- @Override
- public void activate() {
- super.activate();
- if (getHost() instanceof GraphicalEditPart) {
- editPart = (GraphicalEditPart) getHost();
- }
- // if stereotype has been applied, compartment has to be created
- Element umlElement = getUMLElement();
- // umlElement may be null if the semantic element has been deleted and the view hasn't been cleaned
- if (umlElement != null) {
- Iterator<EObject> iterator = umlElement.getStereotypeApplications().iterator();
- while (iterator.hasNext()) {
- final EObject appliedstereotype = iterator.next();
- createAppliedStereotypeLabel(appliedstereotype);
- }
- }
}
/**
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy#refreshStereotypeDisplay()
*
- * {@inheritedDoc}
*/
@Override
- public void notifyChanged(Notification notification) {
- // change the label of the figure managed by the host edit part (managed
- // by the parent edit part in general...)
- // it must be changed only if:
- // - the annotation corresponding to the display of the stereotype
- // changes
- // - the stereotype application list has changed
- final int eventType = notification.getEventType();
-
- if (eventType == StereotypeExtensionNotification.STEREOTYPE_APPLIED_TO_ELEMENT) {
- // a stereotype was applied to the notifier
- // then a new listener should be added to the stereotype application
-
- getDiagramEventBroker().addNotificationListener((EObject) notification.getNewValue(), this);
-
- createAppliedStereotypeLabel((EObject) notification.getNewValue());
- createAppliedStereotypeCompartment((EObject) notification.getNewValue());
- createAppliedStereotypeProperty((EObject) notification.getNewValue());
-
- // Store entry in the Map
- storeInMap((EObject) notification.getNewValue(), ((GraphicalEditPart) getHost()).getNotationView());
-
-
- } else if (eventType == StereotypeExtensionNotification.STEREOTYPE_UNAPPLIED_FROM_ELEMENT) {
- getDiagramEventBroker().removeNotificationListener((EObject) notification.getOldValue(), this);
-
- removeAppliedStereotypeLabel((EObject) notification.getOldValue());
- removeAppliedStereotypeCompartment((EObject) notification.getOldValue());
-
- // delete entry in the Map
- deleteInMap((EObject) notification.getOldValue());
-
+ protected void refreshStereotypeDisplay() {
+ if (getHost() instanceof IPapyrusEditPart) {
+ IFigure figure = ((IPapyrusEditPart) getHost()).getPrimaryShape();
+ // Refresh Properties in braces
+ refreshAppliedStereotypesPropertiesInBrace((IPapyrusNodeUMLElementFigure) figure);
}
-
}
- /**
- * the goal of this method is to execute the a command to create a notation node for a compartment of stereotype
- *
- * @param editPart
- * the editPart owner of the new compartment
- * @param appliedstereotype
- * the stereotype application
- */
- protected void executeAppliedStereotypeCompartmentCreation(final GraphicalEditPart editPart, final EObject stereotypeApplication) {
- try {
- editPart.getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- public void run() {
- CreateAppliedStereotypeViewCommand command = new CreateAppliedStereotypeViewCommand(editPart.getEditingDomain(), editPart.getNotationView(), stereotypeApplication);
-
- // use to avoid to put it in the command stack
- try {
- GMFUnsafe.write(editPart.getEditingDomain(), command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
-
- }
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
-
- /**
- * The goal of this method is to execute the a command to create a notation node for a stereotype Label.
- *
- * @param editPart
- * the editPart owner of the new compartment
- * @param appliedstereotype
- * the stereotype application
- */
- protected void executeStereotypeLabelCreation(final GraphicalEditPart editPart, final EObject appliedstereotype, final boolean isVisible) {
- try {
- editPart.getEditingDomain().runExclusive(new Runnable() {
- public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- public void run() {
-
- CreateStereotypeLabelCommand command = new CreateStereotypeLabelCommand(editPart.getEditingDomain(), editPart.getNotationView(), appliedstereotype, isVisible);
- // use to avoid to put it in the command stack
- try {
- GMFUnsafe.write(editPart.getEditingDomain(), command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
-
- }
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
-
- /**
- * this method is used to create a notation node for the property of the stereotype
- *
- * @param editPart
- * the editPart container
- * @param compartment
- * @param stereotypeApplication
- * @param stereotype
- * the stereotype associated to compartment node
- */
- protected void executeAppliedStereotypePropertyViewCreation(final GraphicalEditPart editPart, final Node compartment, final Property stereotypeProperty, final EObject stereotypeApplication) {
- try {
- editPart.getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- public void run() {
-
- // use to avoid to put it in the command stack
- CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(editPart.getEditingDomain(), compartment, stereotypeProperty);
- try {
- GMFUnsafe.write(editPart.getEditingDomain(), command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
- }
- });
-
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
-
-
- /**
- * Execute the command to remove the Stereotype.
- *
- * @param editPart
- * Edit Part on which the command is executed
- * @param label
- * DecorationNode of the Stereotype Label that has to be removed
- */
- protected void executeStereotypeLabelRemove(final GraphicalEditPart editPart, final View label) {
- try {
-
- editPart.getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- DeleteCommand command = new DeleteCommand(label);
- // use to avoid to put it in the command stack
- try {
- GMFUnsafe.write(editPart.getEditingDomain(), command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
-
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
/**
- * Execute the command to remove the Stereotype Compartment with Properties.
+ * Refreshes the stereotypes properties displayed above name of the element
+ * in this edit part.
*
- * @param editPart
- * Edit Part on which the command is executed
- * @param label
- * DecorationNode of the Stereotype Label that has to be removed
+ * @param stereotypesPropertiesToDisplay
*/
- protected void executeStereotypeCompartmentRemove(final GraphicalEditPart editPart, final View compartment) {
- try {
-
- editPart.getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- DeleteCommand command = new DeleteCommand(compartment);
- // use to avoid to put it in the command stack
- try {
- GMFUnsafe.write(editPart.getEditingDomain(), command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
-
- } catch (Exception e) {
- Activator.log.error(e);
+ protected void refreshAppliedStereotypesPropertiesInBrace(IPapyrusNodeUMLElementFigure figure) {
+ String toDisplayInBrace = helper.getStereotypePropertiesInBrace(((GraphicalEditPart) getHost()).getNotationView());
+ // if the string is not empty, then, the figure has to display it. Else,
+ // it displays nothing
+ if (!"".equals(toDisplayInBrace)) {
+ // it has to be displayed in braces, so compute the string to
+ // display
+ figure.setStereotypePropertiesInBrace(toDisplayInBrace);
+ } else {
+ figure.setStereotypePropertiesInBrace(null);
}
}
/**
- * This method creates a node for the compartment of stereotype if it does not exist.
+ * Returns the uml element controlled by the host edit part
*
- * @param stereotypeApplication
- * the stereotype application
+ * @return the uml element controlled by the host edit part
*/
- protected void createAppliedStereotypeLabel(final EObject stereotypeApplication) {
+ @Override
+ protected Element getUMLElement() {
+ Element element = null;
- IFigure figure;
- if (editPart instanceof IPapyrusEditPart) {
- figure = ((IPapyrusEditPart) editPart).getPrimaryShape();
- final View node = editPart.getNotationView();
- // create only if the Label doesn't exist yet
- if (!StereotypeDisplayHelper.isLabelExist(node, stereotypeApplication)) {
- // Create the Decoration Node
- executeStereotypeLabelCreation(editPart, stereotypeApplication, StereotypeDisplayUtils.DEFAULT_VISIBILITY_VALUE);
- // Update the Figure accordingly
- updateLabelText(figure, node);
+ View view = getView();
+ if (view != null) {
+ EObject container = view.eContainer();
+ if (container instanceof View) {
+ element = (Element) ((View) container).getElement();
}
}
+ return element;
}
-
/**
- * This method creates a node for the compartment of stereotype if it does not exist.
*
- * @param stereotypeApplication
- * the stereotype application
- */
- protected void createAppliedStereotypeCompartment(final EObject stereotypeApplication) {
- final View node = editPart.getNotationView();
- // doesn't exist already
- if (!StereotypeDisplayHelper.isCompartmentExist(node, stereotypeApplication)) {
- // Create Compartment
- executeAppliedStereotypeCompartmentCreation(editPart, stereotypeApplication);
- }
- }
-
-
- /**
- * In charge of property view creation
- *
- * @param eObject
- * The Edit Part of which the Properties should be created
- */
- protected void createAppliedStereotypeProperty(EObject stereotypeApplication) {
-
- Node compartment = StereotypeDisplayHelper.getStereotypeCompartment(editPart.getNotationView(), stereotypeApplication);
- if (compartment != null) {
- Stereotype stereotype = UMLUtil.getStereotype(stereotypeApplication);
- if (stereotype != null) {
- EList<Property> properties = stereotype.allAttributes();
- for (Property property : properties) {
- // if stereotype is null all property of stereotype has to be removed!
- if (property != null && !property.getName().startsWith(Extension.METACLASS_ROLE_PREFIX)) {
- // go through each stereotype property
- executeAppliedStereotypePropertyViewCreation(editPart, compartment, property, stereotypeApplication);
-
- }
- }
- }
- }
- }
-
-
- /**
- * this method suppress the sub-nodes that references the stereotype application
- * it cleans also all sub-nodes with the type ApplicationStereotype that not references an application of stereotypes
- * (this is the case when a stereotype has been unapplied without suppress the compartment.
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractAppliedStereotypeDisplayEditPolicy#getView()
*
- * @param stereotypeApplication
+ * @return
*/
- protected void removeAppliedStereotypeCompartment(final EObject stereotypeApplication) {
-
- GraphicalEditPart editPart = (GraphicalEditPart) getHost();
-
- // Remove the Label node
- BasicCompartment compartment = stereotypePropertyMap.get(stereotypeApplication);
- executeStereotypeCompartmentRemove(editPart, compartment);
-
- }
-
-
-
- /**
- * Remove the StereotypeLabel from an element from it's stereotype application.
- *
- * @param stereotypeApplication
- * Associated Stereotype application to remove
- */
- protected void removeAppliedStereotypeLabel(EObject stereotypeApplication) {
- if (stereotypeApplication == null) {
- return;
- }
-
- if (getHost() instanceof GraphicalEditPart) {
-
- final GraphicalEditPart editPart = (GraphicalEditPart) getHost();
- final View node = editPart.getNotationView();
+ @Override
+ protected View getView() {
+ View view = null;
- // Remove the Label node
- DecorationNode label = stereotypeMap.get(stereotypeApplication);
- executeStereotypeLabelRemove(editPart, label);
+ Object model = getHost().getModel();
+ if (model instanceof View) {
- // Update the Label displayed accordingly
- if (editPart instanceof IPapyrusEditPart) {
- IFigure figure = ((IPapyrusEditPart) editPart).getPrimaryShape();
- updateLabelText(figure, node);
+ EObject container = ((View) model).eContainer();
+ if (container instanceof View) {
+ view = (View) container;
}
}
+ return view;
}
- /**
- * Remove the stereotype entry from the Map
- *
- * @param stereotypeApplication
- * The Stereotype Application reference to delete
- */
- protected void deleteInMap(EObject stereotypeApplication) {
- stereotypeMap.remove(stereotypeApplication);
- stereotypePropertyMap.remove(stereotypeApplication);
- }
-
- /**
- * Store the entry (stereotypeApplication, StereotypeLabel)
- *
- * @param stereotypeApplication
- * The Stereotype Application instance to store
- * @param node
- * The parent view (i.e: CSSShapeImpl)
- */
- protected void storeInMap(EObject stereotypeApplication, View node) {
-
- // String stereoQN = UMLUtil.getStereotype(stereotypeApplication).getQualifiedName();
- if (stereotypeApplication != null && node != null) {
-
- DecorationNode label = StereotypeDisplayHelper.getStereotypeLabel(node, stereotypeApplication);
- stereotypeMap.put(stereotypeApplication, label);
-
- BasicCompartment compartment = StereotypeDisplayHelper.getStereotypeCompartment(node, stereotypeApplication);
- stereotypePropertyMap.put(stereotypeApplication, compartment);
- }
- }
-
- /**
- * Method to set the Figure Label with the new modification.
- *
- * @param figure
- * Figure on which the update has to be done
- * @param node
- * Node view of the element required to retrieve the stereotype label
- *
- */
- protected void updateLabelText(IFigure figure, View node) {
- // Update Figure Label
- if (figure instanceof NodeNamedElementFigure) {
-
- String textToDisplay = StereotypeDisplayHelper.getStereotypeTextToDisplay(node);
- ((NodeNamedElementFigure) figure).setStereotypes(textToDisplay);
- }
- }
}
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 b62165b9b75..9e2c0ad84ed 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
@@ -9,13 +9,17 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 460356 : Refactor Stereotype Display
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.EObjectValueStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
import org.eclipse.uml2.uml.Element;
@@ -38,10 +42,31 @@ public class AppliedStereotypeCompartmentForCommentShapeEditPolicy extends Appli
if ((Element) getView().getElement() != null) {
return (Element) getView().getElement();
}
- if (getView().getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), "BASE_ELEMENT") != null) {
- EObjectValueStyle eObjectValueStyle = (EObjectValueStyle) getView().getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), "BASE_ELEMENT");
+ if (getView().getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME) != null) {
+ EObjectValueStyle eObjectValueStyle = (EObjectValueStyle) getView().getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME);
return (Element) eObjectValueStyle.getEObjectValue();
}
return null;
}
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCompartmentEditPolicy#refreshAppliedStereotypesPropertiesInBrace(org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure)
+ *
+ * @param figure
+ */
+ @Override
+ protected void refreshAppliedStereotypesPropertiesInBrace(IPapyrusNodeUMLElementFigure figure) {
+
+ String toDisplayInBrace = helper.getStereotypePropertiesInBrace(((GraphicalEditPart) getHost()).getNotationView());
+ // if the string is not empty, then, the figure has to display it. Else,
+ // it displays nothing
+ if (!"".equals(toDisplayInBrace)) {
+ // it has to be displayed in braces, so compute the string to
+ // display
+ figure.setStereotypePropertiesInBrace(toDisplayInBrace);
+ } else {
+ figure.setStereotypePropertiesInBrace(null);
+ }
+
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeLabelEditPolicy.java
new file mode 100644
index 00000000000..ac73c609ed4
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeLabelEditPolicy.java
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 460356 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Céline JANSSENS
+ * This Policy is in charge of create and delete the applied Stereotype Label Node into the Notation model
+ */
+public class AppliedStereotypeLabelEditPolicy extends AppliedStereotypeNodeLabelDisplayEditPolicy {
+
+ /** constant for this edit policy role */
+ public final static String STEREOTYPE_LABEL_POLICY = "AppliedStereotypeLabelEditPolicy"; //$NON-NLS-1$
+
+ private GraphicalEditPart hostEditPart = null;
+
+ /**
+ * Creates a new AppliedStereotype display edit policy
+ */
+ public AppliedStereotypeLabelEditPolicy() {
+ super();
+
+ }
+
+
+ @Override
+ public void activate() {
+ super.activate();
+ if (getHost() instanceof GraphicalEditPart) {
+ hostEditPart = (GraphicalEditPart) getHost();
+ }
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy#refreshStereotypeDisplay()
+ *
+ */
+ @Override
+ protected void refreshStereotypeDisplay() {
+ refreshStereotypeLabelDisplay();
+
+
+ }
+
+ protected void refreshStereotypeLabelDisplay() {
+ if (getHost() instanceof IPapyrusEditPart) {
+ IFigure figure = ((IPapyrusEditPart) getHost()).getPrimaryShape();
+
+ // calculate text and icon to display
+ final String stereotypesToDisplay = helper.getStereotypeTextToDisplay((View) getHost().getModel());
+ // computes the icon to be displayed
+ final Image imageToDisplay = stereotypeIconToDisplay();
+
+ // if the string is not empty, then, the figure has to display it.
+ // Else, it displays nothing
+ if (figure instanceof IPapyrusNodeUMLElementFigure) {
+
+ // Refresh Stereotype Label
+ // Stereotype should be passed as "" if null, in order to avoid "null" string.
+ ((IPapyrusNodeUMLElementFigure) figure).setStereotypeDisplay(tag + (stereotypesToDisplay == null ? "" : stereotypesToDisplay), imageToDisplay);
+
+ // Refresh Stereotype Label
+ if (figure instanceof IPapyrusNodeNamedElementFigure) {
+ refreshAppliedStereotypesLabel((IPapyrusNodeUMLElementFigure) figure);
+ }
+ }
+ }
+
+ }
+
+
+ /**
+ * Refreshes the displayed stereotypes properties for this edit part.
+ */
+ protected void refreshAppliedStereotypesLabel(IPapyrusNodeUMLElementFigure figure) {
+ // If node has a Label
+ if (figure instanceof IPapyrusNodeNamedElementFigure) {
+
+ // Refresh Label
+ boolean displayStereotypes = NotationUtils.getBooleanValue(getView(), NamedElementEditPart.DISPLAY_STEREOTYPES, true);
+ if (!displayStereotypes) {
+ ((IPapyrusNodeNamedElementFigure) figure).removeStereotypeLabel();
+ } else {
+ ((IPapyrusNodeNamedElementFigure) figure).restoreStereotypeLabel();
+ }
+ }
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypePropertiesEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypePropertiesEditPolicy.java
index dfcde33fb8d..8f80ab528c5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypePropertiesEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypePropertiesEditPolicy.java
@@ -16,68 +16,14 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.uml2.uml.Element;
/**
* This editPolicy is used to add dynamically labels of stereotypes into nodes in the context of AppliedStereorypeCompartmentEditpart
+ *
+ * @deprecated. Use {@link AppliedStereotypeCompartmentEditPolicy} instead.
*/
public class AppliedStereotypePropertiesEditPolicy extends AppliedStereotypeNodeLabelDisplayEditPolicy {
- public static String APPLIED_STEREOTYPE_VISIBILITY_COMPARTMENT = "AppliedStereotypeVisibilityEditPolicy";
-
- /**
- * Creates a new AppliedStereotype display edit policy
- */
- public AppliedStereotypePropertiesEditPolicy() {
- super();
- }
-
- /**
- * Returns the uml element controlled by the host edit part
- *
- * @return the uml element controlled by the host edit part
- */
- @Override
- protected Element getUMLElement() {
- Element element = null;
-
- View view = getView();
- if (view != null) {
-
- EObject container = view.eContainer();
- if (container instanceof View) {
- element = (Element) ((View) container).getElement();
- }
- }
-
- return element;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractAppliedStereotypeDisplayEditPolicy#getView()
- *
- * @return
- */
- @Override
- protected View getView() {
- View view = null;
-
- Object model = getHost().getModel();
- if (model instanceof View) {
-
- EObject container = ((View) model).eContainer();
- if (container instanceof View) {
- view = (View) container;
- }
- }
- return view;
- }
-
-
}
-
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 58700ac0e0f..932cd380114 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,10 +23,10 @@ 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.gmfdiag.common.editpart.IPapyrusEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypeMultilinePropertyEditPart;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCommentCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeLabelEditPolicy;
import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
/**
@@ -51,7 +51,9 @@ public class CustomEditPolicyProvider extends AbstractProvider implements IEditP
}
if (editPart instanceof NamedElementEditPart) {
- editPart.installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeCompartmentEditPolicy());
+ editPart.installEditPolicy(AppliedStereotypeCompartmentEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeCompartmentEditPolicy());
+ editPart.installEditPolicy(AppliedStereotypeLabelEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLabelEditPolicy());
+
}
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypePropertiesEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypePropertiesEditPartProvider.java
index 68d685f59ff..eb3fe9c8d7f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypePropertiesEditPartProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypePropertiesEditPartProvider.java
@@ -27,7 +27,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.providers.RestrictedAbstractEdit
import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypeCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypeMultilinePropertyEditPart;
-import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypesCommentEditPart;
+import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypeCommentEditPart;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypesCommentLinkEditPart;
@@ -45,8 +45,8 @@ public class StereotypePropertiesEditPartProvider extends RestrictedAbstractEdit
nodeMap.put(StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_TYPE, AppliedStereotypeCompartmentEditPart.class);
nodeMap.put(StereotypeDisplayUtils.STEREOTYPE_PROPERTY_TYPE, AppliedStereotypeMultilinePropertyEditPart.class);
- nodeMap.put(AppliedStereotypesCommentEditPart.ID, AppliedStereotypesCommentEditPart.class);
- edgeMap.put(AppliedStereotypesCommentLinkEditPart.ID, AppliedStereotypesCommentLinkEditPart.class);
+ nodeMap.put(StereotypeDisplayUtils.STEREOTYPE_COMMENT_TYPE, AppliedStereotypeCommentEditPart.class);
+ edgeMap.put(StereotypeDisplayUtils.STEREOTYPE_COMMENT_LINK_TYPE, AppliedStereotypesCommentLinkEditPart.class);
}

Back to the top