Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/diagram/clazz/custom/policies/itemsemantic/CustomInstanceSpecificationItemSemanticEditPolicy.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/diagram/clazz/custom/policies/itemsemantic/CustomInstanceSpecificationItemSemanticEditPolicy.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/diagram/clazz/custom/policies/itemsemantic/CustomInstanceSpecificationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/diagram/clazz/custom/policies/itemsemantic/CustomInstanceSpecificationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..487f42abe86
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/diagram/clazz/custom/policies/itemsemantic/CustomInstanceSpecificationItemSemanticEditPolicy.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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.diagram.clazz.custom.policies.itemsemantic;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.diagram.clazz.custom.command.BranchDependenctReorientCommand;
+import org.eclipse.papyrus.diagram.clazz.custom.command.CInstanceSpecificationLinkCreateCommand;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.DependencyBranchEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.policies.InstanceSpecificationItemSemanticEditPolicy;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+
+/**
+ * this class has been specialized in order to manage reconnection of multidependency
+ *
+ */
+public class CustomInstanceSpecificationItemSemanticEditPolicy extends InstanceSpecificationItemSemanticEditPolicy {
+
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch(getVisualID(req)) {
+ case DependencyBranchEditPart.VISUAL_ID:
+ return getGEFWrapper(new BranchDependenctReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if(UMLElementTypes.InstanceSpecification_4021 == req.getElementType()) {
+ return getGEFWrapper(new CInstanceSpecificationLinkCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return super.getStartCreateRelationshipCommand(req);
+ }
+
+ @Override
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ // TODO Auto-generated method stub
+ if(UMLElementTypes.InstanceSpecification_4021 == req.getElementType()) {
+ return getGEFWrapper(new CInstanceSpecificationLinkCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return super.getCompleteCreateRelationshipCommand(req);
+ }
+}

Back to the top