/***************************************************************************** * 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.uml.diagram.clazz.custom.policies.itemsemantic; import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand; import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CTemplateBindingCreateCommand; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DependencyBranchEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.TemplateBindingEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.policies.ModelItemSemanticEditPolicyTN; import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes; /** * this class has been specialized in order to manage reconnection of multidependency * */ public class CustomModelItemSemanticEditPolicyTN extends ModelItemSemanticEditPolicyTN { protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) { return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget())); } return super.getCompleteCreateRelationshipCommand(req); } protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { switch(getVisualID(req)) { case DependencyBranchEditPart.VISUAL_ID: return getGEFWrapper(new BranchDependenctReorientCommand(req)); case TemplateBindingEditPart.VISUAL_ID: return UnexecutableCommand.INSTANCE; } return super.getReorientRelationshipCommand(req); } protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) { return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget())); } return super.getStartCreateRelationshipCommand(req); } }