Search in sources :

Example 1 with Copier

use of org.eclipse.emf.ecore.util.EcoreUtil.Copier in project Palladio-Editors-Sirius by PalladioSimulator.

the class PCMServices method copyEObject.

/**
 * Copies an EObject
 * @param eObject the EObject to be copied
 * @return The copy
 */
public EObject copyEObject(EObject eObject) {
    Copier copier = new Copier();
    EObject copy = copier.copy(eObject);
    copier.copyReferences();
    return copy;
}
Also used : Copier(org.eclipse.emf.ecore.util.EcoreUtil.Copier) EObject(org.eclipse.emf.ecore.EObject)

Example 2 with Copier

use of org.eclipse.emf.ecore.util.EcoreUtil.Copier in project InformationSystem by ObeoNetwork.

the class ImportData method initializeCopyElements.

private void initializeCopyElements() {
    Collection<EObject> allObjects = new ArrayList<>();
    allObjects.addAll(sourceSemanticRoots);
    allObjects.addAll(sourceGraphicalRoots);
    Copier copier = new Copier();
    copier.copyAll(allObjects);
    copier.copyReferences();
    // Build the copy to source map
    copyToSourceMap = new HashMap<EObject, EObject>();
    for (EObject sourceRoot : sourceSemanticRoots) {
        copyToSourceMap.put(copier.get(sourceRoot), sourceRoot);
    }
    // Save the copier as the source to copy map
    sourceToCopyMap = copier;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Copier(org.eclipse.emf.ecore.util.EcoreUtil.Copier) ArrayList(java.util.ArrayList)

Example 3 with Copier

use of org.eclipse.emf.ecore.util.EcoreUtil.Copier in project InformationSystem by ObeoNetwork.

the class ImportData method initializeCopyElements.

private void initializeCopyElements() {
    Collection<EObject> sourceEObjects = new ArrayList<EObject>();
    sourceEObjects.addAll(sourceRoots);
    sourceEObjects.addAll(sourceRepresentationDescriptors);
    for (DRepresentationDescriptor dRepresentationDescriptor : sourceRepresentationDescriptors) {
        sourceEObjects.add(dRepresentationDescriptor.getRepresentation());
    }
    Copier copier = new Copier();
    copier.copyAll(sourceEObjects);
    copier.copyReferences();
    // Build the copy to source map
    copyToSourceMap = new HashMap<EObject, EObject>();
    for (EObject sourceEObject : sourceEObjects) {
        copyToSourceMap.put(copier.get(sourceEObject), sourceEObject);
    }
    // Save the copier as the source to copy map
    sourceToCopyMap = copier;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Copier(org.eclipse.emf.ecore.util.EcoreUtil.Copier) ArrayList(java.util.ArrayList) DRepresentationDescriptor(org.eclipse.sirius.viewpoint.DRepresentationDescriptor)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)3 Copier (org.eclipse.emf.ecore.util.EcoreUtil.Copier)3 ArrayList (java.util.ArrayList)2 DRepresentationDescriptor (org.eclipse.sirius.viewpoint.DRepresentationDescriptor)1