Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFanch BONNABESSE2017-08-16 09:03:51 -0400
committerPatrick Tessier2017-08-28 10:57:01 -0400
commit7e9a5940c0c9132a4bf493f863abbeaed1fcf3f6 (patch)
treea8c83f9864e7fe27f3858e792f50812438652b5b /plugins/uml/diagram
parentc1da274f1852f4f8c22d939121d2e5b7dadfa297 (diff)
downloadorg.eclipse.papyrus-7e9a5940c0c9132a4bf493f863abbeaed1fcf3f6.tar.gz
org.eclipse.papyrus-7e9a5940c0c9132a4bf493f863abbeaed1fcf3f6.tar.xz
org.eclipse.papyrus-7e9a5940c0c9132a4bf493f863abbeaed1fcf3f6.zip
Bug 515198: [DeploymentDiagram] DnD of CommunicationPath leads to
corrupted representation https://bugs.eclipse.org/bugs/show_bug.cgi?id=515198 Added communicationpath (association) management for the deployment diagram Change-Id: Ib0cb84a6119087a200415969eb44897f3f8c067f Signed-off-by: Fanch BONNABESSE <fanch.bonnabesse@all4tec.net>
Diffstat (limited to 'plugins/uml/diagram')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF146
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomDiagramDragDropEditPolicy.java293
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/pom.xml20
3 files changed, 250 insertions, 209 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF
index 3d3192fe50c..b3addcdf69d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF
@@ -1,73 +1,73 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.deployment,
- org.eclipse.papyrus.uml.diagram.deployment.custom.actions,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic,
- org.eclipse.papyrus.uml.diagram.deployment.custom.factory,
- org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes,
- org.eclipse.papyrus.uml.diagram.deployment.custom.messages,
- org.eclipse.papyrus.uml.diagram.deployment.custom.migration,
- org.eclipse.papyrus.uml.diagram.deployment.custom.providers,
- org.eclipse.papyrus.uml.diagram.deployment.edit.helpers,
- org.eclipse.papyrus.uml.diagram.deployment.edit.parts,
- org.eclipse.papyrus.uml.diagram.deployment.edit.policies,
- org.eclipse.papyrus.uml.diagram.deployment.expressions,
- org.eclipse.papyrus.uml.diagram.deployment.parsers,
- org.eclipse.papyrus.uml.diagram.deployment.part,
- org.eclipse.papyrus.uml.diagram.deployment.preferences,
- org.eclipse.papyrus.uml.diagram.deployment.providers,
- org.eclipse.papyrus.uml.diagram.deployment.sheet
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.preferences;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.jface,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui.providers,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.draw2d;visibility:=reexport,
- org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
- org.eclipse.uml2.uml;bundle-version="[5.3.0,6.0.0)";visibility:=reexport,
- org.eclipse.uml2.uml.edit;bundle-version="[5.3.0,6.0.0)";visibility:=reexport,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.ecore.edit;visibility:=reexport,
- org.eclipse.emf.validation;visibility:=reexport,
- org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;visibility:=reexport;bundle-version="[3.0.0,4.0.0)"
-Bundle-Vendor: %providerName
-Eclipse-LazyStart: true
-Bundle-Version: 3.0.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.deployment;singleton:=true
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.uml.diagram.deployment,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.actions,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.factory,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.messages,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.migration,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.providers,
+ org.eclipse.papyrus.uml.diagram.deployment.edit.helpers,
+ org.eclipse.papyrus.uml.diagram.deployment.edit.parts,
+ org.eclipse.papyrus.uml.diagram.deployment.edit.policies,
+ org.eclipse.papyrus.uml.diagram.deployment.expressions,
+ org.eclipse.papyrus.uml.diagram.deployment.parsers,
+ org.eclipse.papyrus.uml.diagram.deployment.part,
+ org.eclipse.papyrus.uml.diagram.deployment.preferences,
+ org.eclipse.papyrus.uml.diagram.deployment.providers,
+ org.eclipse.papyrus.uml.diagram.deployment.sheet
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)",
+ org.eclipse.ocl.ecore;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.preferences;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version="[1.7.0,2.0.0)",
+ org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)",
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.jface,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.views,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.gmf.runtime.emf.core,
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.gmf.runtime.emf.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.gmf.runtime.diagram.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui.providers,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor,
+ org.eclipse.draw2d;visibility:=reexport,
+ org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
+ org.eclipse.uml2.uml;bundle-version="[5.3.0,6.0.0)";visibility:=reexport,
+ org.eclipse.uml2.uml.edit;bundle-version="[5.3.0,6.0.0)";visibility:=reexport,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.emf.validation;visibility:=reexport,
+ org.eclipse.gef,
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;visibility:=reexport;bundle-version="[3.0.0,4.0.0)"
+Bundle-Vendor: %providerName
+Eclipse-LazyStart: true
+Bundle-Version: 3.1.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.deployment;singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomDiagramDragDropEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomDiagramDragDropEditPolicy.java
index be3af457025..0e2156ae2bf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomDiagramDragDropEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/CustomDiagramDragDropEditPolicy.java
@@ -1,7 +1,7 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2017 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
@@ -9,6 +9,8 @@
*
* Contributors:
* Amine EL KOUHEN (CEA LIST/INRIA DaRT) amine.el_kouhen@inria.fr
+ * Fanch Bonnabesse (ALL4TEC) fanch.bonnabesse@alltec.net - Bug 515198
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies;
@@ -38,12 +40,14 @@ import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CommonDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.util.AssociationUtil;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command.CreateViewCommand;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers.DeploymentLinkMappingHelper;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers.MultiDependencyHelper;
import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPart;
import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommunicationPathEditPart;
import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
@@ -63,6 +67,7 @@ import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPart;
import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Association;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Collaboration;
@@ -92,18 +97,18 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* Gets the droppable element visual id.
- *
+ *
* @return the droppable element visual id {@inheritDoc}
*/
@Override
protected Set<String> getDroppableElementVisualId() {
- Set<String> droppableElementsVisualId = new HashSet<String>();
+ Set<String> droppableElementsVisualId = new HashSet<>();
// Class CN
droppableElementsVisualId.add(CommentEditPartCN.VISUAL_ID);
droppableElementsVisualId.add(ConstraintEditPartCN.VISUAL_ID);
-
+
// TopLevelNodes
droppableElementsVisualId.add(DependencyNodeEditPart.VISUAL_ID);
droppableElementsVisualId.add(ModelEditPart.VISUAL_ID);
@@ -111,16 +116,17 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
droppableElementsVisualId.add(CommentEditPart.VISUAL_ID);
droppableElementsVisualId.add(ConstraintEditPart.VISUAL_ID);
-
+ // Edges
+ droppableElementsVisualId.add(CommunicationPathEditPart.VISUAL_ID);
return droppableElementsVisualId;
}
/**
* Gets the uML element type.
- *
+ *
* @param elementID
- * the element id
+ * the element id
* @return the uML element type {@inheritDoc}
*/
@Override
@@ -130,11 +136,11 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* Gets the node visual id.
- *
+ *
* @param containerView
- * the container view
+ * the container view
* @param domainElement
- * the domain element
+ * the domain element
* @return the node visual id {@inheritDoc}
*/
@Override
@@ -144,9 +150,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* Gets the link with class visual id.
- *
+ *
* @param domainElement
- * the domain element
+ * the domain element
* @return the link with class visual id {@inheritDoc}
*/
@Override
@@ -156,33 +162,36 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* Gets the specific drop command.
- *
+ *
* @param dropRequest
- * the drop request
+ * the drop request
* @param semanticElement
- * the semantic element
+ * the semantic element
* @param nodeVISUALID
- * the node visualid
+ * the node visualid
* @param linkVISUALID
- * the link visualid
+ * the link visualid
* @return the specific drop command {@inheritDoc}
*/
@Override
protected Command getSpecificDropCommand(DropObjectsRequest dropRequest, Element semanticElement, String nodeVISUALID, String linkVISUALID) {
if (linkVISUALID != null) {
// Switch test over linkVisualID
- switch(linkVISUALID) {
-
+ switch (linkVISUALID) {
+
case ManifestationEditPart.VISUAL_ID:
return dropManifestation(dropRequest, semanticElement, linkVISUALID);
-
+
case DeploymentEditPart.VISUAL_ID:
return dropDependencyNode(dropRequest, semanticElement, linkVISUALID);
+
+ case CommunicationPathEditPart.VISUAL_ID:
+ return dropAssociation(dropRequest, semanticElement, linkVISUALID);
}
}
if (nodeVISUALID != null) {
// Switch test over nodeVISUALID
- switch(nodeVISUALID) {
+ switch (nodeVISUALID) {
// Test TopLevelNode... Start
case DependencyNodeEditPart.VISUAL_ID:
@@ -194,9 +203,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
case ExecutionEnvironmentEditPart.VISUAL_ID:
case ArtifactEditPart.VISUAL_ID:
return dropTopLevelNode(dropRequest, semanticElement, nodeVISUALID, linkVISUALID);
- // Test TopLevelNode... End
+ // Test TopLevelNode... End
- // Test ChildNode... Start
+ // Test ChildNode... Start
case PackageEditPartCN.VISUAL_ID:
case ModelEditPartCN.VISUAL_ID:
case NestedNodeEditPartCN.VISUAL_ID:
@@ -204,7 +213,7 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
case NestedArtifactNodeEditPartCN.VISUAL_ID:
return dropChildNode(dropRequest, semanticElement, nodeVISUALID, linkVISUALID);
- // Test ChildNode... End
+ // Test ChildNode... End
case CommentEditPart.VISUAL_ID:
@@ -221,13 +230,13 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* Drop Manifestation.
- *
+ *
* @param dropRequest
- * the drop request
+ * the drop request
* @param semanticLink
- * the semantic link
+ * the semantic link
* @param linkVISUALID
- * the link visualid
+ * the link visualid
* @return the command
*/
protected Command dropManifestation(DropObjectsRequest dropRequest, Element semanticLink, String linkVISUALID) {
@@ -235,12 +244,12 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
Collection<?> targetEnds = DeploymentLinkMappingHelper.getInstance().getTarget(semanticLink);
// Dependency with Unary ends
- if((sourceEnds != null) && (targetEnds != null) && (sourceEnds.size() == 1) && (targetEnds.size() == 1)) {
+ if ((sourceEnds != null) && (targetEnds != null) && (sourceEnds.size() == 1) && (targetEnds.size() == 1)) {
- Element source = (Element)sourceEnds.toArray()[0];
- Element target = (Element)targetEnds.toArray()[0];
+ Element source = (Element) sourceEnds.toArray()[0];
+ Element target = (Element) targetEnds.toArray()[0];
return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Manifestation"), source, target, //$NON-NLS-1$
- linkVISUALID, dropRequest.getLocation(), semanticLink));
+ linkVISUALID, dropRequest.getLocation(), semanticLink));
} else {
return UnexecutableCommand.INSTANCE;
}
@@ -249,20 +258,22 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* Returns the command to drop the Constraint + the link to attach it to its contrainted elements.
- *
+ *
* @param dropRequest
- * the drop request
+ * the drop request
* @param semanticLink
- * the semantic link
+ * the semantic link
* @param nodeVISUALID
- * the node visual id
+ * the node visual id
* @return the command
*/
protected Command dropConstraint(DropObjectsRequest dropRequest, Element semanticLink, String nodeVISUALID) {
- if(ConstraintEditPart.VISUAL_ID.equals(nodeVISUALID)) {
- return getDropConstraintCommand((Constraint)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Constraint_Shape, (IHintedType)UMLElementTypes.Constraint_ConstrainedElementEdge);
- } else if(ConstraintEditPartCN.VISUAL_ID.equals(nodeVISUALID)) {
- return getDropConstraintCommand((Constraint)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Constraint_Shape_CN, (IHintedType)UMLElementTypes.Constraint_ConstrainedElementEdge);
+ if (ConstraintEditPart.VISUAL_ID.equals(nodeVISUALID)) {
+ return getDropConstraintCommand((Constraint) semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart) getHost()).getNotationView(), (IHintedType) UMLElementTypes.Constraint_Shape,
+ (IHintedType) UMLElementTypes.Constraint_ConstrainedElementEdge);
+ } else if (ConstraintEditPartCN.VISUAL_ID.equals(nodeVISUALID)) {
+ return getDropConstraintCommand((Constraint) semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart) getHost()).getNotationView(), (IHintedType) UMLElementTypes.Constraint_Shape_CN,
+ (IHintedType) UMLElementTypes.Constraint_ConstrainedElementEdge);
}
return UnexecutableCommand.INSTANCE;
}
@@ -270,21 +281,23 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* Returns the command to drop the Comment + the link to attach it to its annotated elements.
- *
+ *
* @param dropRequest
- * the drop request
+ * the drop request
* @param semanticLink
- * the semantic link
+ * the semantic link
* @param nodeVISUALID
- * the node visual id
+ * the node visual id
* @return the command
*/
protected Command dropComment(DropObjectsRequest dropRequest, Element semanticLink, String nodeVISUALID) {
- if(CommentEditPart.VISUAL_ID.equals(nodeVISUALID)) {
- return getDropCommentCommand((Comment)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Comment_Shape, (IHintedType)UMLElementTypes.Comment_AnnotatedElementEdge);
- } else if(CommentEditPartCN.VISUAL_ID.equals(nodeVISUALID)) {
- return getDropCommentCommand((Comment)semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView(), (IHintedType)UMLElementTypes.Comment_Shape_CN, (IHintedType)UMLElementTypes.Comment_AnnotatedElementEdge);
+ if (CommentEditPart.VISUAL_ID.equals(nodeVISUALID)) {
+ return getDropCommentCommand((Comment) semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart) getHost()).getNotationView(), (IHintedType) UMLElementTypes.Comment_Shape,
+ (IHintedType) UMLElementTypes.Comment_AnnotatedElementEdge);
+ } else if (CommentEditPartCN.VISUAL_ID.equals(nodeVISUALID)) {
+ return getDropCommentCommand((Comment) semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart) getHost()).getNotationView(), (IHintedType) UMLElementTypes.Comment_Shape_CN,
+ (IHintedType) UMLElementTypes.Comment_AnnotatedElementEdge);
}
return UnexecutableCommand.INSTANCE;
}
@@ -292,27 +305,27 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
private Command dropDependencyNode(DropObjectsRequest dropRequest, Element semanticElement, String nodeVISUALID) {
Collection<?> sources = DeploymentLinkMappingHelper.getInstance().getSource(semanticElement);
Collection<?> targets = DeploymentLinkMappingHelper.getInstance().getTarget(semanticElement);
- if(sources.size() == 1 && targets.size() == 1) {
- Element source = (Element)sources.toArray()[0];
- Element target = (Element)targets.toArray()[0];
+ if (sources.size() == 1 && targets.size() == 1) {
+ Element source = (Element) sources.toArray()[0];
+ Element target = (Element) targets.toArray()[0];
return new ICommandProxy(dropBinaryLink(new CompositeCommand("Drop Dependency"), source, target, DependencyEditPart.VISUAL_ID, dropRequest.getLocation(), semanticElement));
}
- if(sources.size() > 1 || targets.size() > 1) {
+ if (sources.size() > 1 || targets.size() > 1) {
MultiDependencyHelper dependencyHelper = new MultiDependencyHelper(getEditingDomain());
- return dependencyHelper.dropMutliDependency((Dependency)semanticElement, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart)getHost()).getNotationView());
+ return dependencyHelper.dropMutliDependency((Dependency) semanticElement, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart) getHost()).getNotationView());
}
return UnexecutableCommand.INSTANCE;
}
/**
* Returns the drop command for Dependency links.
- *
+ *
* @param dropRequest
- * the drop request
+ * the drop request
* @param semanticLink
- * the element to drop
+ * the element to drop
* @param linkVISUALID
- * the visual identifier of the EditPart of the dropped element
+ * the visual identifier of the EditPart of the dropped element
* @return the drop command
*/
protected Command dropDependency(DropObjectsRequest dropRequest, Element semanticLink, String linkVISUALID) {
@@ -320,31 +333,58 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
Collection<?> targetEnds = DeploymentLinkMappingHelper.getInstance().getTarget(semanticLink);
// Dependency with Unary ends
- if((sourceEnds != null) && (targetEnds != null) && (sourceEnds.size() == 1) && (targetEnds.size() == 1)) {
+ if ((sourceEnds != null) && (targetEnds != null) && (sourceEnds.size() == 1) && (targetEnds.size() == 1)) {
- Element source = (Element)sourceEnds.toArray()[0];
- Element target = (Element)targetEnds.toArray()[0];
+ Element source = (Element) sourceEnds.toArray()[0];
+ Element target = (Element) targetEnds.toArray()[0];
return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Dependency"), source, target, //$NON-NLS-1$
- linkVISUALID, dropRequest.getLocation(), semanticLink));
+ linkVISUALID, dropRequest.getLocation(), semanticLink));
} else {
return UnexecutableCommand.INSTANCE;
}
}
/**
+ * Returns the drop command for Association links.
+ *
+ * @param dropRequest
+ * the drop request
+ * @param semanticLink
+ * the element to drop
+ * @param linkVISUALID
+ * the visual identifier of the EditPart of the dropped element
+ * @return the drop command
+ * @since 3.1
+ */
+ protected Command dropAssociation(final DropObjectsRequest dropRequest, final Element semanticLink, final String linkVISUALID) {
+ Collection<?> endTypes = DeploymentLinkMappingHelper.getInstance().getSource(semanticLink);
+ if (1 == endTypes.size()) {
+ // Source and target are the same.
+ Element endType = (Element) endTypes.toArray()[0];
+ return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), endType, endType, linkVISUALID, dropRequest.getLocation(), semanticLink)); //$NON-NLS-1$
+ }
+ if (2 == endTypes.size()) {
+ Element source = AssociationUtil.getInitialSourceSecondEnd((Association) semanticLink).getType();
+ Element target = AssociationUtil.getInitialTargetFirstEnd((Association) semanticLink).getType();
+ return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, linkVISUALID, dropRequest.getLocation(), semanticLink)); //$NON-NLS-1$
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
* Returns the drop command for Property nodes.
- *
+ *
* @param dropRequest
- * the drop request
+ * the drop request
* @param droppedElement
- * the element to drop
+ * the element to drop
* @param nodeVISUALID
- * the visual identifier of the EditPart of the dropped element
+ * the visual identifier of the EditPart of the dropped element
* @return the drop command
*/
protected Command dropProperty(DropObjectsRequest dropRequest, Property droppedElement, String nodeVISUALID) {
- GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart)getHost();
+ GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart) getHost();
EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
// Default drop location
@@ -352,18 +392,18 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
// Port inherits from Property this case should be excluded and treated
// separately
- if(!(droppedElement instanceof Port)) {
+ if (!(droppedElement instanceof Port)) {
- if((graphicalParentObject instanceof Classifier) && (((Classifier)graphicalParentObject).getAllAttributes().contains(droppedElement))) {
+ if ((graphicalParentObject instanceof Classifier) && (((Classifier) graphicalParentObject).getAllAttributes().contains(droppedElement))) {
// The graphical parent is the real owner of the dropped
// property.
// The dropped property may also be an inherited attribute of
// the graphical parent.
return new ICommandProxy(getDefaultDropNodeCommand(nodeVISUALID, location, droppedElement));
- } else if(graphicalParentObject instanceof ConnectableElement) {
- Type type = ((ConnectableElement)graphicalParentObject).getType();
- if((type != null) && (type instanceof Classifier) && (((Classifier)type).getAllAttributes().contains(droppedElement))) {
+ } else if (graphicalParentObject instanceof ConnectableElement) {
+ Type type = ((ConnectableElement) graphicalParentObject).getType();
+ if ((type != null) && (type instanceof Classifier) && (((Classifier) type).getAllAttributes().contains(droppedElement))) {
// The graphical parent is a Property typed by a Classifier
// that owns or inherits the
// dropped property.
@@ -377,26 +417,26 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* <pre>
- * This method return a drop command for TopLevelNode.
+ * This method return a drop command for TopLevelNode.
* It returns an {@link org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand} in
* case the element is dropped on a canvas referencing a domain element that is not a Package.
* </pre>
- *
+ *
* @param dropRequest
- * the drop request
+ * the drop request
* @param semanticElement
- * the semantic element
+ * the semantic element
* @param nodeVISUALID
- * the visual identifier of the EditPart of the dropped element
+ * the visual identifier of the EditPart of the dropped element
* @param linkVISUALID
- * the visual identifier of the EditPart of the dropped element
+ * the visual identifier of the EditPart of the dropped element
* @return the drop command
*/
protected Command dropTopLevelNode(DropObjectsRequest dropRequest, Element semanticElement, String nodeVISUALID, String linkVISUALID) {
- GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart)getHost();
+ GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart) getHost();
EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
- if(graphicalParentObject instanceof org.eclipse.uml2.uml.Package) {
+ if (graphicalParentObject instanceof org.eclipse.uml2.uml.Package) {
return new ICommandProxy(getDefaultDropNodeCommand(nodeVISUALID, dropRequest.getLocation(), semanticElement));
}
@@ -405,53 +445,54 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* Drop child node.
- *
+ *
* @param dropRequest
- * the drop request
+ * the drop request
* @param semanticElement
- * the semantic element
+ * the semantic element
* @param nodeVISUALID
- * the node visualid
+ * the node visualid
* @param linkVISUALID
- * the link visualid
+ * the link visualid
* @return the command
*/
private Command dropChildNode(DropObjectsRequest dropRequest, Element semanticElement, String nodeVISUALID, String linkVISUALID) {
- GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart)getHost();
+ GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart) getHost();
EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
- //if(graphicalParentObject instanceof org.eclipse.uml2.uml.Package) {
- return new ICommandProxy(getDefaultDropNodeCommand(nodeVISUALID, dropRequest.getLocation(), semanticElement));
- //}
+ // if(graphicalParentObject instanceof org.eclipse.uml2.uml.Package) {
+ return new ICommandProxy(getDefaultDropNodeCommand(nodeVISUALID, dropRequest.getLocation(), semanticElement));
+ // }
- //return UnexecutableCommand.INSTANCE;
+ // return UnexecutableCommand.INSTANCE;
}
/**
* <pre>
- * This method returns the drop command for AffixedNode (Port, Parameter)
+ * This method returns the drop command for AffixedNode (Port, Parameter)
* in case the node is dropped on a ShapeCompartmentEditPart.
* </pre>
- *
+ *
* @param nodeVISUALID
- * the node visual identifier
+ * the node visual identifier
* @param location
- * the drop location
+ * the drop location
* @param droppedObject
- * the object to drop
+ * the object to drop
* @return a CompositeCommand for Drop
*/
+ @Override
protected CompoundCommand getDropAffixedNodeInCompartmentCommand(String nodeVISUALID, Point location, EObject droppedObject) {
CompoundCommand cc = new CompoundCommand("Drop");
IAdaptable elementAdapter = new EObjectAdapter(droppedObject);
- ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, ((IHintedType)getUMLElementType(nodeVISUALID)).getSemanticHint(), ViewUtil.APPEND, true, getDiagramPreferencesHint());
+ ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, ((IHintedType) getUMLElementType(nodeVISUALID)).getSemanticHint(), ViewUtil.APPEND, true, getDiagramPreferencesHint());
// Create the command targeting host parent (owner of the
// ShapeCompartmentEditPart)
- CreateViewCommand createCommand = new CreateViewCommand(getEditingDomain(), descriptor, ((View)(getHost().getParent().getModel())));
+ CreateViewCommand createCommand = new CreateViewCommand(getEditingDomain(), descriptor, ((View) (getHost().getParent().getModel())));
cc.add(new ICommandProxy(createCommand));
- SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", (IAdaptable)createCommand.getCommandResult().getReturnValue(), location);
+ SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", (IAdaptable) createCommand.getCommandResult().getReturnValue(), location);
cc.add(new ICommandProxy(setBoundsCommand));
return cc;
@@ -459,9 +500,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* Avoid dropped element to get orphaned for DND action resulting in a specific action (not a move).
- *
+ *
* @param request
- * the request
+ * the request
* @return the drag command
*/
@Override
@@ -470,19 +511,19 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
Boolean isSpecificDrag = false;
Iterator<?> iter = request.getEditParts().iterator();
- EObject graphicalParentObject = ((GraphicalEditPart)getHost()).resolveSemanticElement();
- while((graphicalParentObject != null) && (iter.hasNext())) {
+ EObject graphicalParentObject = ((GraphicalEditPart) getHost()).resolveSemanticElement();
+ while ((graphicalParentObject != null) && (iter.hasNext())) {
EObject droppedObject = null;
- EditPart droppedEditPart = (EditPart)iter.next();
- if(droppedEditPart instanceof GraphicalEditPart) {
- droppedObject = ((GraphicalEditPart)droppedEditPart).resolveSemanticElement();
+ EditPart droppedEditPart = (EditPart) iter.next();
+ if (droppedEditPart instanceof GraphicalEditPart) {
+ droppedObject = ((GraphicalEditPart) droppedEditPart).resolveSemanticElement();
}
- isSpecificDrag = isSpecificDropActionExpected((GraphicalEditPart)getHost(), droppedObject);
+ isSpecificDrag = isSpecificDropActionExpected((GraphicalEditPart) getHost(), droppedObject);
}
- if(isSpecificDrag) {
+ if (isSpecificDrag) {
return null;
}
@@ -500,18 +541,18 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
Boolean isSpecificDrop = false;
Iterator<?> iter = request.getEditParts().iterator();
- EObject graphicalParentObject = ((GraphicalEditPart)getHost()).resolveSemanticElement();
- while((graphicalParentObject != null) && (iter.hasNext())) {
+ EObject graphicalParentObject = ((GraphicalEditPart) getHost()).resolveSemanticElement();
+ while ((graphicalParentObject != null) && (iter.hasNext())) {
EObject droppedObject = null;
- EditPart droppedEditPart = (EditPart)iter.next();
- if(droppedEditPart instanceof GraphicalEditPart) {
- droppedObject = ((GraphicalEditPart)droppedEditPart).resolveSemanticElement();
+ EditPart droppedEditPart = (EditPart) iter.next();
+ if (droppedEditPart instanceof GraphicalEditPart) {
+ droppedObject = ((GraphicalEditPart) droppedEditPart).resolveSemanticElement();
}
- isSpecificDrop = isSpecificDropActionExpected((GraphicalEditPart)getHost(), droppedObject);
+ isSpecificDrop = isSpecificDropActionExpected((GraphicalEditPart) getHost(), droppedObject);
}
- if(isSpecificDrop) {
+ if (isSpecificDrop) {
return getDropObjectsCommand(castToDropObjectsRequest(request));
}
@@ -520,40 +561,40 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/**
* Test if a specific drop action shall is expected.
- *
+ *
* @param graphicalParent
- * the graphical parent
+ * the graphical parent
* @param droppedObject
- * the dropped object
+ * the dropped object
* @return true, if is specific drop action expected
*/
protected boolean isSpecificDropActionExpected(GraphicalEditPart graphicalParent, EObject droppedObject) {
boolean isSpecificDropActionExpected = false;
EObject graphicalParentObject = graphicalParent.resolveSemanticElement();
- if(graphicalParentObject != null) {
+ if (graphicalParentObject != null) {
- if(graphicalParentObject instanceof Collaboration) {
+ if (graphicalParentObject instanceof Collaboration) {
- if((droppedObject instanceof Collaboration) || (droppedObject instanceof Class)) {
+ if ((droppedObject instanceof Collaboration) || (droppedObject instanceof Class)) {
isSpecificDropActionExpected = true;
}
- } else if(graphicalParentObject instanceof StructuredClassifier) {
+ } else if (graphicalParentObject instanceof StructuredClassifier) {
- if((droppedObject instanceof Collaboration) || (droppedObject instanceof Class)) {
+ if ((droppedObject instanceof Collaboration) || (droppedObject instanceof Class)) {
isSpecificDropActionExpected = true;
}
- } else if(graphicalParentObject instanceof TypedElement) {
+ } else if (graphicalParentObject instanceof TypedElement) {
- if(droppedObject instanceof Type) {
+ if (droppedObject instanceof Type) {
isSpecificDropActionExpected = true;
}
- } else if(graphicalParentObject instanceof CollaborationUse) {
+ } else if (graphicalParentObject instanceof CollaborationUse) {
- if(droppedObject instanceof Collaboration) {
+ if (droppedObject instanceof Collaboration) {
isSpecificDropActionExpected = true;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/pom.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/pom.xml
index 0692009eebd..15e28a5c420 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/pom.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/pom.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.eclipse.papyrus</groupId>
- <artifactId>org.eclipse.papyrus.uml-diagrams</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.papyrus.uml.diagram.deployment</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.uml-diagrams</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.uml.diagram.deployment</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file

Back to the top