Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFanch BONNABESSE2016-05-27 12:06:56 +0000
committerGerrit Code Review @ Eclipse.org2016-05-31 14:28:58 +0000
commit78884f12fcdc10c36624896677378a2448a2ec32 (patch)
tree2ff4cb70cfe916db0b39f305e8dfb6fabe34e56c /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition
parent29c537c3c5327e2dcb8ed1c763bcb3b60acb2adb (diff)
downloadorg.eclipse.papyrus-78884f12fcdc10c36624896677378a2448a2ec32.tar.gz
org.eclipse.papyrus-78884f12fcdc10c36624896677378a2448a2ec32.tar.xz
org.eclipse.papyrus-78884f12fcdc10c36624896677378a2448a2ec32.zip
Bug 493420: StereotypeEAnnotationMigrationEditPolicy should be
replaced/subsumed by a proper DiagramReconcilier https://bugs.eclipse.org/bugs/show_bug.cgi?id=493420 Cherry Pick Mars to Neon. Change-Id: Id9ba0ff917690282ee928ff972b97956314d1b05 Signed-off-by: Fanch BONNABESSE <fanch.bonnabesse@all4tec.net> Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml78
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java220
2 files changed, 148 insertions, 150 deletions
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 4eeaf1f1345..6230fb968ea 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
@@ -1,42 +1,36 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-<extension
- point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders">
- <editpolicyProvider
- class="org.eclipse.papyrus.uml.diagram.stereotype.edition.provider.CustomEditPolicyProvider">
- <Priority
- name="Low">
- </Priority>
- </editpolicyProvider>
- <editpolicyProvider
- class="org.eclipse.papyrus.uml.diagram.stereotype.edition.provider.StereotypeDisplayMigrationEditPolicyProvider">
- <Priority
- name="Medium">
- </Priority>
- </editpolicyProvider>
-</extension>
-<extension
- id="stereotype-ep-provider"
- point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
- <editpartProvider
- class="org.eclipse.papyrus.uml.diagram.stereotype.edition.provider.StereotypePropertiesEditPartProvider">
- <Priority name="Medium"/>
-
- <object
- class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)"
- id="StereotypePropertiesEditPartProvider">
- <method name="getType()" value="StereotypePropertyBrace, StereotypeBrace, StereotypeLabel, StereotypeComment,StereotypeCompartment,StereotypeProperty,StereotypeCommentLink"/>
- </object>
- </editpartProvider>
- </extension>
-
- <extension
- point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration">
- <elementTypeSet
- clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext"
- path="model/stereotype-edit.elementtypesconfigurations">
- </elementTypeSet>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+<extension
+ point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders">
+ <editpolicyProvider
+ class="org.eclipse.papyrus.uml.diagram.stereotype.edition.provider.CustomEditPolicyProvider">
+ <Priority
+ name="Low">
+ </Priority>
+ </editpolicyProvider>
+</extension>
+<extension
+ id="stereotype-ep-provider"
+ point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
+ <editpartProvider
+ class="org.eclipse.papyrus.uml.diagram.stereotype.edition.provider.StereotypePropertiesEditPartProvider">
+ <Priority name="Medium"/>
+
+ <object
+ class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)"
+ id="StereotypePropertiesEditPartProvider">
+ <method name="getType()" value="StereotypePropertyBrace, StereotypeBrace, StereotypeLabel, StereotypeComment,StereotypeCompartment,StereotypeProperty,StereotypeCommentLink"/>
+ </object>
+ </editpartProvider>
+ </extension>
+
+ <extension
+ point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration">
+ <elementTypeSet
+ clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext"
+ path="model/stereotype-edit.elementtypesconfigurations">
+ </elementTypeSet>
+ </extension>
+
+</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java
index fa65009a838..cb8b8aba4fc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java
@@ -1,108 +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:
- * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
- * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.stereotype.edition.provider;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeMigrationHelper;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationLabelMigrationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationNestedMigrationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationPropertiesMigrationEditPolicy;
-import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
-
-/**
- * @author Céline JANSSENS
- *
- */
-public class StereotypeDisplayMigrationEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
-
-
-
- /**
- * @see org.eclipse.gmf.runtime.common.core.service.IProvider#provides(org.eclipse.gmf.runtime.common.core.service.IOperation)
- *
- */
- public boolean provides(IOperation operation) {
- CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
- if (!(epOperation.getEditPart() instanceof GraphicalEditPart) && !(epOperation.getEditPart() instanceof ConnectionEditPart)) {
- return false;
- }
-
- EditPart gep = epOperation.getEditPart();
-
- // Only the EditPart with an Stereotype EAnnotation into its View.
- try {
- if (ServiceUtilsForEditPart.getInstance().getServiceRegistry(gep) != null) {
- if (gep.getModel() instanceof View) {
- if (StereotypeMigrationHelper.getInstance().hasStereotypeEAnnotation((View) gep.getModel())) {
- if (UMLUtil.resolveUMLElement(gep) != null) {
- return true;
- }
- }
- }
- }
- } catch (ServiceException e) {
- return false;
- }
-
- return false;
-
-
- }
-
-
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider#createEditPolicies(org.eclipse.gef.EditPart)
- *
- */
- public void createEditPolicies(EditPart editPart) {
-
-
- if (editPart.getModel() instanceof View) {
- if (StereotypeMigrationHelper.getInstance().hasStereotypeEAnnotation((View) editPart.getModel())) {
-
- // Main policy for Stereotype Label Migration
-
- if (UMLUtil.resolveUMLElement(editPart) != null) {
- editPart.installEditPolicy(StereotypeEAnnotationLabelMigrationEditPolicy.LABEL, new StereotypeEAnnotationLabelMigrationEditPolicy());
- if (!(editPart instanceof UMLCompartmentEditPart)) {
- editPart.installEditPolicy(StereotypeEAnnotationPropertiesMigrationEditPolicy.LABEL, new StereotypeEAnnotationPropertiesMigrationEditPolicy());
- }
- }
-
-
- // Policy for Stereotype Property and Label Migration of Element into Compartment (Property, Operation, Nested element, Enumeration Item,...)
- if (editPart instanceof UMLCompartmentEditPart) {
- if (UMLUtil.resolveUMLElement(editPart) != null) {
- editPart.installEditPolicy(StereotypeEAnnotationPropertiesMigrationEditPolicy.LABEL, new StereotypeEAnnotationNestedMigrationEditPolicy());
- }
- }
-
- }
- }
-
- }
-
-}
+/*****************************************************************************
+ * 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 Stereotype Display
+ * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 493420
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.stereotype.edition.provider;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeMigrationHelper;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationLabelMigrationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationNestedMigrationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationPropertiesMigrationEditPolicy;
+import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
+
+/**
+ * @author Céline JANSSENS
+ *
+ * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler}
+ */
+@Deprecated
+public class StereotypeDisplayMigrationEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
+
+
+
+ /**
+ * @see org.eclipse.gmf.runtime.common.core.service.IProvider#provides(org.eclipse.gmf.runtime.common.core.service.IOperation)
+ *
+ */
+ public boolean provides(IOperation operation) {
+ CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
+ if (!(epOperation.getEditPart() instanceof GraphicalEditPart) && !(epOperation.getEditPart() instanceof ConnectionEditPart)) {
+ return false;
+ }
+
+ EditPart gep = epOperation.getEditPart();
+
+ // Only the EditPart with an Stereotype EAnnotation into its View.
+ try {
+ if (ServiceUtilsForEditPart.getInstance().getServiceRegistry(gep) != null) {
+ if (gep.getModel() instanceof View) {
+ if (StereotypeMigrationHelper.getInstance().hasStereotypeEAnnotation((View) gep.getModel())) {
+ if (UMLUtil.resolveUMLElement(gep) != null) {
+ return true;
+ }
+ }
+ }
+ }
+ } catch (ServiceException e) {
+ return false;
+ }
+
+ return false;
+
+
+ }
+
+
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider#createEditPolicies(org.eclipse.gef.EditPart)
+ *
+ */
+ public void createEditPolicies(EditPart editPart) {
+
+
+ if (editPart.getModel() instanceof View) {
+ if (StereotypeMigrationHelper.getInstance().hasStereotypeEAnnotation((View) editPart.getModel())) {
+
+ // Main policy for Stereotype Label Migration
+
+ if (UMLUtil.resolveUMLElement(editPart) != null) {
+ editPart.installEditPolicy(StereotypeEAnnotationLabelMigrationEditPolicy.LABEL, new StereotypeEAnnotationLabelMigrationEditPolicy());
+ if (!(editPart instanceof UMLCompartmentEditPart)) {
+ editPart.installEditPolicy(StereotypeEAnnotationPropertiesMigrationEditPolicy.LABEL, new StereotypeEAnnotationPropertiesMigrationEditPolicy());
+ }
+ }
+
+
+ // Policy for Stereotype Property and Label Migration of Element into Compartment (Property, Operation, Nested element, Enumeration Item,...)
+ if (editPart instanceof UMLCompartmentEditPart) {
+ if (UMLUtil.resolveUMLElement(editPart) != null) {
+ editPart.installEditPolicy(StereotypeEAnnotationPropertiesMigrationEditPolicy.LABEL, new StereotypeEAnnotationNestedMigrationEditPolicy());
+ }
+ }
+
+ }
+ }
+
+ }
+
+}

Back to the top