Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2016-10-21 08:21:26 +0000
committerBenoit Maggi2016-10-21 09:50:19 +0000
commit1400ee5b859743b6dae55d8c3314a3ebabfc3b2f (patch)
tree2016c3e880f6b85b2ce8ce3d69038d6873bc2a2d
parent9e4a22122a5dbed3f4209c72b289f95b4817cc89 (diff)
downloadorg.eclipse.papyrus-1400ee5b859743b6dae55d8c3314a3ebabfc3b2f.tar.gz
org.eclipse.papyrus-1400ee5b859743b6dae55d8c3314a3ebabfc3b2f.tar.xz
org.eclipse.papyrus-1400ee5b859743b6dae55d8c3314a3ebabfc3b2f.zip
Bug 506314 - [Class] Allow sub representation of AssotiationClass
- use AssociationClassHelper for AssociationClass_Edge sub specialization Change-Id: I71966ad87884090c4c56eb11b946a9d6426eca95 Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr> (cherry picked from commit 685b59505a8c74bc1cfc4e84e4a7e94badfbc79f)
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/CustomGraphicalNodeEditPolicy.java13
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.linklf/src/org/eclipse/papyrus/uml/diagram/linklf/policy/graphicalnode/ClassLinksLFGraphicalNodeEditPolicy.java13
2 files changed, 18 insertions, 8 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/CustomGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/CustomGraphicalNodeEditPolicy.java
index 6d70c944b3d..9cef30af083 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/CustomGraphicalNodeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/CustomGraphicalNodeEditPolicy.java
@@ -9,15 +9,18 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Bug 506314
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.clazz.custom.policies;
+import java.util.Arrays;
+
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.AssociationClassHelper;
@@ -46,13 +49,15 @@ public class CustomGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPolic
// case of associationClass
CreateElementRequestAdapter requestAdapter = ((CreateConnectionViewAndElementRequest) request).getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest) requestAdapter.getAdapter(CreateRelationshipRequest.class);
- if (UMLElementTypes.AssociationClass_Edge.equals(createElementRequest.getElementType())) {
+ IElementType elementType = createElementRequest.getElementType();
+ if (UMLElementTypes.AssociationClass_Edge.equals(elementType)
+ || (elementType!= null && Arrays.asList(elementType.getAllSuperTypes()).contains(UMLElementTypes.AssociationClass_Edge))) {
AssociationClassHelper associationClassHelper = new AssociationClassHelper(getEditingDomain());
return associationClassHelper.getAssociationClassElementCommand(((CreateConnectionViewAndElementRequest) request), c);
- } else if (UMLElementTypes.Dependency_BranchEdge.equals(createElementRequest.getElementType())) {
+ } else if (UMLElementTypes.Dependency_BranchEdge.equals(elementType)) {
MultiDependencyHelper multiDependencyHelper = new MultiDependencyHelper(getEditingDomain());
return multiDependencyHelper.getCommand(((CreateConnectionViewAndElementRequest) request), c);
- } else if (UMLElementTypes.Association_BranchEdge.equals(createElementRequest.getElementType())) {
+ } else if (UMLElementTypes.Association_BranchEdge.equals(elementType)) {
MultiAssociationHelper multiAssociationHelper = new MultiAssociationHelper(getEditingDomain());
return multiAssociationHelper.getCommand(((CreateConnectionViewAndElementRequest) request), c);
} else {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.linklf/src/org/eclipse/papyrus/uml/diagram/linklf/policy/graphicalnode/ClassLinksLFGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.linklf/src/org/eclipse/papyrus/uml/diagram/linklf/policy/graphicalnode/ClassLinksLFGraphicalNodeEditPolicy.java
index f03b5d2e491..41cd7fa0d0c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.linklf/src/org/eclipse/papyrus/uml/diagram/linklf/policy/graphicalnode/ClassLinksLFGraphicalNodeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.linklf/src/org/eclipse/papyrus/uml/diagram/linklf/policy/graphicalnode/ClassLinksLFGraphicalNodeEditPolicy.java
@@ -9,15 +9,18 @@
*
* Contributors:
* Svyatoslav Kovalsky - Initial API and implementation
- *
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Bug 506314
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.linklf.policy.graphicalnode;
+import java.util.Arrays;
+
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.AssociationClassHelper;
import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.MultiAssociationHelper;
@@ -40,14 +43,16 @@ public class ClassLinksLFGraphicalNodeEditPolicy extends DefaultLinksLFEditPolic
.getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest) requestAdapter
.getAdapter(CreateRelationshipRequest.class);
- if (UMLElementTypes.AssociationClass_Edge.equals(createElementRequest.getElementType())) {
+ IElementType elementType = createElementRequest.getElementType();
+ if (UMLElementTypes.AssociationClass_Edge.equals(elementType)
+ || (elementType!= null && Arrays.asList(elementType.getAllSuperTypes()).contains(UMLElementTypes.AssociationClass_Edge))) {
AssociationClassHelper associationClassHelper = new AssociationClassHelper(getEditingDomain());
return associationClassHelper.getAssociationClassElementCommand(
((CreateConnectionViewAndElementRequest) request), c);
- } else if (UMLElementTypes.Dependency_BranchEdge.equals(createElementRequest.getElementType())) {
+ } else if (UMLElementTypes.Dependency_BranchEdge.equals(elementType)) {
MultiDependencyHelper multiDependencyHelper = new MultiDependencyHelper(getEditingDomain());
return multiDependencyHelper.getCommand(((CreateConnectionViewAndElementRequest) request), c);
- } else if (UMLElementTypes.Association_BranchEdge.equals(createElementRequest.getElementType())) {
+ } else if (UMLElementTypes.Association_BranchEdge.equals(elementType)) {
MultiAssociationHelper multiAssociationHelper = new MultiAssociationHelper(getEditingDomain());
return multiAssociationHelper.getCommand(((CreateConnectionViewAndElementRequest) request), c);
} else {

Back to the top