copier.copyReferences(); outputResource.getContents().add(outputPackage); collapseEmptyPackages(outputPackage);
copier.copyReferences(); return copy;
@SuppressWarnings("unchecked") T copy = (T) copier.copy(original); copier.copyReferences(); return copy;
copier.copyReferences(); return clone;
copier.copyReferences(); return clone;
/** * Creates a deep copy of the given object and associates each copied instance with the * clone. Does not resolve any proxies. * * @param original the root element to be cloned. * @return a clone of tree rooted in original associated with the original, <code>null</code> if original is <code>null</code>. */ protected <T extends EObject> T cloneAndAssociate(T original) { final boolean canAssociate = languageInfo.isLanguage(original.eResource()); EcoreUtil.Copier copier = new EcoreUtil.Copier(false) { private static final long serialVersionUID = 1L; @Override/* @Nullable */ protected EObject createCopy(/* @Nullable */ EObject eObject) { EObject result = super.createCopy(eObject); if (canAssociate && result != null && eObject != null && !eObject.eIsProxy()) { associator.associate(eObject, result); } return result; } }; @SuppressWarnings("unchecked") T copy = (T) copier.copy(original); copier.copyReferences(); return copy; }
/** * Returns a self-contained copy of the eObject. * @param eObject the object to copy. * @return the copy. * @see Copier */ public static <T extends EObject> T copy(T eObject) { Copier copier = new Copier(); EObject result = copier.copy(eObject); copier.copyReferences(); @SuppressWarnings("unchecked")T t = (T)result; return t; }
/** * Returns a self-contained copy of the eObject. * @param eObject the object to copy. * @return the copy. * @see Copier */ public static <T extends EObject> T copy(T eObject) { Copier copier = new Copier(); EObject result = copier.copy(eObject); copier.copyReferences(); @SuppressWarnings("unchecked")T t = (T)result; return t; }
/** * copies contents of a resource set into a new one */ public static <T extends ResourceSet> T clone(T target, ResourceSet source) { EList<Resource> resources = source.getResources(); EcoreUtil.Copier copier = new EcoreUtil.Copier(); for (Resource resource : resources) { Resource resource2 = target.createResource(resource.getURI()); resource2.getContents().addAll(copier.copyAll(resource.getContents())); } copier.copyReferences(); return target; }
/** * Returns a collection of the self-contained copies of each {@link EObject} in eObjects. * @param eObjects the collection of objects to copy. * @return the collection of copies. * @see Copier */ public static <T> Collection<T> copyAll(Collection<? extends T> eObjects) { Copier copier = new Copier(); Collection<T> result = copier.copyAll(eObjects); copier.copyReferences(); return result; }
public BuildElement createWorkingCopy() { EcoreUtil.Copier copier = new EcoreUtil.Copier(); BuildElement newElement = (BuildElement) copier.copy(this); // FIXME clone containment hierarchy instead copier.copyReferences(); newElement.original = this; return newElement; }
/** * Clones the given model. Either an {@link EObject}, {@link Resource} or {@link ResourceSet}. * @param notifier The root container of the model. * @return The cloned model. */ public static Notifier clone(Notifier notifier) { Copier copier = new Copier(); Notifier clonedModel = clone(notifier, copier, null); copier.copyReferences(); return clonedModel; }
/** * Clones the given EObject without resolving any proxies. */ @SuppressWarnings("unchecked") public static <T extends EObject> T cloneWithProxies(T original) { if (original == null) return original; EcoreUtil.Copier copier = new EcoreUtil.Copier(false); T copy = (T) copier.copy(original); copier.copyReferences(); return copy; }
/** * Returns a collection of the self-contained copies of each {@link EObject} in eObjects. * @param eObjects the collection of objects to copy. * @return the collection of copies. * @see Copier */ public static <T> Collection<T> copyAll(Collection<? extends T> eObjects) { Copier copier = new Copier(); Collection<T> result = copier.copyAll(eObjects); copier.copyReferences(); return result; }