Skip to content
Snippets Groups Projects
Commit a8c899e2 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

Improved handling of special copy pasting. Fixed the issue.

refs 1980
parent db703c75
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
}
......
......@@ -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.&#xA;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.&#xA;Goes hand in hand with completeCopyEnvironment.&#xA;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">
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment