Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2012-07-30 13:05:56 +0000
committerptessier2012-07-30 13:05:56 +0000
commitefdd2afc003b6ac44d9f0d0bd32927b82a095327 (patch)
tree18b39019742c59836d2224d0b07650d8340ebe9d /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication
parentfacdc43ebda6369a2c00a904cfb70ea6ed4caf42 (diff)
downloadorg.eclipse.papyrus-efdd2afc003b6ac44d9f0d0bd32927b82a095327.tar.gz
org.eclipse.papyrus-efdd2afc003b6ac44d9f0d0bd32927b82a095327.tar.xz
org.eclipse.papyrus-efdd2afc003b6ac44d9f0d0bd32927b82a095327.zip
330176: [All Diagrams] Papyrus shall enable to display stereotype properties in a dedicated compartment.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=330176
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/providers/CustomEditPolicyProvider.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/providers/StereotypePropertiesEditPartProvider.java93
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml18
3 files changed, 117 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/providers/CustomEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/providers/CustomEditPolicyProvider.java
index c7687fa5690..e144604f276 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/providers/CustomEditPolicyProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/providers/CustomEditPolicyProvider.java
@@ -21,6 +21,9 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.HyperLinkPopupBarEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.NavigationEditPolicy;
@@ -48,6 +51,9 @@ public class CustomEditPolicyProvider implements IEditPolicyProvider {
if( editPart instanceof IPrimaryEditPart){
editPart.installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new HyperLinkPopupBarEditPolicy());
}
+ if(editPart instanceof NamedElementEditPart ){
+ editPart.installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeCompartmentEditPolicy());
+ }
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/providers/StereotypePropertiesEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/providers/StereotypePropertiesEditPartProvider.java
new file mode 100644
index 00000000000..aaf1e3be7aa
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/providers/StereotypePropertiesEditPartProvider.java
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.communication.custom.providers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.providers.RestrictedAbstractEditPartProvider;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AppliedStereotypeConpartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AppliedStereotypeMultilinePropertyEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AppliedStereotypePropertyEditPart;
+
+/**
+ * This provider is used to edit stereotypes directly on diagram
+ *
+ */
+public class StereotypePropertiesEditPartProvider extends RestrictedAbstractEditPartProvider {
+
+ /** Map containing node view types supported by this provider */
+ protected Map<String, Class<?>> nodeMap = new HashMap<String, Class<?>>();
+
+ /** Map containing edge view types supported by this provider */
+ protected Map<String, Class<?>> edgeMap = new HashMap<String, Class<?>>();
+
+ /** Default constructor */
+ public StereotypePropertiesEditPartProvider() {
+ super();
+
+ diagramType =org.eclipse.papyrus.uml.diagram.communication.edit.parts.ModelEditPart.MODEL_ID;
+
+
+ nodeMap.put(AppliedStereotypeConpartmentEditPart.ID, AppliedStereotypeConpartmentEditPart.class);
+ nodeMap.put(AppliedStereotypePropertyEditPart.ID, AppliedStereotypeMultilinePropertyEditPart.class);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean provides(IOperation operation) {
+ if(operation instanceof CreateGraphicEditPartOperation) {
+ View newView = ((IEditPartOperation)operation).getView();
+ if(newView == null) {
+ return false;
+ }
+
+ String graphicalType = newView.getType();
+
+ if((newView instanceof Node) && (!nodeMap.containsKey(graphicalType))) {
+ return false;
+ }
+
+ if((newView instanceof Edge) && (!edgeMap.containsKey(graphicalType))) {
+ return false;
+ }
+ }
+
+ return super.provides(operation);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<?> getNodeEditPartClass(View view) {
+ return nodeMap.get(view.getType());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<?> getEdgeEditPartClass(View view) {
+ return edgeMap.get(view.getType());
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml
index 330606393ea..515284246bc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml
@@ -851,6 +851,24 @@
</Priority>
</editpolicyProvider>
</extension>
+<extension
+ id="stereotype-ep-provider"
+ point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
+ <editpartProvider
+ class="org.eclipse.papyrus.uml.diagram.communication.custom.providers.StereotypePropertiesEditPartProvider">
+ <Priority
+ name="Medium">
+ </Priority>
+ <object
+ class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)"
+ id="org.eclipse.papyrus.uml.diagram.clazz.editpart.AppliedStereotypeContainer">
+ <method
+ name="getType()"
+ value="AppliedStereotypeContainer,AppliedStereotypeProperty">
+ </method>
+ </object>
+ </editpartProvider>
+</extension>

Back to the top