| /***************************************************************************** |
| * 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: |
| * |
| * CEA LIST - Initial API and implementation |
| * |
| *****************************************************************************/ |
| package org.eclipse.papyrus.sysml.diagram.blockdefinition.edit.policy; |
| |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.gmf.runtime.notation.View; |
| import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry; |
| import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.GraphicalTypeRegistry; |
| import org.eclipse.papyrus.uml.diagram.clazz.custom.policies.ClassDiagramDragDropEditPolicy; |
| |
| /** |
| * Customization of the DND edit policy for the BlockDefinition Diagram |
| * |
| * @deprecated prefer using {@link CustomDiagramDragDropEditPolicy}. |
| */ |
| @Deprecated |
| public class BlockDefinitionDiagramDragDropEditPolicy extends ClassDiagramDragDropEditPolicy { |
| |
| /** Local graphical type registry */ |
| protected IGraphicalTypeRegistry registry = new GraphicalTypeRegistry(); |
| |
| /** |
| * {@inheritDoc} |
| */ |
| @Override |
| public String getNodeVisualID(View containerView, EObject domainElement) { |
| String domainType = registry.getNodeGraphicalType(domainElement, containerView.getType()); |
| if (org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainType)) { |
| return null; // undefined |
| } |
| return domainType; |
| } |
| |
| /** |
| * {@inheritDoc} |
| */ |
| @Override |
| public String getLinkWithClassVisualID(EObject domainElement) { |
| String domainType = registry.getEdgeGraphicalType(domainElement); |
| if (org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainType)) { |
| return null; // undefined |
| } |
| return domainType; |
| } |
| } |