From a8c899e266e6290b14e93e6ff9588770722854ce Mon Sep 17 00:00:00 2001 From: Vincent Aravantinos <aravantinos@fortiss.org> Date: Tue, 11 Mar 2014 16:09:11 +0000 Subject: [PATCH] Improved handling of special copy pasting. Fixed the issue. refs 1980 --- .../tooling/kernel/ui/util/CopyPasteUtils.java | 9 +++------ .../trunk/model/kernel.ecore | 15 ++------------- .../trunk/model/kernel.genmodel | 7 ++----- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java index 33814a339..f012bc98d 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java @@ -45,7 +45,7 @@ import org.fortiss.tooling.kernel.ui.dnd.CompositionServiceLocalCopyPasteTransfe * * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: C10175C80531676B29BE8895D87819F2 + * @ConQAT.Rating YELLOW Hash: 24530D08B4CDBA8179A0F683AA700FDF */ public class CopyPasteUtils { @@ -69,10 +69,7 @@ public class CopyPasteUtils { EList<ISpeciallyCopyiable> specialSel = pickInstanceOf(ISpeciallyCopyiable.class, new BasicEList<EObject>(sel)); for(ISpeciallyCopyiable obj : specialSel) { - obj.completeCopyEnvironment(copier); - } - for(ISpeciallyCopyiable obj : specialSel) { - obj.copyConnections(copier); + obj.specialCopyHook(copier); } Clipboard clipboard = new Clipboard(Display.getDefault()); clipboard.setContents(new Object[] {content}, @@ -121,7 +118,7 @@ public class CopyPasteUtils { } for(EObject obj : getClipBoardContent()) { if(obj instanceof ISpeciallyCopyiable) { - ((ISpeciallyCopyiable)obj).copyConnections(copier); + ((ISpeciallyCopyiable)obj).specialCopyHook(copier); } } } diff --git a/org.fortiss.tooling.kernel/trunk/model/kernel.ecore b/org.fortiss.tooling.kernel/trunk/model/kernel.ecore index 6fec1389f..1a99f9319 100644 --- a/org.fortiss.tooling.kernel/trunk/model/kernel.ecore +++ b/org.fortiss.tooling.kernel/trunk/model/kernel.ecore @@ -102,20 +102,9 @@ </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="ISpeciallyCopyiable" abstract="true" interface="true"> - <eOperations name="completeCopyEnvironment"> + <eOperations name="specialCopyHook"> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Hook to allow changing the copy map, typically by adding elements that are not copied but might still be necessary to preserve some information.
The typical example is to copy connections between elements: the top element containing the connections is not copied, but necessary to copy the connections."/> - </eAnnotations> - <eParameters name="copyMap"> - <eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EMap"> - <eTypeArguments eClassifier="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - <eTypeArguments eClassifier="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </eGenericType> - </eParameters> - </eOperations> - <eOperations name="copyConnections"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Hook to allow copying the connections between elements.
Goes hand in hand with completeCopyEnvironment.
Typically, one first calls completeCopyEnvironment on all copied elements and then copyConnections to copy the connections."/> + <details key="documentation" value="Hook for the copy of elements which need a special treatement (e.g, copy of connections, avoiding the repetition of some characteristics due to a copy, etc.)"/> </eAnnotations> <eParameters name="copyMap"> <eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EMap"> diff --git a/org.fortiss.tooling.kernel/trunk/model/kernel.genmodel b/org.fortiss.tooling.kernel/trunk/model/kernel.genmodel index dacd48edf..1ec8dc011 100644 --- a/org.fortiss.tooling.kernel/trunk/model/kernel.genmodel +++ b/org.fortiss.tooling.kernel/trunk/model/kernel.genmodel @@ -47,11 +47,8 @@ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute kernel.ecore#//IExternalDocumentReference/uri"/> </genClasses> <genClasses image="false" ecoreClass="kernel.ecore#//ISpeciallyCopyiable"> - <genOperations ecoreOperation="kernel.ecore#//ISpeciallyCopyiable/completeCopyEnvironment"> - <genParameters ecoreParameter="kernel.ecore#//ISpeciallyCopyiable/completeCopyEnvironment/copyMap"/> - </genOperations> - <genOperations ecoreOperation="kernel.ecore#//ISpeciallyCopyiable/copyConnections"> - <genParameters ecoreParameter="kernel.ecore#//ISpeciallyCopyiable/copyConnections/copyMap"/> + <genOperations ecoreOperation="kernel.ecore#//ISpeciallyCopyiable/specialCopyHook"> + <genParameters ecoreParameter="kernel.ecore#//ISpeciallyCopyiable/specialCopyHook/copyMap"/> </genOperations> </genClasses> </genPackages> -- GitLab