Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-02-28 14:42:31 +0000
committerVincent Lorenzo2014-03-18 14:03:24 +0000
commit0ea08311b1863fd8528b0226f5b0ee0f2b49ce3e (patch)
treef0ca3319f9aaad337572f5c1d3e0c07c9733b5ff
parent0788cd442a1358c353ca33f5d685415d79771c96 (diff)
downloadorg.eclipse.papyrus-0ea08311b1863fd8528b0226f5b0ee0f2b49ce3e.tar.gz
org.eclipse.papyrus-0ea08311b1863fd8528b0226f5b0ee0f2b49ce3e.tar.xz
org.eclipse.papyrus-0ea08311b1863fd8528b0226f5b0ee0f2b49ce3e.zip
#290261: Correct Stereotype Strategy
[Usability] Papyrus shall provide a copy/paste/cut feature - StereotypePasteStrategy : reload the stereotype in the new contxte to allow his application Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/StereotypePasteStrategy.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/StereotypePasteStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/StereotypePasteStrategy.java
index f5322faed53..6f15e39ad3c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/StereotypePasteStrategy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/StereotypePasteStrategy.java
@@ -25,6 +25,7 @@ import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.papyrus.infra.core.clipboard.IClipboardAdditionalData;
import org.eclipse.papyrus.infra.core.clipboard.PapyrusClipboard;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.tools.commands.ApplyStereotypeCommand;
@@ -142,8 +143,11 @@ public class StereotypePasteStrategy implements IPasteStrategy {
StereotypeClipboard stereotypeClipboard = (StereotypeClipboard) additionnalData;
Stereotype stereotype = stereotypeClipboard.getStereotype();
if (stereotype != null) {
+ // reload the stereotype in the new Contex-ResourceSet (Required because in org.eclipse.uml2.uml.internal.operations.PackageOperations
+ // L960 in getProfileApplication the test is using == instead of equals)
+ Stereotype stereotypeInTargetContext = EMFHelper.reloadIntoContext(stereotype, targetOwner);
// append command to apply stereotype
- ApplyStereotypeCommand applyStereotypeCommand = new ApplyStereotypeCommand((Element)target, stereotype, (TransactionalEditingDomain) domain);
+ ApplyStereotypeCommand applyStereotypeCommand = new ApplyStereotypeCommand((Element)target, stereotypeInTargetContext, (TransactionalEditingDomain) domain);
compoundCommand.append(applyStereotypeCommand);
}
}

Back to the top