Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2012-07-31 09:12:02 +0000
committerptessier2012-07-31 09:12:02 +0000
commitc4cba5b750c9c3676bc030ec4dbec4a73f2fab76 (patch)
tree7d9bb473fcc9cc9315a0822f148d3118c8895206 /plugins
parentabf9039f8c2acacc4e2790b7892869490c1f6d64 (diff)
downloadorg.eclipse.papyrus-c4cba5b750c9c3676bc030ec4dbec4a73f2fab76.tar.gz
org.eclipse.papyrus-c4cba5b750c9c3676bc030ec4dbec4a73f2fab76.tar.xz
org.eclipse.papyrus-c4cba5b750c9c3676bc030ec4dbec4a73f2fab76.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')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/providers/CustomEditPolicyProvider.java86
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/providers/StereotypePropertiesEditPartProvider.java94
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml29
3 files changed, 208 insertions, 1 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/providers/CustomEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/providers/CustomEditPolicyProvider.java
new file mode 100644
index 00000000000..3519594e781
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/providers/CustomEditPolicyProvider.java
@@ -0,0 +1,86 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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.statemachine.custom.providers;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+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;
+import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PackageEditPart;
+
+/**
+ * this is an editpolicy provider in charge to install a policy to navigate between diagrams and elements
+ *
+ */
+public class CustomEditPolicyProvider implements IEditPolicyProvider {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public void addProviderChangeListener(IProviderChangeListener listener) {
+
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public void createEditPolicies(EditPart editPart) {
+ editPart.installEditPolicy(NavigationEditPolicy.NAVIGATION_POLICY, new NavigationEditPolicy());
+ if( editPart instanceof IPrimaryEditPart){
+ editPart.installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new HyperLinkPopupBarEditPolicy());
+ }
+ if(editPart instanceof NamedElementEditPart ){
+ editPart.installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeCompartmentEditPolicy());
+ }
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public boolean provides(IOperation operation) {
+ CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation;
+ if(!(epOperation.getEditPart() instanceof GraphicalEditPart)) {
+ return false;
+ }
+ GraphicalEditPart gep = (GraphicalEditPart)epOperation.getEditPart();
+ String diagramType = gep.getNotationView().getDiagram().getType();
+ if(PackageEditPart.MODEL_ID.equals(diagramType)) {
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public void removeProviderChangeListener(IProviderChangeListener listener) {
+
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/providers/StereotypePropertiesEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/providers/StereotypePropertiesEditPartProvider.java
new file mode 100644
index 00000000000..bd1ba4e556d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/providers/StereotypePropertiesEditPartProvider.java
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * 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.statemachine.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;
+import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PackageEditPart;
+
+/**
+ * provides editpart to edit properties of applied stereotypes
+ *
+ */
+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 = PackageEditPart.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.statemachine/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
index 618ad7b4952..da13751559e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
@@ -1291,7 +1291,34 @@
id="org.eclipse.papyrus.SharedEditingDomainID">
</editingDomain>
</listener>
- </extension>
+ </extension>
+ <extension
+ id="stereotype-ep-provider"
+ point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
+ <editpartProvider
+ class="org.eclipse.papyrus.uml.diagram.statemachine.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>
+ <extension
+ point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders">
+ <editpolicyProvider
+ class="org.eclipse.papyrus.uml.diagram.statemachine.custom.providers.CustomEditPolicyProvider">
+ <Priority
+ name="Lowest">
+ </Priority>
+ </editpolicyProvider>
+ </extension>

Back to the top