Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatilov2014-11-25 11:24:24 +0000
committerashatilov2014-11-25 13:12:09 +0000
commit5ab6c0c2054495799691025714ac21675673aaf0 (patch)
tree23499ac578765cdea2161a82d736d6e6bab7083c /plugins
parent023a98be8dd27dda29d96a57c1967c28895378a6 (diff)
downloadorg.eclipse.papyrus-5ab6c0c2054495799691025714ac21675673aaf0.tar.gz
org.eclipse.papyrus-5ab6c0c2054495799691025714ac21675673aaf0.tar.xz
org.eclipse.papyrus-5ab6c0c2054495799691025714ac21675673aaf0.zip
Bug 453182 - Usage link is restored as Dependency link
cherry picked from I5e5d591d459e1748f0acb3c57aa2d0298aa1de02 Change-Id: I196f2ae11ce00a959a327eedb3c1cc4ad216fd38 Signed-off-by: ashatilov <montages.as@gmail.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ClassDiagramDragDropEditPolicy.java21
1 files changed, 13 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/ClassDiagramDragDropEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ClassDiagramDragDropEditPolicy.java
index 0be2e671fd8..25c6fa77038 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ClassDiagramDragDropEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ClassDiagramDragDropEditPolicy.java
@@ -46,6 +46,7 @@ import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationNodeEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPartCN;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DependencyEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DependencyNodeEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.EnumerationLiteralEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.InstanceSpecificationEditPart;
@@ -59,6 +60,7 @@ import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.PackageEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.PackageEditPartCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.RedefinableTemplateSignatureEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.SubstitutionEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.UsageEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CommonDiagramDragDropEditPolicy;
@@ -124,15 +126,18 @@ public class ClassDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPol
return dropAsNormalBinaryLink(dropRequest, semanticLink, linkVISUALID);
}
if (linkVISUALID == AssociationEditPart.VISUAL_ID) {
- return dropAssociation(dropRequest, semanticLink, linkVISUALID);
+ return dropAssociation(dropRequest, semanticLink);
+ }
+ if (linkVISUALID == UsageEditPart.VISUAL_ID) {
+ return dropAsNormalBinaryLink(dropRequest, semanticLink, linkVISUALID);
}
switch (nodeVISUALID) {
case DependencyNodeEditPart.VISUAL_ID:
- return dropDependency(dropRequest, semanticLink, nodeVISUALID);
+ return dropDependency(dropRequest, semanticLink);
case AssociationClassEditPart.VISUAL_ID:
return dropAssociationClass(dropRequest, semanticLink, nodeVISUALID);
case AssociationNodeEditPart.VISUAL_ID:
- return dropAssociation(dropRequest, semanticLink, nodeVISUALID);
+ return dropAssociation(dropRequest, semanticLink);
case NestedClassForClassEditPart.VISUAL_ID:
case ClassEditPartCN.VISUAL_ID:
case PackageEditPartCN.VISUAL_ID:
@@ -225,17 +230,17 @@ public class ClassDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPol
*
* @return the command
*/
- protected Command dropAssociation(DropObjectsRequest dropRequest, Element semanticLink, int nodeVISUALID) {
+ protected Command dropAssociation(DropObjectsRequest dropRequest, Element semanticLink) {
Collection<?> endtypes = ClassLinkMappingHelper.getInstance().getSource(semanticLink);
if (endtypes.size() == 1) {
Element source = (Element) endtypes.toArray()[0];
Element target = (Element) endtypes.toArray()[0];
- return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, 4001, dropRequest.getLocation(), semanticLink));
+ return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, AssociationEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink));
}
if (endtypes.size() == 2) {
Element source = (Element) endtypes.toArray()[0];
Element target = (Element) endtypes.toArray()[1];
- return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, 4001, dropRequest.getLocation(), semanticLink));
+ return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, AssociationEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink));
}
if (endtypes.size() > 2) {
CustomMultiAssociationHelper associationHelper = new CustomMultiAssociationHelper(getEditingDomain());
@@ -273,13 +278,13 @@ public class ClassDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPol
*
* @return the command
*/
- protected Command dropDependency(DropObjectsRequest dropRequest, Element semanticLink, int nodeVISUALID) {
+ protected Command dropDependency(DropObjectsRequest dropRequest, Element semanticLink) {
Collection<?> sources = ClassLinkMappingHelper.getInstance().getSource(semanticLink);
Collection<?> targets = ClassLinkMappingHelper.getInstance().getTarget(semanticLink);
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 Association"), source, target, 4008, dropRequest.getLocation(), semanticLink));
+ return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Dependency"), source, target, DependencyEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink));
}
if (sources.size() > 1 || targets.size() > 1) {
MultiDependencyHelper dependencyHelper = new MultiDependencyHelper(getEditingDomain(), getCompositeCommandRegistry());

Back to the top