Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Pascual2014-11-20 08:19:30 -0500
committerGabriel Pascual2015-02-09 08:57:32 -0500
commitf90e9504752c3c5495e5b667b6ca1e118cdc459a (patch)
treeef95bc1413c08213d7c07f0f6d4d0672c674ffa5
parent113be48f219a313ac655768867cfc2c83b7db86f (diff)
downloadorg.eclipse.papyrus-f90e9504752c3c5495e5b667b6ca1e118cdc459a.tar.gz
org.eclipse.papyrus-f90e9504752c3c5495e5b667b6ca1e118cdc459a.tar.xz
org.eclipse.papyrus-f90e9504752c3c5495e5b667b6ca1e118cdc459a.zip
382954: [ClassDiagram] Instance specification links does not work for
inherited associations https://bugs.eclipse.org/bugs/show_bug.cgi?id=382954 - Add Generalization managment at InstanceSpecification creation - Improve AssociationSelectionDialog behaviour - Fix Instance Specification label display - Create TU Change-Id: I3296164e522eaf1a5de2904e43280ef5d2f0c782 Signed-off-by: Gabriel Pascual <gabriel.pascual@all4tec.net>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CInstanceSpecificationLinkCreateCommand.java441
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CSourceISLinkLabelEditPart.java51
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CTargetISLinkLabelEditPart.java50
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLEditPartFactory.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/EndMemberKind.java59
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java49
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkSourceParser.java59
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationSourceLinkParser.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationTargetLinkParser.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ISRoleSourceDisplayEditPolicy.java69
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ISRoleTargetDisplayEditPolicy.java68
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationRoleDisplayEditPolicy.java404
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/ui/AssociationSelectionDialog.java263
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/providers/UMLParserProvider.java11
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.di2
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.notation274
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.uml35
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/AllTests.java4
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/tests/Bug382954_InstanceSpecificationLink.java66
21 files changed, 1252 insertions, 732 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CInstanceSpecificationLinkCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CInstanceSpecificationLinkCreateCommand.java
index 3922965fe0a..7af31fe6aa8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CInstanceSpecificationLinkCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CInstanceSpecificationLinkCreateCommand.java
@@ -1,167 +1,274 @@
-/*****************************************************************************
- * 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.command;
-
-import java.util.HashSet;
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.InstanceSpecificationLinkHelper;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.NamedElementHelper;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.ui.AssociationSelectionDialog;
-import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.InstanceSpecificationLinkCreateCommand;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.uml2.uml.Association;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.InstanceValue;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Slot;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * use to construct the instance specification link between two instance
- *
- */
-public class CInstanceSpecificationLinkCreateCommand extends InstanceSpecificationLinkCreateCommand {
-
- protected HashSet<Association> commonAssociations;
-
- public CInstanceSpecificationLinkCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request, source, target);
- }
-
- @Override
- public boolean canExecute() {
- if (source != null && target == null) {
- // test if is an instanceSpecification
- if (source instanceof InstanceSpecification) {
- InstanceSpecification instance = (InstanceSpecification) source;
- // Is it associated to a classifier?
- if (instance.getClassifiers().size() > 0) {
- HashSet<Association> assoSource = new HashSet<Association>();
- Iterator<Classifier> iterator = instance.getClassifiers().iterator();
- while (iterator.hasNext()) {
- Classifier classifier = iterator.next();
- assoSource.addAll(classifier.getAssociations());
- }
- // how many association it linked?
- if (assoSource.size() > 0) {
- return true;
- }
- }
- }
- return false;
- }
- // source and target != null
- // look for if it exist at least a common association between classifiers referenced between these instances
- if (source != null && target != null) {
- if (!(source instanceof InstanceSpecification)) {
- return false;
- }
- if (!(target instanceof InstanceSpecification)) {
- return false;
- }
- if (((InstanceSpecification) source).getClassifiers().size() == 0 || ((InstanceSpecification) target).getClassifiers().size() == 0) {
- return false;
- }
- HashSet<Association> assoSource = new HashSet<Association>();
- Iterator<Classifier> iterator = ((InstanceSpecification) source).getClassifiers().iterator();
- while (iterator.hasNext()) {
- Classifier classifier = iterator.next();
- assoSource.addAll(classifier.getAssociations());
- }
- HashSet<Association> assoTarget = new HashSet<Association>();
- iterator = ((InstanceSpecification) target).getClassifiers().iterator();
- while (iterator.hasNext()) {
- Classifier classifier = iterator.next();
- assoTarget.addAll(classifier.getAssociations());
- }
- assoSource.retainAll(assoTarget);
- commonAssociations = new HashSet<Association>();
- commonAssociations.addAll(assoSource);
- return (commonAssociations.size() > 0);
- }
- return false;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- AssociationSelectionDialog associationSelectionDialog;
- Association selectedAssociation = null;
- if (((InstanceSpecification) source).getClassifiers().size() > 0 && ((InstanceSpecification) target).getClassifiers().size() > 0) {
- // look for the good association
- associationSelectionDialog = new AssociationSelectionDialog(new Shell(), SWT.NATIVE, commonAssociations);
- associationSelectionDialog.open();
- selectedAssociation = associationSelectionDialog.getSelectedAssociation();
- // creation of the instance specification link
- // with a name a container, and set the source and target
- InstanceSpecification instanceSpecification = org.eclipse.uml2.uml.UMLFactory.eINSTANCE.createInstanceSpecification();
- getContainer().getPackagedElements().add(instanceSpecification);
- instanceSpecification.setName(NamedElementHelper.EINSTANCE.getNewUMLElementName(instanceSpecification.getOwner(), instanceSpecification.eClass()));
- instanceSpecification.getClassifiers().add(selectedAssociation);
- InstanceSpecificationLinkHelper.addEnd(instanceSpecification, ((InstanceSpecification) source));
- InstanceSpecificationLinkHelper.addEnd(instanceSpecification, ((InstanceSpecification) target));
- // Creation of slots into the good instance by taking in account the association
- Iterator<Property> proIterator = selectedAssociation.getMemberEnds().iterator();
- while (proIterator.hasNext()) {
- Property property = proIterator.next();
- Slot slot = UMLFactory.eINSTANCE.createSlot();
- slot.setDefiningFeature(property);
- if (((InstanceSpecification) source).getClassifiers().contains(property.getOwner())) {
- ((InstanceSpecification) source).getSlots().add(slot);
- associateValue(((InstanceSpecification) target), slot, property.getType());
- } else if (((InstanceSpecification) target).getClassifiers().contains(property.getOwner())) {
- ((InstanceSpecification) target).getSlots().add(slot);
- associateValue(((InstanceSpecification) source), slot, property.getType());
- } else {
- instanceSpecification.getSlots().add(slot);
- if (((InstanceSpecification) source).getClassifiers().contains(property.getType())) {
- associateValue(((InstanceSpecification) source), slot, property.getType());
- } else {
- associateValue(((InstanceSpecification) target), slot, property.getType());
- }
- }
- }
- return CommandResult.newOKCommandResult(instanceSpecification);
- }
- return CommandResult.newCancelledCommandResult();
- }
-
- /**
- * create an instanceValue for the slot (owner) with the reference to InstanceSpecification and the good type
- *
- * @param instanceSpecification
- * that is referenced by the instanceValue
- * @param owner
- * of the instance value
- * @param type
- * of the instanceValue
- * @return a instanceValue
- */
- protected InstanceValue associateValue(InstanceSpecification instanceSpecification, Slot owner, Type type) {
- InstanceValue iv = UMLFactory.eINSTANCE.createInstanceValue();
- iv.setName(NamedElementHelper.EINSTANCE.getNewUMLElementName(owner, iv.eClass()));
- iv.setType(type);
- iv.setInstance(instanceSpecification);
- owner.getValues().add(iv);
- return iv;
- }
-}
+/*****************************************************************************
+ * 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
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 382954
+ */
+package org.eclipse.papyrus.uml.diagram.clazz.custom.command;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.InstanceSpecificationLinkHelper;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.ui.AssociationSelectionDialog;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.InstanceSpecificationLinkCreateCommand;
+import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.InstanceValue;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Slot;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * Use to construct the instance specification link between two instance
+ *
+ */
+public class CInstanceSpecificationLinkCreateCommand extends InstanceSpecificationLinkCreateCommand {
+
+ protected HashSet<Association> commonAssociations;
+
+ public CInstanceSpecificationLinkCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request, source, target);
+ }
+
+ @Override
+ public boolean canExecute() {
+
+ /*
+ * Case 0: Only the target is null
+ */
+ if (source != null && target == null) {
+ // Test if is an instanceSpecification
+ if (source instanceof InstanceSpecification) {
+ InstanceSpecification instance = (InstanceSpecification) source;
+ // Is it associated to a classifier?
+ if (instance.getClassifiers().size() > 0) {
+ HashSet<Association> assoSource = getInstanceAssociations(instance);
+ // How many association it linked?
+ return assoSource.size() > 0;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * Case 1 : source and target != null
+ * look for if it exist at least a common association between classifiers referenced between these instances
+ */
+ if (source != null && target != null) {
+ if (!(source instanceof InstanceSpecification)) {
+ return false;
+ }
+ if (!(target instanceof InstanceSpecification)) {
+ return false;
+ }
+ if (((InstanceSpecification) source).getClassifiers().size() == 0 || ((InstanceSpecification) target).getClassifiers().size() == 0) {
+ return false;
+ }
+
+ HashSet<Association> assoSource = getInstanceAssociations((InstanceSpecification) source);
+ HashSet<Association> assoTarget = getInstanceAssociations((InstanceSpecification) target);
+ assoSource.retainAll(assoTarget);
+ commonAssociations = new HashSet<Association>();
+ commonAssociations.addAll(assoSource);
+ return (commonAssociations.size() > 0);
+ }
+ return false;
+ }
+
+ /**
+ * Gets the instance associations.
+ *
+ * @param instance
+ * the instance
+ * @return the instance associations
+ */
+ private HashSet<Association> getInstanceAssociations(InstanceSpecification instance) {
+ // Initialise set of associations
+ HashSet<Association> instanceAssociationsSet = new HashSet<Association>();
+
+ // Extract all associations of Instance Specification's classifiers
+ Iterator<Classifier> iterator = getSpecificationClassifier(instance).iterator();
+ while (iterator.hasNext()) {
+ Classifier classifier = iterator.next();
+ instanceAssociationsSet.addAll(classifier.getAssociations());
+ }
+
+
+ return instanceAssociationsSet;
+ }
+
+ /**
+ * Gets the specification classifiers.
+ *
+ * @param instance
+ * the instance
+ * @return the specification classifiers
+ */
+ private Set<Classifier> getSpecificationClassifier(InstanceSpecification instance) {
+
+ // Initialise Set of Classifiers
+ Set<Classifier> specificationClassicfiersSet = new HashSet<Classifier>();
+
+ // Explore first rank classifiers
+ for (Classifier classifier : instance.getClassifiers()) {
+
+ // Explore only Classifier which are not already in Set
+ if (!specificationClassicfiersSet.contains(classifier)) {
+ specificationClassicfiersSet.add(classifier);
+ specificationClassicfiersSet.addAll(getInheritedClassifier(classifier, null));
+ }
+ }
+ return specificationClassicfiersSet;
+ }
+
+ /**
+ * Gets the inherited classifier.
+ *
+ * @param classifier
+ * the classifier
+ * @return the inherited classifier
+ */
+ private Set<Classifier> getInheritedClassifier(Classifier classifier, Set<Classifier> alreadyParsedClassifier) {
+
+ // Initialise set of Classifier from Generalisation
+ Set<Classifier> generalizationClassifiers = new HashSet<Classifier>();
+
+
+ // Keep track of parsed Classifier to avoid loop
+ Set<Classifier> parsedClassifiersSet = new HashSet<Classifier>();
+ if (alreadyParsedClassifier != null) {
+ parsedClassifiersSet.addAll(alreadyParsedClassifier);
+ }
+
+ // Explore only Classifier which are not already parsed
+ if (!parsedClassifiersSet.contains(classifier)) {
+ parsedClassifiersSet.add(classifier);
+
+ // Explore all generalisation of Classifier
+ EList<Classifier> classifierGeneralizations = classifier.parents();
+ generalizationClassifiers.addAll(classifierGeneralizations);
+
+ for (Classifier generalClassifier : classifierGeneralizations) {
+ generalizationClassifiers.addAll(getInheritedClassifier(generalClassifier, parsedClassifiersSet));
+ }
+ }
+
+ return generalizationClassifiers;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.clazz.edit.commands.InstanceSpecificationLinkCreateCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ *
+ * @param monitor
+ * @param info
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ AssociationSelectionDialog associationSelectionDialog;
+ Association selectedAssociation = null;
+
+ if (((InstanceSpecification) source).getClassifiers().size() > 0 && ((InstanceSpecification) target).getClassifiers().size() > 0) {
+
+ // Ask to user for the good association
+ associationSelectionDialog = new AssociationSelectionDialog(new Shell(), SWT.NATIVE, commonAssociations);
+ associationSelectionDialog.open();
+ selectedAssociation = associationSelectionDialog.getSelectedAssociation();
+ if (selectedAssociation != null) {
+
+ /*
+ * Creation of the instance specification link
+ * with a name a container, and set the source and target
+ */
+ InstanceSpecification instanceSpecification = UMLFactory.eINSTANCE.createInstanceSpecification();
+ getContainer().getPackagedElements().add(instanceSpecification);
+ instanceSpecification.setName(NamedElementUtil.getDefaultNameWithIncrementFromBase(instanceSpecification.eClass().getName(), instanceSpecification.getOwner().eContents()));
+ instanceSpecification.getClassifiers().add(selectedAssociation);
+
+ Type sourceType = selectedAssociation.getMemberEnds().get(0).getType();
+ Set<Classifier> sourceSpecificationClassifiersSet = getSpecificationClassifier((InstanceSpecification) source);
+
+ if (sourceSpecificationClassifiersSet.contains(sourceType)) {
+ InstanceSpecificationLinkHelper.addEnd(instanceSpecification, ((InstanceSpecification) source));
+ InstanceSpecificationLinkHelper.addEnd(instanceSpecification, ((InstanceSpecification) target));
+ } else {
+ InstanceSpecificationLinkHelper.addEnd(instanceSpecification, ((InstanceSpecification) target));
+ InstanceSpecificationLinkHelper.addEnd(instanceSpecification, ((InstanceSpecification) source));
+ }
+
+
+
+ // Creation of slots into the good instance by taking in account the association
+ Iterator<Property> proIterator = selectedAssociation.getMemberEnds().iterator();
+ Set<Classifier> targetSpecificationClassifiersSet = getSpecificationClassifier((InstanceSpecification) target);
+ while (proIterator.hasNext()) {
+ Property property = proIterator.next();
+ Slot slot = UMLFactory.eINSTANCE.createSlot();
+ slot.setDefiningFeature(property);
+ if (sourceSpecificationClassifiersSet.contains(property.getOwner())) {
+ ((InstanceSpecification) source).getSlots().add(slot);
+ associateValue(((InstanceSpecification) target), slot, property.getType());
+ } else {
+
+ if (targetSpecificationClassifiersSet.contains(property.getOwner())) {
+ ((InstanceSpecification) target).getSlots().add(slot);
+ associateValue(((InstanceSpecification) source), slot, property.getType());
+ } else {
+ instanceSpecification.getSlots().add(slot);
+ if (sourceSpecificationClassifiersSet.contains(property.getType())) {
+ associateValue(((InstanceSpecification) source), slot, property.getType());
+ } else {
+ associateValue(((InstanceSpecification) target), slot, property.getType());
+ }
+ }
+ }
+ }
+ return CommandResult.newOKCommandResult(instanceSpecification);
+ }
+
+ }
+ return CommandResult.newCancelledCommandResult();
+ }
+
+ /**
+ * create an instanceValue for the slot (owner) with the reference to InstanceSpecification and the good type
+ *
+ * @param instanceSpecification
+ * that is referenced by the instanceValue
+ * @param owner
+ * of the instance value
+ * @param type
+ * of the instanceValue
+ * @return a instanceValue
+ */
+ protected InstanceValue associateValue(InstanceSpecification instanceSpecification, Slot owner, Type type) {
+ InstanceValue instanceValue = UMLFactory.eINSTANCE.createInstanceValue();
+ instanceValue.setName(NamedElementUtil.getDefaultNameWithIncrementFromBase(instanceValue.eClass().getName(), owner.eContents()));
+ instanceValue.setType(type);
+ instanceValue.setInstance(instanceSpecification);
+ owner.getValues().add(instanceValue);
+ return instanceValue;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CSourceISLinkLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CSourceISLinkLabelEditPart.java
new file mode 100644
index 00000000000..9d99af79a7c
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CSourceISLinkLabelEditPart.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.SourceISLinkLabelEditPart;
+
+/**
+ * Custom Edit Part for {@link SourceISLinkLabelEditPart}.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public class CSourceISLinkLabelEditPart extends SourceISLinkLabelEditPart {
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ * the view
+ */
+ public CSourceISLinkLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.clazz.edit.parts.SourceISLinkLabelEditPart#getParserElement()
+ *
+ * @return
+ */
+ @Override
+ protected EObject getParserElement() {
+
+ // Resolve the semantic source
+ return ((GraphicalEditPart) ((ConnectionEditPart) getParent()).getTarget()).resolveSemanticElement();
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CTargetISLinkLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CTargetISLinkLabelEditPart.java
new file mode 100644
index 00000000000..28f5c34b028
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CTargetISLinkLabelEditPart.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.TargetISLinkLabelEditPart;
+
+/**
+ * Custom Edit Part for {@link TargetISLinkLabelEditPart}.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public class CTargetISLinkLabelEditPart extends TargetISLinkLabelEditPart {
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ */
+ public CTargetISLinkLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.clazz.edit.parts.TargetISLinkLabelEditPart#getParserElement()
+ *
+ * @return
+ */
+ @Override
+ protected EObject getParserElement() {
+
+ // Resolve semantic target
+ return ((GraphicalEditPart) ((ConnectionEditPart) getParent()).getSource()).resolveSemanticElement();
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLEditPartFactory.java
index 66aadb6c2a0..8eecff5187e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLEditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLEditPartFactory.java
@@ -27,6 +27,8 @@ import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CModelEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CModelEditPartCN;
import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CPackageEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CPackageEditPartCN;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CSourceISLinkLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CTargetISLinkLabelEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomConstraintEditPartCN;
import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomDurationObservationNameEditPart;
@@ -46,6 +48,8 @@ import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPartCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPartTN;
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.SourceISLinkLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.TargetISLinkLabelEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.TimeObservationNameEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.UMLEditPartFactory;
import org.eclipse.papyrus.uml.diagram.clazz.part.UMLVisualIDRegistry;
@@ -93,6 +97,10 @@ public class CustomUMLEditPartFactory extends UMLEditPartFactory {
return new CustomDurationObservationNameEditPart(view);
case TimeObservationNameEditPart.VISUAL_ID:
return new CustomTimeObservationNameEditPart(view);
+ case SourceISLinkLabelEditPart.VISUAL_ID:
+ return new CSourceISLinkLabelEditPart(view);
+ case TargetISLinkLabelEditPart.VISUAL_ID:
+ return new CTargetISLinkLabelEditPart(view);
}
}
return super.createEditPart(context, model);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/EndMemberKind.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/EndMemberKind.java
new file mode 100644
index 00000000000..15853926baa
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/EndMemberKind.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers;
+
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.NamedElement;
+
+/**
+ * The Enum for kind of End member.
+ */
+public enum EndMemberKind {
+ SOURCE(0), TARGET(1), UNKNOWN(-1);
+
+ /** The kind index. */
+ private final int kindIndex;
+
+ /**
+ * Instantiates a new classifier member kind.
+ *
+ * @param index
+ * the index
+ */
+ private EndMemberKind(int index) {
+ kindIndex = index;
+ }
+
+ /**
+ * Extract named element.
+ *
+ * @param classifier
+ * the classifier
+ * @return the named element
+ */
+ public NamedElement extractNamedElement(Classifier classifier) {
+ if (kindIndex < 0) {
+ return null;
+ }
+ return classifier.getMembers().get(kindIndex);
+ }
+
+ /**
+ * Gets the index.
+ *
+ * @return the index
+ */
+ public int getIndex() {
+ return kindIndex;
+ }
+} \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java
index b41b8e9951c..566080aa846 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java
@@ -9,7 +9,7 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - bug 382954
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers;
@@ -19,10 +19,7 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Property;
/**
* The base class of InstanceSpecification link edge parser
@@ -30,10 +27,9 @@ import org.eclipse.uml2.uml.Property;
* @see the getClissifierMemberType() method for specify the type of end
*
*/
+public class RoleInstanceSpecificationLinkParser implements IParser {
-public abstract class RoleInstanceSpecificationLinkParser implements IParser {
-
- protected static final String UNSPECIFIED_LABEL = "<UNSPECIFIED>";
+ protected static final String UNSPECIFIED_LABEL = "<UNSPECIFIED>"; //$NON-NLS-1$
public RoleInstanceSpecificationLinkParser() {
}
@@ -45,13 +41,11 @@ public abstract class RoleInstanceSpecificationLinkParser implements IParser {
@Override
public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
- // TODO Auto-generated method stub
return null;
}
@Override
public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
- // TODO Auto-generated method stub
return null;
}
@@ -62,18 +56,14 @@ public abstract class RoleInstanceSpecificationLinkParser implements IParser {
@Override
public boolean isAffectingEvent(Object event, int flags) {
- // TODO Auto-generated method stub
return false;
}
@Override
public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- // TODO Auto-generated method stub
return null;
}
- protected abstract ClassifierMemberKind getClissifierMemberKind();
-
private String getPrintString(IAdaptable element) {
String namedNodeType = getNamedNodeType(element);
return (namedNodeType == null || namedNodeType.isEmpty()) ? UNSPECIFIED_LABEL : namedNodeType;
@@ -81,37 +71,6 @@ public abstract class RoleInstanceSpecificationLinkParser implements IParser {
private String getNamedNodeType(IAdaptable element) {
InstanceSpecification instanceSpecification = ((InstanceSpecification) ((EObjectAdapter) element).getRealObject());
- if (instanceSpecification.getClassifiers().size() <= 0) {
- return null;
- }
- Classifier classifier = instanceSpecification.getClassifiers().get(0);
- if (classifier.getMembers().size() < 2) {
- return null;
- }
- NamedElement namedElement = getClissifierMemberKind().extractNamedElement(classifier);
- if (namedElement == null) {
- return null;
- }
- if (!(namedElement instanceof Property)) {
- return null;
- }
- return ((Property) namedElement).getName();
- }
-
- public static enum ClassifierMemberKind {
- SOURCE(1), TARGET(0), UNKNOWN(-1);
-
- private final int myIndex;
-
- private ClassifierMemberKind(int index) {
- myIndex = index;
- }
-
- public NamedElement extractNamedElement(Classifier classifier) {
- if (myIndex < 0) {
- return null;
- }
- return classifier.getMembers().get(myIndex);
- }
+ return instanceSpecification.getName();
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkSourceParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkSourceParser.java
deleted file mode 100644
index 2f753512fff..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkSourceParser.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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.parsers;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.uml2.uml.Association;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.Slot;
-
-
-
-public class RoleInstanceSpecificationLinkSourceParser extends RoleInstanceSpecificationLinkParser {
-
- public RoleInstanceSpecificationLinkSourceParser() {
- super();
- }
-
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- return true;
- }
-
- private String getPrintString(IAdaptable element) {
- InstanceSpecification instanceSpecification = ((InstanceSpecification) ((EObjectAdapter) element).getRealObject());
- if (instanceSpecification.getClassifiers().size() > 0) {
- Classifier classifier = instanceSpecification.getClassifiers().get(0);
- if (classifier instanceof Association && instanceSpecification.getSlots().size() > 0) {
- Slot slotSource = instanceSpecification.getSlots().get(0);
- if (slotSource.getValues().size() > 0) {
- return slotSource.getValues().get(0).getType().getName().toLowerCase();
- }
- }
- }
- return UNSPECIFIED_LABEL;
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.RoleInstanceSpecificationLinkParser#getClissifierMemberKind()
- *
- * @return
- */
- @Override
- protected ClassifierMemberKind getClissifierMemberKind() {
- return ClassifierMemberKind.UNKNOWN;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationSourceLinkParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationSourceLinkParser.java
deleted file mode 100644
index fd0caa49a75..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationSourceLinkParser.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers;
-
-/**
- * The source end of InstanceSpecification link edge parser
- *
- */
-
-public class RoleInstanceSpecificationSourceLinkParser extends RoleInstanceSpecificationLinkParser {
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.RoleInstanceSpecificationLinkParser#getClissifierMemberKind()
- *
- * @return
- */
- @Override
- protected ClassifierMemberKind getClissifierMemberKind() {
- return ClassifierMemberKind.SOURCE;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationTargetLinkParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationTargetLinkParser.java
deleted file mode 100644
index bf3bbcdf929..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationTargetLinkParser.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers;
-
-/**
- * The target end of InstanceSpecification link edge parser
- *
- */
-
-public class RoleInstanceSpecificationTargetLinkParser extends RoleInstanceSpecificationLinkParser {
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.RoleInstanceSpecificationLinkParser#getClissifierMemberKind()
- *
- * @return
- */
- @Override
- protected ClassifierMemberKind getClissifierMemberKind() {
- return ClassifierMemberKind.TARGET;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ISRoleSourceDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ISRoleSourceDisplayEditPolicy.java
index bfa1b662c49..9229403a3bf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ISRoleSourceDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ISRoleSourceDisplayEditPolicy.java
@@ -1,37 +1,32 @@
-/*****************************************************************************
- * 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;
-
-import java.util.List;
-
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * this a listener to refresh the source role of the instance specification
- *
- */
-public class ISRoleSourceDisplayEditPolicy extends InstanceSpecificationRoleDisplayEditPolicy {
-
- @Override
- public InstanceSpecification getEnd() {
- return (InstanceSpecification) ((GraphicalEditPart) ((ConnectionEditPart) getHost().getParent()).getTarget()).resolveSemanticElement();
- }
-
- @Override
- protected Property getprefvalue(List<Property> array) {
- return array.get(0);
- }
-}
+/*****************************************************************************
+ * 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
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - bug 382954
+ */
+package org.eclipse.papyrus.uml.diagram.clazz.custom.policies;
+
+import java.util.List;
+
+import org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.EndMemberKind;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * this a listener to refresh the source role of the instance specification
+ *
+ */
+public class ISRoleSourceDisplayEditPolicy extends InstanceSpecificationRoleDisplayEditPolicy {
+
+ @Override
+ protected Property getprefvalue(List<Property> array) {
+ return array.get(EndMemberKind.SOURCE.getIndex());
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ISRoleTargetDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ISRoleTargetDisplayEditPolicy.java
index 87f4530aaa4..ae5c30b51d5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ISRoleTargetDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/ISRoleTargetDisplayEditPolicy.java
@@ -1,37 +1,31 @@
-/*****************************************************************************
- * 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;
-
-import java.util.List;
-
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * this a listener to refresh the target role of the instance specification
- *
- */
-public class ISRoleTargetDisplayEditPolicy extends InstanceSpecificationRoleDisplayEditPolicy {
-
- @Override
- public InstanceSpecification getEnd() {
- return (InstanceSpecification) ((GraphicalEditPart) ((ConnectionEditPart) getHost().getParent()).getSource()).resolveSemanticElement();
- }
-
- @Override
- protected Property getprefvalue(List<Property> array) {
- return array.get(1);
- }
-}
+/*****************************************************************************
+ * 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
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - bug 382954
+ */
+package org.eclipse.papyrus.uml.diagram.clazz.custom.policies;
+
+import java.util.List;
+
+import org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.EndMemberKind;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * this a listener to refresh the target role of the instance specification
+ *
+ */
+public class ISRoleTargetDisplayEditPolicy extends InstanceSpecificationRoleDisplayEditPolicy {
+
+ @Override
+ protected Property getprefvalue(List<Property> array) {
+ return array.get(EndMemberKind.TARGET.getIndex());
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationRoleDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationRoleDisplayEditPolicy.java
index 0f8d5ef368c..7eb464c5225 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationRoleDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationRoleDisplayEditPolicy.java
@@ -1,199 +1,205 @@
-/*****************************************************************************
- * Copyright (c) 2009 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;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.uml2.uml.Association;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * It is used to refresh the label of the role in the instance specification link
- */
-@SuppressWarnings("restriction")
-public abstract class InstanceSpecificationRoleDisplayEditPolicy extends GraphicalEditPolicyEx implements NotificationListener, IPapyrusListener {
-
- public static String INSTANCE_SPECIFICATION_ROLE_DISPLAY = "INSTANCE_SPECIFICATION_ROLE_DISPLAY";
-
- /**
- * Stores the semantic element related to the edit policy. If resolveSemanticElement is used, there are problems when the edit part is getting
- * destroyed, i.e. the link to the semantic element is removed, but the listeners should still be removed
- */
- protected Element hostSemanticElement;
-
- private Property interestingProperty;
-
- /**
- * Returns the view controlled by the host edit part
- *
- * @return the view controlled by the host edit part
- */
- protected View getView() {
- return (View) getHost().getModel();
- }
-
- /**
- * Sets the semantic element which is linked to the edit policy
- *
- * @return the element linked to the edit policy
- */
- protected Element initSemanticElement() {
- return (Element) getView().getElement();
- }
-
- /**
- * Gets the diagram event broker from the editing domain.
- *
- * @return the diagram event broker
- */
- protected DiagramEventBroker getDiagramEventBroker() {
- TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- if (theEditingDomain != null) {
- return DiagramEventBroker.getInstance(theEditingDomain);
- }
- return null;
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void activate() {
- // retrieve the view and the element managed by the edit part
- View view = getView();
- if (view == null) {
- return;
- }
- hostSemanticElement = initSemanticElement();
- if (hostSemanticElement != null) {
- // adds a listener on the view and the element controlled by the editpart
- getDiagramEventBroker().addNotificationListener(view, this);
- getDiagramEventBroker().addNotificationListener(hostSemanticElement, this);
- if (getInterestingProperty() != null) {
- getDiagramEventBroker().addNotificationListener(getInterestingProperty(), this);
- }
- refreshDisplay();
- } else {
- Activator.log.error("No semantic element was found during activation of the mask managed label edit policy", null);
- }
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void deactivate() {
- // retrieve the view and the element managed by the edit part
- View view = getView();
- if (view == null) {
- return;
- }
- // remove notification on element and view
- getDiagramEventBroker().removeNotificationListener(view, this);
- getDiagramEventBroker().removeNotificationListener(hostSemanticElement, this);
- if (getInterestingProperty() != null) {
- getDiagramEventBroker().removeNotificationListener(getInterestingProperty(), this);
- }
- // removes the reference to the semantic element
- hostSemanticElement = null;
- }
-
- /**
- * return the end of the Instance specification that it listen
- *
- * @return an instancespecification
- */
- public abstract InstanceSpecification getEnd();
-
- /**
- * It look for the property that has to be listen o norder to refresh the role in the instancespecification Link
- *
- * @return the property
- */
- public Property getInterestingProperty() {
- if (interestingProperty != null) {
- return interestingProperty;
- }
- if (hostSemanticElement != null) {
- List<Property> array = new ArrayList<Property>();
- InstanceSpecification instanceSpecification = (InstanceSpecification) hostSemanticElement;
- if (instanceSpecification.getClassifiers().size() > 0) {
- if (instanceSpecification.getClassifiers().get(0) instanceof Association) {
- Association association = (Association) instanceSpecification.getClassifiers().get(0);
- InstanceSpecification sourceElt = getEnd();
- Iterator<Property> iterator = association.getMemberEnds().iterator();
- while (iterator.hasNext()) {
- Property property = iterator.next();
- if (sourceElt.getClassifiers().contains(property.getType())) {
- array.add(property);
- }
- }
- }
- }
- if (array.size() == 1) {
- interestingProperty = array.get(0);
- } else if (array.size() > 1) {
- interestingProperty = getprefvalue(array);
- }
- }
- return interestingProperty;
- }
-
- /**
- * get the property that are interesting from a list for example for a source or label
- *
- * @param array
- * the list of properties
- * @return the property
- */
- protected abstract Property getprefvalue(List<Property> array);
-
- /**
- * refresh the display
- */
- protected void refreshDisplay() {
- if (hostSemanticElement != null) {
- if (getInterestingProperty() != null) {
- ((WrappingLabel) getHostFigure()).setText(getInterestingProperty().getName());
- }
- }
- }
-
- /**
- *
- * @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
- *
- * @param notification
- */
- @Override
- public void notifyChanged(Notification notification) {
- refreshDisplay();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2009 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
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - bug 382954
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.clazz.custom.policies;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
+import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * It is used to refresh the label of the role in the instance specification link
+ */
+@SuppressWarnings("restriction")
+public abstract class InstanceSpecificationRoleDisplayEditPolicy extends GraphicalEditPolicyEx implements NotificationListener, IPapyrusListener {
+
+ /** The Constant ACTIVATION_ERROR_MESSAGE. */
+ private static final String ACTIVATION_ERROR_MESSAGE = "No semantic element was found during activation of the mask managed label edit policy";
+
+ public static String INSTANCE_SPECIFICATION_ROLE_DISPLAY = "INSTANCE_SPECIFICATION_ROLE_DISPLAY"; //$NON-NLS-1$
+
+ /**
+ * Stores the semantic element related to the edit policy. If resolveSemanticElement is used, there are problems when the edit part is getting
+ * destroyed, i.e. the link to the semantic element is removed, but the listeners should still be removed
+ */
+ protected Element hostSemanticElement;
+
+ private Property interestingProperty;
+
+ /**
+ * Returns the view controlled by the host edit part
+ *
+ * @return the view controlled by the host edit part
+ */
+ protected View getView() {
+ return (View) getHost().getModel();
+ }
+
+ /**
+ * Sets the semantic element which is linked to the edit policy
+ *
+ * @return the element linked to the edit policy
+ */
+ protected Element initSemanticElement() {
+ return (Element) getView().getElement();
+ }
+
+ /**
+ * Gets the diagram event broker from the editing domain.
+ *
+ * @return the diagram event broker
+ */
+ protected DiagramEventBroker getDiagramEventBroker() {
+ TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ if (theEditingDomain != null) {
+ return DiagramEventBroker.getInstance(theEditingDomain);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void activate() {
+ // retrieve the view and the element managed by the edit part
+ View view = getView();
+ if (view == null) {
+ return;
+ }
+ hostSemanticElement = initSemanticElement();
+ if (hostSemanticElement != null) {
+ // adds a listener on the view and the element controlled by the editpart
+ getDiagramEventBroker().addNotificationListener(view, this);
+ getDiagramEventBroker().addNotificationListener(hostSemanticElement, this);
+ if (getInterestingProperty() != null) {
+ getDiagramEventBroker().addNotificationListener(getInterestingProperty(), this);
+ }
+ refreshDisplay();
+ } else {
+ Activator.log.error(ACTIVATION_ERROR_MESSAGE, null);
+ }
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void deactivate() {
+ // retrieve the view and the element managed by the edit part
+ View view = getView();
+ if (view == null) {
+ return;
+ }
+ // remove notification on element and view
+ getDiagramEventBroker().removeNotificationListener(view, this);
+ getDiagramEventBroker().removeNotificationListener(hostSemanticElement, this);
+ if (getInterestingProperty() != null) {
+ getDiagramEventBroker().removeNotificationListener(getInterestingProperty(), this);
+ }
+ // removes the reference to the semantic element
+ hostSemanticElement = null;
+ }
+
+ /**
+ * Return the end of the Instance specification that it listen
+ *
+ * @return an instancespecification
+ */
+ public InstanceSpecification getEnd() {
+ return (InstanceSpecification) ((IGraphicalEditPart) getHost()).resolveSemanticElement();
+ }
+
+ /**
+ * It look for the property that has to be listen o norder to refresh the role in the instancespecification Link
+ *
+ * @return the property
+ */
+ public Property getInterestingProperty() {
+ if (interestingProperty != null) {
+ return interestingProperty;
+ }
+ if (hostSemanticElement != null) {
+ List<Property> array = new ArrayList<Property>();
+ InstanceSpecification instanceSpecification = (InstanceSpecification) hostSemanticElement;
+ if (instanceSpecification.getClassifiers().size() > 0) {
+ if (instanceSpecification.getClassifiers().get(0) instanceof Association) {
+ Association association = (Association) instanceSpecification.getClassifiers().get(0);
+ InstanceSpecification sourceElt = getEnd();
+ Iterator<Property> iterator = association.getMemberEnds().iterator();
+ while (iterator.hasNext()) {
+ Property property = iterator.next();
+ if (sourceElt.getClassifiers().contains(property.getType())) {
+ array.add(property);
+ }
+ }
+ }
+ }
+ if (array.size() == 1) {
+ interestingProperty = array.get(0);
+ } else if (array.size() > 1) {
+ interestingProperty = getprefvalue(array);
+ }
+ }
+ return interestingProperty;
+ }
+
+ /**
+ * get the property that are interesting from a list for example for a source or label
+ *
+ * @param array
+ * the list of properties
+ * @return the property
+ */
+ protected abstract Property getprefvalue(List<Property> array);
+
+ /**
+ * refresh the display
+ */
+ protected void refreshDisplay() {
+ if (hostSemanticElement != null) {
+ if (getInterestingProperty() != null) {
+ ((ITextAwareEditPart) getHost()).setLabelText(getInterestingProperty().getName());
+ }
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ *
+ * @param notification
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ refreshDisplay();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/ui/AssociationSelectionDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/ui/AssociationSelectionDialog.java
index 9c343fb0e93..fc957961339 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/ui/AssociationSelectionDialog.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/ui/AssociationSelectionDialog.java
@@ -1,114 +1,149 @@
-/*****************************************************************************
- * 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.ui;
-
-import java.util.HashSet;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.uml2.uml.Association;
-
-/**
- * This class can be launch is order to open a dialog used to choose an association
- */
-public class AssociationSelectionDialog extends AbstractAssociationSelectionDialog {
-
- /** The selected association. */
- protected Association selectedAssociation;
-
- /** The common associations. */
- protected HashSet<Association> commonAssociations;
-
- /**
- * Instantiates a new association selection dialog.
- *
- * @param parent
- * the parent shell
- * @param style
- * the style
- * @param commonAssociations
- * list of assocation in which we would like to llok for
- */
- public AssociationSelectionDialog(Shell parent, int style, HashSet<Association> commonAssociations) {
- super(parent, style);
- this.commonAssociations = commonAssociations;
- this.selectedAssociation = (Association) commonAssociations.toArray()[0];
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.clazz.custom.ui.AbstractAssociationSelectionDialog#createContents()
- *
- */
- @Override
- protected void createContents() {
- // TODO Auto-generated method stub
- super.createContents();
- final ILabelProvider labelProvider = new AdapterFactoryLabelProvider(org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
- final IStructuredContentProvider associationContentProvider = new IStructuredContentProvider() {
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- return commonAssociations.toArray();
- }
- };
- final TableViewer tableViewer = new TableViewer(table);
- tableViewer.setLabelProvider(labelProvider);
- tableViewer.setContentProvider(associationContentProvider);
- tableViewer.setInput(commonAssociations);
- btnOk.addMouseListener(new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- ISelection selection = tableViewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- selectedAssociation = (Association) ((IStructuredSelection) selection).getFirstElement();
- shlAssociationselection.close();
- }
- }
-
- @Override
- public void mouseDown(MouseEvent e) {
- }
-
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
- btnCancel.setVisible(false);
- }
-
- /**
- * Gets the selected association.
- *
- * @return the selected association
- */
- public Association getSelectedAssociation() {
- return selectedAssociation;
- }
-}
+/*****************************************************************************
+ * 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
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 382954
+ */
+package org.eclipse.papyrus.uml.diagram.clazz.custom.ui;
+
+import java.util.HashSet;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Association;
+
+/**
+ * This class can be launch is order to open a dialog used to choose an association
+ */
+public class AssociationSelectionDialog extends AbstractAssociationSelectionDialog {
+
+ /** The selected association. */
+ protected Association selectedAssociation;
+
+ /** The common associations. */
+ protected HashSet<Association> commonAssociations;
+
+ /**
+ * Instantiates a new association selection dialog.
+ *
+ * @param parent
+ * the parent shell
+ * @param style
+ * the style
+ * @param commonAssociations
+ * list of assocation in which we would like to llok for
+ */
+ public AssociationSelectionDialog(Shell parent, int style, HashSet<Association> commonAssociations) {
+ super(parent, style);
+ this.commonAssociations = commonAssociations;
+ this.selectedAssociation = (Association) commonAssociations.toArray()[0];
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.clazz.custom.ui.AbstractAssociationSelectionDialog#createContents()
+ *
+ */
+ @Override
+ protected void createContents() {
+ super.createContents();
+ final ILabelProvider labelProvider = new AdapterFactoryLabelProvider(org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+ final IStructuredContentProvider associationContentProvider = new IStructuredContentProvider() {
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return commonAssociations.toArray();
+ }
+ };
+ final TableViewer tableViewer = new TableViewer(table);
+ tableViewer.setLabelProvider(labelProvider);
+ tableViewer.setContentProvider(associationContentProvider);
+ tableViewer.setInput(commonAssociations);
+
+ tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ btnOk.setEnabled(true);
+
+ }
+ });
+
+ btnOk.setEnabled(false);
+ btnOk.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = tableViewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ selectedAssociation = (Association) ((IStructuredSelection) selection).getFirstElement();
+ shlAssociationselection.close();
+ }
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+ });
+
+ btnCancel.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ selectedAssociation = null;
+ shlAssociationselection.close();
+
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+
+
+ }
+ });
+
+ }
+
+ /**
+ * Gets the selected association.
+ *
+ * @return the selected association
+ */
+ public Association getSelectedAssociation() {
+ return selectedAssociation;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen
index 8492886ef9a..5c7cd73b898 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen
@@ -8056,11 +8056,11 @@
<implementations
xsi:type="gmfgen:CustomParser"
uses="/0/@diagram/@links.20/@labels.0/@modelFacet"
- qualifiedName="org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.RoleInstanceSpecificationSourceLinkParser"/>
+ qualifiedName="org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.RoleInstanceSpecificationLinkParser"/>
<implementations
xsi:type="gmfgen:CustomParser"
uses="/0/@diagram/@links.20/@labels.1/@modelFacet"
- qualifiedName="org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.RoleInstanceSpecificationTargetLinkParser"/>
+ qualifiedName="org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.RoleInstanceSpecificationLinkParser"/>
</labelParsers>
<contextMenus
context="/0/@diagram">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/providers/UMLParserProvider.java
index 999759ab240..525d0079ab2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/providers/UMLParserProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/providers/UMLParserProvider.java
@@ -24,8 +24,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.GeneralizationSetConstraintParser;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.RoleInstanceSpecificationSourceLinkParser;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.RoleInstanceSpecificationTargetLinkParser;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.RoleInstanceSpecificationLinkParser;
import org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.SlotParser;
import org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.TemplateBindingParser;
import org.eclipse.papyrus.uml.diagram.clazz.custom.parsers.TemplateParameterParser;
@@ -1892,14 +1891,14 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
/**
* @generated
*/
- private RoleInstanceSpecificationSourceLinkParser instanceSpecificationLabel_6039Parser;
+ private RoleInstanceSpecificationLinkParser instanceSpecificationLabel_6039Parser;
/**
* @generated
*/
private IParser getInstanceSpecificationLabel_6039Parser() {
if (instanceSpecificationLabel_6039Parser == null) {
- instanceSpecificationLabel_6039Parser = new RoleInstanceSpecificationSourceLinkParser();
+ instanceSpecificationLabel_6039Parser = new RoleInstanceSpecificationLinkParser();
}
return instanceSpecificationLabel_6039Parser;
}
@@ -1907,14 +1906,14 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
/**
* @generated
*/
- private RoleInstanceSpecificationTargetLinkParser instanceSpecificationLabel_6038Parser;
+ private RoleInstanceSpecificationLinkParser instanceSpecificationLabel_6038Parser;
/**
* @generated
*/
private IParser getInstanceSpecificationLabel_6038Parser() {
if (instanceSpecificationLabel_6038Parser == null) {
- instanceSpecificationLabel_6038Parser = new RoleInstanceSpecificationTargetLinkParser();
+ instanceSpecificationLabel_6038Parser = new RoleInstanceSpecificationLinkParser();
}
return instanceSpecificationLabel_6038Parser;
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/META-INF/MANIFEST.MF
index 2e7920628c3..cb2263c8383 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/META-INF/MANIFEST.MF
@@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.junit.utils;bundle-version="1.0.2",
org.eclipse.papyrus.infra.emf;bundle-version="1.0.2",
org.eclipse.papyrus.infra.services.openelement;bundle-version="1.0.2",
- org.eclipse.core.expressions
+ org.eclipse.core.expressions,
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.2"
Export-Package: org.eclipse.papyrus.diagram.clazz.test.createFromPalette,
org.eclipse.papyrus.uml.diagram.clazz.test,
org.eclipse.papyrus.uml.diagram.clazz.test.canonical,
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.di b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.notation b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.notation
new file mode 100644
index 00000000000..8f5fd1d9e85
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.notation
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:css="http://www.eclipse.org/papyrus/infra/gmfdiag/css" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
+ <notation:Diagram xmi:id="_eVKSUG_2EeSvZv9bRuRjlg" type="PapyrusUMLClassDiagram" name="DC" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_fw9h8G_2EeSvZv9bRuRjlg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_fxRrAG_2EeSvZv9bRuRjlg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_fxqFgG_2EeSvZv9bRuRjlg" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_fxqskG_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_fxqskW_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_fxqskm_2EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fxqsk2_2EeSvZv9bRuRjlg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_fxr6sG_2EeSvZv9bRuRjlg" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_fxr6sW_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_fxr6sm_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_fxr6s2_2EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fxr6tG_2EeSvZv9bRuRjlg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_fxshwG_2EeSvZv9bRuRjlg" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_fxshwW_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_fxshwm_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_fxshw2_2EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fxshxG_2EeSvZv9bRuRjlg"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_ftLOIG_2EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fw9h8W_2EeSvZv9bRuRjlg" x="24" y="19" width="132" height="96"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_q9z04G_2EeSvZv9bRuRjlg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_q97JoG_2EeSvZv9bRuRjlg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_q9-M8G_2EeSvZv9bRuRjlg" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_q9-M8W_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_q9-M8m_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_q9-0AG_2EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_q9-0AW_2EeSvZv9bRuRjlg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_q-DsgG_2EeSvZv9bRuRjlg" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_q-DsgW_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_q-ETkG_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_q-ETkW_2EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_q-ETkm_2EeSvZv9bRuRjlg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_q-KaMG_2EeSvZv9bRuRjlg" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_q-LoUG_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_q-MPYG_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_q-MPYW_2EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_q-MPYm_2EeSvZv9bRuRjlg"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_q9LiwG_2EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_q90b8G_2EeSvZv9bRuRjlg" x="422" y="17" width="139" height="94"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_SHdJ4G_3EeSvZv9bRuRjlg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_SHeYAG_3EeSvZv9bRuRjlg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_SHe_EG_3EeSvZv9bRuRjlg" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_SHe_EW_3EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_SHe_Em_3EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_SHe_E2_3EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_SHe_FG_3EeSvZv9bRuRjlg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_SHfmIG_3EeSvZv9bRuRjlg" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_SHfmIW_3EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_SHfmIm_3EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_SHfmI2_3EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_SHfmJG_3EeSvZv9bRuRjlg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_SHgNMG_3EeSvZv9bRuRjlg" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_SHgNMW_3EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_SHgNMm_3EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_SHgNM2_3EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_SHgNNG_3EeSvZv9bRuRjlg"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_SHXqUG_3EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_SHdJ4W_3EeSvZv9bRuRjlg" x="423" y="228" width="132" height="97"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_dn6REHDCEeSAifI4sMbueQ" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_dn-igHDCEeSAifI4sMbueQ" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_dn_JkHDCEeSAifI4sMbueQ" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_dn_JkXDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_dn_JknDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_dn_Jk3DCEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dn_JlHDCEeSAifI4sMbueQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_dn_woHDCEeSAifI4sMbueQ" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_dn_woXDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_dn_wonDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_dn_wo3DCEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dn_wpHDCEeSAifI4sMbueQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_doAXsHDCEeSAifI4sMbueQ" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_doAXsXDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_doAXsnDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_doAXs3DCEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_doAXtHDCEeSAifI4sMbueQ"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_dXcMIHDCEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dn6REXDCEeSAifI4sMbueQ" x="787" y="12" width="177" height="97"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_gb_iQHDCEeSAifI4sMbueQ" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_gcClkHDCEeSAifI4sMbueQ" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_gcFB0HDCEeSAifI4sMbueQ" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_gcFB0XDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_gcFB0nDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_gcFB03DCEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_gcFB1HDCEeSAifI4sMbueQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_gcG3AHDCEeSAifI4sMbueQ" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_gcG3AXDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_gcG3AnDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_gcG3A3DCEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_gcG3BHDCEeSAifI4sMbueQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_gcIsMHDCEeSAifI4sMbueQ" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_gcIsMXDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_gcIsMnDCEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_gcIsM3DCEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_gcIsNHDCEeSAifI4sMbueQ"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_gb1KMHDCEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_gcAJUHDCEeSAifI4sMbueQ" x="824" y="206" width="153" height="89"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_OpcNAHDKEeSAifI4sMbueQ" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_OpepQHDKEeSAifI4sMbueQ" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_OpfQUHDKEeSAifI4sMbueQ" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_OpfQUXDKEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_OpfQUnDKEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_OpfQU3DKEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OpfQVHDKEeSAifI4sMbueQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_OpgecHDKEeSAifI4sMbueQ" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_OphFgHDKEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_OphFgXDKEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_OphFgnDKEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OphFg3DKEeSAifI4sMbueQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_OpiToHDKEeSAifI4sMbueQ" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_OpiToXDKEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_OpiTonDKEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_OpiTo3DKEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OpiTpHDKEeSAifI4sMbueQ"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_OpTDEHDKEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OpcNAXDKEeSAifI4sMbueQ" x="1088" y="94" width="158" height="117"/>
+ </children>
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_eVK5YG_2EeSvZv9bRuRjlg" name="diagram_compatibility_version" stringValue="1.0.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_eVK5YW_2EeSvZv9bRuRjlg"/>
+ <styles xmi:type="style:PapyrusViewStyle" xmi:id="_eVK5Ym_2EeSvZv9bRuRjlg">
+ <owner xmi:type="uml:Model" href="model.uml#_rCNpMG_1EeSvZv9bRuRjlg"/>
+ </styles>
+ <element xmi:type="uml:Model" href="model.uml#_rCNpMG_1EeSvZv9bRuRjlg"/>
+ <edges xmi:type="notation:Connector" xmi:id="_bxF9oG_3EeSvZv9bRuRjlg" type="4001" source="_fw9h8G_2EeSvZv9bRuRjlg" target="_q9z04G_2EeSvZv9bRuRjlg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_bxJoAG_3EeSvZv9bRuRjlg" type="6001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_bxKPEG_3EeSvZv9bRuRjlg" y="-20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_bxLdMG_3EeSvZv9bRuRjlg" type="6002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_bxLdMW_3EeSvZv9bRuRjlg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_bxMrUG_3EeSvZv9bRuRjlg" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_bxNSYG_3EeSvZv9bRuRjlg" y="-20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_bxOggG_3EeSvZv9bRuRjlg" type="6005">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_bxPHkG_3EeSvZv9bRuRjlg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_bxQVsG_3EeSvZv9bRuRjlg" type="6033">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_bxQ8wG_3EeSvZv9bRuRjlg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_bxSK4G_3EeSvZv9bRuRjlg" type="6034">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_bxTZAG_3EeSvZv9bRuRjlg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_bxGksG_3EeSvZv9bRuRjlg"/>
+ <element xmi:type="uml:Association" href="model.uml#_bwrt8G_3EeSvZv9bRuRjlg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_bxGksW_3EeSvZv9bRuRjlg" points="[66, 5, -335, 8]$[399, 44, -2, 47]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_dri4IG_3EeSvZv9bRuRjlg" id="(1.0,0.59375)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_drkGQG_3EeSvZv9bRuRjlg" id="(0.02877697841726619,0.6808510638297872)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_clDxMG_3EeSvZv9bRuRjlg" type="4002" source="_SHdJ4G_3EeSvZv9bRuRjlg" target="_q9z04G_2EeSvZv9bRuRjlg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_clFmYG_3EeSvZv9bRuRjlg" type="6007">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_clGNcG_3EeSvZv9bRuRjlg" y="40"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_clDxMW_3EeSvZv9bRuRjlg"/>
+ <element xmi:type="uml:Generalization" href="model.uml#_ckkpAG_3EeSvZv9bRuRjlg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_clDxMm_3EeSvZv9bRuRjlg" points="[4, -48, 2, 164]$[70, -165, 68, 47]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_dsU7QG_3EeSvZv9bRuRjlg" id="(0.14393939393939395,0.0)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_dsWJYG_3EeSvZv9bRuRjlg" id="(0.19424460431654678,0.9574468085106383)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_fzMc4HDCEeSAifI4sMbueQ" type="4002" source="_q9z04G_2EeSvZv9bRuRjlg" target="_dn6REHDCEeSAifI4sMbueQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="_fzPgMHDCEeSAifI4sMbueQ" type="6007">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_fzQuUHDCEeSAifI4sMbueQ" y="40"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_fzMc4XDCEeSAifI4sMbueQ"/>
+ <element xmi:type="uml:Generalization" href="model.uml#_fx3nMHDCEeSAifI4sMbueQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_fzMc4nDCEeSAifI4sMbueQ" points="[30, -8, -256, 0]$[256, -9, -30, -1]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_fz_uIHDCEeSAifI4sMbueQ" id="(0.7841726618705036,0.5425531914893617)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_f0A8QHDCEeSAifI4sMbueQ" id="(0.1694915254237288,0.4948453608247423)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_hjShgHDCEeSAifI4sMbueQ" type="4002" source="_dn6REHDCEeSAifI4sMbueQ" target="_gb_iQHDCEeSAifI4sMbueQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="_hjYoIHDCEeSAifI4sMbueQ" type="6007">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_hjZPMHDCEeSAifI4sMbueQ" y="40"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_hjShgXDCEeSAifI4sMbueQ"/>
+ <element xmi:type="uml:Generalization" href="model.uml#_hjLMwHDCEeSAifI4sMbueQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hjShgnDCEeSAifI4sMbueQ" points="[-2, 10, 34, -141]$[41, 148, 77, -3]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hkv6EHDCEeSAifI4sMbueQ" id="(0.8418079096045198,0.8969072164948454)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_Kxj8gHDKEeSAifI4sMbueQ" type="4002" source="_SHdJ4G_3EeSvZv9bRuRjlg" target="_gb_iQHDCEeSAifI4sMbueQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="_Kxm_0HDKEeSAifI4sMbueQ" type="6007">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_KxoN8HDKEeSAifI4sMbueQ" y="40"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_Kxj8gXDKEeSAifI4sMbueQ"/>
+ <element xmi:type="uml:Generalization" href="model.uml#_Kxd14HDKEeSAifI4sMbueQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_KxkjkHDKEeSAifI4sMbueQ" points="[14, -1, -307, 12]$[283, -13, -38, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_KyrW0HDKEeSAifI4sMbueQ" id="(0.8939393939393939,0.3711340206185567)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_Kysk8HDKEeSAifI4sMbueQ" id="(0.24836601307189543,0.5056179775280899)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PTaXEHDKEeSAifI4sMbueQ" type="4002" source="_gb_iQHDCEeSAifI4sMbueQ" target="_OpcNAHDKEeSAifI4sMbueQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PTblMHDKEeSAifI4sMbueQ" type="6007">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PTblMXDKEeSAifI4sMbueQ" y="40"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PTaXEXDKEeSAifI4sMbueQ"/>
+ <element xmi:type="uml:Generalization" href="model.uml#_PTXTwHDKEeSAifI4sMbueQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PTaXEnDKEeSAifI4sMbueQ" points="[77, -20, -129, 34]$[188, -42, -18, 12]"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PTl9QHDKEeSAifI4sMbueQ" id="(0.11392405063291139,0.8717948717948718)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PvEYUHDKEeSAifI4sMbueQ" type="4002" source="_OpcNAHDKEeSAifI4sMbueQ" target="_dn6REHDCEeSAifI4sMbueQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PvHboHDKEeSAifI4sMbueQ" type="6007">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PvICsHDKEeSAifI4sMbueQ" y="40"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PvEYUXDKEeSAifI4sMbueQ"/>
+ <element xmi:type="uml:Generalization" href="model.uml#_Pu9qoHDKEeSAifI4sMbueQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PvE_YHDKEeSAifI4sMbueQ" points="[-30, -9, 144, 40]$[-154, -48, 20, 1]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PvgdMHDKEeSAifI4sMbueQ" id="(0.189873417721519,0.1623931623931624)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PvhEQHDKEeSAifI4sMbueQ" id="(0.8870056497175142,0.5360824742268041)"/>
+ </edges>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_h2RMIG_3EeSvZv9bRuRjlg" type="PapyrusUMLClassDiagram" name="DI" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_jdzxsG_3EeSvZv9bRuRjlg" type="2001">
+ <children xmi:type="notation:DecorationNode" xmi:id="_jd0_0G_3EeSvZv9bRuRjlg" type="5002"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_jd1m4G_3EeSvZv9bRuRjlg" type="7001">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_jd1m4W_3EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_jd1m4m_3EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_jd1m42_3EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jd1m5G_3EeSvZv9bRuRjlg"/>
+ </children>
+ <element xmi:type="uml:InstanceSpecification" href="model.uml#_jdWesG_3EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jdzxsW_3EeSvZv9bRuRjlg" x="122" y="253" width="119" height="68"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_IP6LEG_5EeSvZv9bRuRjlg" type="2001">
+ <children xmi:type="notation:DecorationNode" xmi:id="_IP7ZMG_5EeSvZv9bRuRjlg" type="5002"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_IP8AQG_5EeSvZv9bRuRjlg" type="7001">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_IP8AQW_5EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_IP8AQm_5EeSvZv9bRuRjlg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_IP8AQ2_5EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_IP8ARG_5EeSvZv9bRuRjlg"/>
+ </children>
+ <element xmi:type="uml:InstanceSpecification" href="model.uml#_IPy2UG_5EeSvZv9bRuRjlg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_IP6LEW_5EeSvZv9bRuRjlg" x="549" y="86" width="111" height="54"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_RXXoUHDJEeSAifI4sMbueQ" type="2001">
+ <children xmi:type="notation:DecorationNode" xmi:id="_RXY2cHDJEeSAifI4sMbueQ" type="5002"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_RXY2cXDJEeSAifI4sMbueQ" type="7001">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_RXY2cnDJEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_RXY2c3DJEeSAifI4sMbueQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_RXY2dHDJEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_RXY2dXDJEeSAifI4sMbueQ"/>
+ </children>
+ <element xmi:type="uml:InstanceSpecification" href="model.uml#_RXSIwHDJEeSAifI4sMbueQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_RXXoUXDJEeSAifI4sMbueQ" x="551" y="260" width="156" height="59"/>
+ </children>
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_h2RMIW_3EeSvZv9bRuRjlg" name="diagram_compatibility_version" stringValue="1.0.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_h2RMIm_3EeSvZv9bRuRjlg"/>
+ <styles xmi:type="style:PapyrusViewStyle" xmi:id="_h2RMI2_3EeSvZv9bRuRjlg">
+ <owner xmi:type="uml:Model" href="model.uml#_rCNpMG_1EeSvZv9bRuRjlg"/>
+ </styles>
+ <element xmi:type="uml:Model" href="model.uml#_rCNpMG_1EeSvZv9bRuRjlg"/>
+ </notation:Diagram>
+ <css:ModelStyleSheets xmi:id="_mtI2kHDKEeSAifI4sMbueQ"/>
+</xmi:XMI>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.uml b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.uml
new file mode 100644
index 00000000000..438affe3384
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/model/testInstanceSpecificationLink/model.uml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_rCNpMG_1EeSvZv9bRuRjlg" name="model">
+ <packagedElement xmi:type="uml:Class" xmi:id="_ftLOIG_2EeSvZv9bRuRjlg" name="A">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_bwlnUG_3EeSvZv9bRuRjlg" name="b" type="_q9LiwG_2EeSvZv9bRuRjlg" association="_bwrt8G_3EeSvZv9bRuRjlg">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_bwlnUW_3EeSvZv9bRuRjlg" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_bwlnUm_3EeSvZv9bRuRjlg" value="1"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Class" xmi:id="_q9LiwG_2EeSvZv9bRuRjlg" name="B">
+ <generalization xmi:type="uml:Generalization" xmi:id="_fx3nMHDCEeSAifI4sMbueQ" general="_dXcMIHDCEeSAifI4sMbueQ"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Class" xmi:id="_SHXqUG_3EeSvZv9bRuRjlg" name="C">
+ <generalization xmi:type="uml:Generalization" xmi:id="_ckkpAG_3EeSvZv9bRuRjlg" general="_q9LiwG_2EeSvZv9bRuRjlg"/>
+ <generalization xmi:type="uml:Generalization" xmi:id="_Kxd14HDKEeSAifI4sMbueQ" general="_gb1KMHDCEeSAifI4sMbueQ"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Association" xmi:id="_bwrt8G_3EeSvZv9bRuRjlg" memberEnd="_bwrt8W_3EeSvZv9bRuRjlg _bwlnUG_3EeSvZv9bRuRjlg">
+ <name xsi:nil="true"/>
+ <ownedEnd xmi:type="uml:Property" xmi:id="_bwrt8W_3EeSvZv9bRuRjlg" name="a" type="_ftLOIG_2EeSvZv9bRuRjlg" association="_bwrt8G_3EeSvZv9bRuRjlg">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_bwrt8m_3EeSvZv9bRuRjlg" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_bwrt82_3EeSvZv9bRuRjlg" value="1"/>
+ </ownedEnd>
+ </packagedElement>
+ <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_jdWesG_3EeSvZv9bRuRjlg" name="a" classifier="_ftLOIG_2EeSvZv9bRuRjlg"/>
+ <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_IPy2UG_5EeSvZv9bRuRjlg" name="b" classifier="_q9LiwG_2EeSvZv9bRuRjlg"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_dXcMIHDCEeSAifI4sMbueQ" name="E">
+ <generalization xmi:type="uml:Generalization" xmi:id="_hjLMwHDCEeSAifI4sMbueQ" general="_gb1KMHDCEeSAifI4sMbueQ"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Class" xmi:id="_gb1KMHDCEeSAifI4sMbueQ" name="F">
+ <generalization xmi:type="uml:Generalization" xmi:id="_PTXTwHDKEeSAifI4sMbueQ" general="_OpTDEHDKEeSAifI4sMbueQ"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_RXSIwHDJEeSAifI4sMbueQ" name="c" classifier="_SHXqUG_3EeSvZv9bRuRjlg"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_OpTDEHDKEeSAifI4sMbueQ" name="Class1">
+ <generalization xmi:type="uml:Generalization" xmi:id="_Pu9qoHDKEeSAifI4sMbueQ" general="_dXcMIHDCEeSAifI4sMbueQ"/>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/AllTests.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/AllTests.java
index b054c98d517..5c50f92c0c7 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/AllTests.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/AllTests.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.diagram.clazz.test;
import org.eclipse.papyrus.uml.diagram.clazz.test.canonical.AllCanonicalTests;
import org.eclipse.papyrus.uml.diagram.clazz.test.copyPaste.ConstraintPasteStrategyTest;
import org.eclipse.papyrus.uml.diagram.clazz.test.legacy.PackageDiagramLegacyTest;
+import org.eclipse.papyrus.uml.diagram.clazz.test.tests.Bug382954_InstanceSpecificationLink;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@@ -28,7 +29,8 @@ import org.junit.runners.Suite.SuiteClasses;
// canonical
AllCanonicalTests.class,
PackageDiagramLegacyTest.class,
- ConstraintPasteStrategyTest.class
+ ConstraintPasteStrategyTest.class,
+ Bug382954_InstanceSpecificationLink.class
// load
// LoadTests.class
})
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/tests/Bug382954_InstanceSpecificationLink.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/tests/Bug382954_InstanceSpecificationLink.java
new file mode 100644
index 00000000000..6178a5a0747
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz.tests/test/org/eclipse/papyrus/uml/diagram/clazz/test/tests/Bug382954_InstanceSpecificationLink.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.clazz.test.tests;
+
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.NamedElement;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Test case for Bug 382954.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public class Bug382954_InstanceSpecificationLink extends AbstractPapyrusTest {
+
+ /** The model set fixture. */
+ @Rule
+ public final ModelSetFixture modelSetFixture = new ModelSetFixture();
+
+
+
+ /**
+ * Test of the link creation between two specification instances a:A and c:C. The link is the specification instance of relation between both types A and B.
+ * The type C inherits of B.
+ */
+ @Test
+ @PluginResource("model/testInstanceSpecificationLink/model.di")
+ public void testLinkCreation() {
+
+ // Get two Specification instances to link
+ NamedElement sourceLink = modelSetFixture.getModel().getMember("a");
+ NamedElement targetLink = modelSetFixture.getModel().getMember("c");
+
+ // Create the command with the creation request and service edit
+ CreateRelationshipRequest relationshipRequest = new CreateRelationshipRequest(modelSetFixture.getModel(), sourceLink, targetLink, UMLElementTypes.InstanceSpecification_4021);
+ IElementEditService editService = ElementEditServiceUtils.getCommandProvider(modelSetFixture.getModel());
+ ICommand editCommand = editService.getEditCommand(relationshipRequest);
+
+ // Verify if the command can be executed
+ Assert.assertTrue(editCommand.canExecute());
+
+ }
+
+
+}

Back to the top