当前位置: 首页>>代码示例>>Java>>正文


Java Copier.copyReferences方法代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.util.EcoreUtil.Copier.copyReferences方法的典型用法代码示例。如果您正苦于以下问题:Java Copier.copyReferences方法的具体用法?Java Copier.copyReferences怎么用?Java Copier.copyReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.ecore.util.EcoreUtil.Copier的用法示例。


在下文中一共展示了Copier.copyReferences方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateSavedURIFragment

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
/**
 * Updates {@link IEObjectLocation#getSavedURIFragment() saved URI fragment}.
 * 
 * @param container
 *            the {@link ILocationContainer}
 * @param eObjectContainer
 *            the {@link IEObjectContainer}
 * @param newResource
 *            the new {@link Resource}
 * @throws Exception
 *             if the XMI serialization failed or elements couldn't be created
 */
private static void updateSavedURIFragment(ILocationContainer container,
		IEObjectContainer eObjectContainer, Resource newResource) throws Exception {
	final IBase base = MappingUtils.getBase(container);

	final Copier copier = new Copier();
	final Collection<EObject> copiedContents = copier.copyAll(newResource.getContents());
	copier.copyReferences();
	final XMIResourceImpl newXMIResource = new XMIResourceImpl();
	newXMIResource.getContents().addAll(copiedContents);

	for (Entry<EObject, EObject> entry : copier.entrySet()) {
		final EObject newEObject = entry.getKey();
		final EObject savedEObject = entry.getValue();
		final ICouple couple = base.getFactory().createElement(ICouple.class);
		couple.setKey(newResource.getURIFragment(newEObject));
		couple.setValue(newXMIResource.getURIFragment(savedEObject));
		eObjectContainer.getSavedURIFragments().add(couple);
	}
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:32,代码来源:EObjectConnector.java

示例2: initLocationEObject

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void initLocationEObject() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
			.eContents()));
	copier.copyReferences();
	final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
	final Resource resource = createResource("test.xmi");
	resource.getContents().addAll(eObjects);
	container.setResource(resource);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
	final IEObjectLocation location = new TestEObjectLocation();
	location.setContainer(container);

	final TestEObjectContainerConnector testEObjectContainerConnector = new TestEObjectContainerConnector();
	MappingUtils.getConnectorRegistry().register(testEObjectContainerConnector);
	final EObjectConnector eObjectConnector = new EObjectConnector();
	MappingUtils.getConnectorRegistry().register(eObjectConnector);
	super.initLocation(container, location, producerEClass);

	final Object element = eObjectConnector.getElement(location);
	assertTrue(element instanceof EObject);
	assertEquals(producerEClass, element);
	assertNull(location.getFeatureName());

	MappingUtils.getConnectorRegistry().unregister(testEObjectContainerConnector);
	MappingUtils.getConnectorRegistry().unregister(eObjectConnector);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:34,代码来源:EObjectConnectorTests.java

示例3: initLocationSetting

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void initLocationSetting() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
			.eContents()));
	copier.copyReferences();
	final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
	final Resource resource = createResource("test.xmi");
	resource.getContents().addAll(eObjects);
	container.setResource(resource);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
	final IEObjectLocation location = new TestEObjectLocation();
	location.setContainer(container);

	final TestEObjectContainerConnector testEObjectContainerConnector = new TestEObjectContainerConnector();
	MappingUtils.getConnectorRegistry().register(testEObjectContainerConnector);
	final EObjectConnector eObjectConnector = new EObjectConnector();
	MappingUtils.getConnectorRegistry().register(eObjectConnector);
	super.initLocation(container, location, ((InternalEObject)producerEClass).eSetting(
			EcorePackage.eINSTANCE.getENamedElement_Name()));

	final Object element = eObjectConnector.getElement(location);
	assertTrue(element instanceof Setting);
	assertEquals(producerEClass, ((Setting)element).getEObject());
	assertEquals(EcorePackage.eINSTANCE.getENamedElement_Name(), ((Setting)element)
			.getEStructuralFeature());
	assertEquals("Producer", ((Setting)element).get(true));
	assertEquals(EcorePackage.eINSTANCE.getENamedElement_Name().getName(), location.getFeatureName());

	MappingUtils.getConnectorRegistry().unregister(testEObjectContainerConnector);
	MappingUtils.getConnectorRegistry().unregister(eObjectConnector);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:38,代码来源:EObjectConnectorTests.java

示例4: getLocationEObject

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void getLocationEObject() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
			.eContents()));
	copier.copyReferences();
	final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
	final Resource resource = createResource("test.xmi");
	resource.getContents().addAll(eObjects);
	container.setResource(resource);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
	final IEObjectLocation location = new TestEObjectLocation();
	location.setContainer(container);
	container.getContents().add(location);

	final TestEObjectContainerConnector connector = new TestEObjectContainerConnector();
	MappingUtils.getConnectorRegistry().register(connector);
	super.initLocation(container, location, producerEClass);

	assertEquals(location, super.getLocation(container, producerEClass));
	assertEquals(null, super.getLocation(container, ((InternalEObject)producerEClass).eSetting(
			EcorePackage.eINSTANCE.getENamedElement_Name())));

	MappingUtils.getConnectorRegistry().unregister(connector);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:31,代码来源:EObjectConnectorTests.java

示例5: getLocationSetting

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void getLocationSetting() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
			.eContents()));
	final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
	copier.copyReferences();
	final Resource resource = createResource("test.xmi");
	resource.getContents().addAll(eObjects);
	container.setResource(resource);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
	final IEObjectLocation location = new TestEObjectLocation();
	location.setContainer(container);
	container.getContents().add(location);

	final TestEObjectContainerConnector connector = new TestEObjectContainerConnector();
	MappingUtils.getConnectorRegistry().register(connector);
	super.initLocation(container, location, ((InternalEObject)producerEClass).eSetting(
			EcorePackage.eINSTANCE.getENamedElement_Name()));

	assertEquals(null, super.getLocation(container, producerEClass));
	assertEquals(location, super.getLocation(container, ((InternalEObject)producerEClass).eSetting(
			EcorePackage.eINSTANCE.getENamedElement_Name())));

	MappingUtils.getConnectorRegistry().unregister(connector);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:32,代码来源:EObjectConnectorTests.java

示例6: updateEObjects

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjects() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(IEObjectLocation.class,
			new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
	copier.copyReferences();
	final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
	final Resource initialResource = createResource("initialResource");
	container.setResource(initialResource);
	initialResource.getContents().addAll(testEObjects);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
	final IEObjectLocation location = createEObjectLocation(copier, container);

	final EObject expectedEObject = copier.get(original[0]);
	final EStructuralFeature expectedFeature = (EStructuralFeature)original[1];
	final Object expectedValue;
	if (original[2] instanceof EObject) {
		expectedValue = copier.get(original[2]);
	} else {
		expectedValue = original[2];
	}

	List<EObject> newEObjects = testEObjects;
	final Resource newResource = createResource("newResource");
	newResource.getContents().addAll(newEObjects);

	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
	container.setResource(newResource);

	assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:38,代码来源:EObjectConnectorParametrizedTests.java

示例7: updateEObjectsPlusShift

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsPlusShift() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(IEObjectLocation.class,
			new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
	copier.copyReferences();
	final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
	final Resource initialResource = createResource("initialResource");
	container.setResource(initialResource);
	initialResource.getContents().addAll(testEObjects);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
	final IEObjectLocation location = createEObjectLocation(copier, container);

	final EObject expectedEObject = copier.get(original[0]);
	final EStructuralFeature expectedFeature = (EStructuralFeature)original[1];
	final Object expectedValue;
	if (original[2] instanceof EObject) {
		expectedValue = copier.get(original[2]);
	} else {
		expectedValue = original[2];
	}

	List<EObject> newEObjects = new ArrayList<EObject>(MappingPackage.eINSTANCE.getEClassifiers());
	newEObjects.addAll(testEObjects);
	final Resource newResource = createResource("newResource");
	newResource.getContents().addAll(newEObjects);

	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
	container.setResource(newResource);

	assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:39,代码来源:EObjectConnectorParametrizedTests.java

示例8: updateEObjectsMinusShift

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsMinusShift() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(IEObjectLocation.class,
			new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
	copier.copyReferences();
	final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
	final Resource initialResource = createResource("initialResource");
	container.setResource(initialResource);
	initialResource.getContents().addAll(testEObjects);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
	final IEObjectLocation location = createEObjectLocation(copier, container);

	final EObject expectedEObject = copier.get(original[0]);
	final EStructuralFeature expectedFeature = (EStructuralFeature)original[1];
	final Object expectedValue;
	if (original[2] instanceof EObject) {
		expectedValue = copier.get(original[2]);
	} else {
		expectedValue = original[2];
	}

	List<EObject> newEObjects = new ArrayList<EObject>(testEObjects);
	newEObjects.remove(0);
	newEObjects.remove(0);
	final Resource newResource = createResource("newResource");
	newResource.getContents().addAll(newEObjects);

	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
	container.setResource(newResource);

	assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:40,代码来源:EObjectConnectorParametrizedTests.java

示例9: updateEObjectsRemoved

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsRemoved() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(IEObjectLocation.class,
			new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
	copier.copyReferences();
	final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
	final Resource initialResource = createResource("initialResource");
	container.setResource(initialResource);
	initialResource.getContents().addAll(testEObjects);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
	final IEObjectLocation location = createEObjectLocation(copier, container);

	final EObject expectedEObject = null;
	final EStructuralFeature expectedFeature = null;
	final Object expectedValue = null;

	List<EObject> newEObjects = testEObjects;
	if (testEObjects.contains(copier.get(original[0]))) {
		testEObjects.remove(copier.get(original[0]));
	} else {
		EcoreUtil.delete(copier.get(original[0]));
	}
	final Resource newResource = createResource("newResource");
	newResource.getContents().addAll(newEObjects);

	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
	container.setResource(newResource);

	assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:38,代码来源:EObjectConnectorParametrizedTests.java

示例10: updateEObjectsPlusShiftRemoved

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsPlusShiftRemoved() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(IEObjectLocation.class,
			new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
	copier.copyReferences();
	final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
	final Resource initialResource = createResource("initialResource");
	container.setResource(initialResource);
	initialResource.getContents().addAll(testEObjects);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
	final IEObjectLocation location = createEObjectLocation(copier, container);

	final EObject expectedEObject = null;
	final EStructuralFeature expectedFeature = null;
	final Object expectedValue = null;

	List<EObject> newEObjects = testEObjects;
	if (testEObjects.contains(copier.get(original[0]))) {
		testEObjects.remove(copier.get(original[0]));
	} else {
		EcoreUtil.delete(copier.get(original[0]));
	}

	newEObjects.addAll(0, MappingPackage.eINSTANCE.getEClassifiers());
	final Resource newResource = createResource("newResource");
	newResource.getContents().addAll(newEObjects);

	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
	container.setResource(newResource);

	assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:40,代码来源:EObjectConnectorParametrizedTests.java

示例11: updateEObjectsMinusShiftRemoved

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsMinusShiftRemoved() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(IEObjectLocation.class,
			new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
	copier.copyReferences();
	final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
	final Resource initialResource = createResource("initialResource");
	container.setResource(initialResource);
	initialResource.getContents().addAll(testEObjects);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
	final IEObjectLocation location = createEObjectLocation(copier, container);

	final EObject expectedEObject = null;
	final EStructuralFeature expectedFeature = null;
	final Object expectedValue = null;

	List<EObject> newEObjects = testEObjects;
	if (testEObjects.contains(copier.get(original[0]))) {
		testEObjects.remove(copier.get(original[0]));
	} else {
		EcoreUtil.delete(copier.get(original[0]));
	}

	newEObjects.remove(0);
	newEObjects.remove(0);
	final Resource newResource = createResource("newResource");
	newResource.getContents().addAll(newEObjects);

	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
	container.setResource(newResource);

	assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:41,代码来源:EObjectConnectorParametrizedTests.java

示例12: addToCopier

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
private static void addToCopier(Copier copier, Resource r, String metamodelName,
		MetamodelNamespace ns) {
	copier.copyAll(ns.getResource().getContents());
	copier.copyReferences();

	EPackage newRoot = getRoot(metamodelName, ns.getResource(), copier);
	r.getContents().add(newRoot);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:9,代码来源:SourceMetamodelsData.java

示例13: extend

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
/**
 * Copies everything that is not already in the errorMM  from the languageMM.
 */
public void extend(EPackage errorMM, MetaModel effectiveMM, MetaModel languageMM) {
	System.out.println("Using 'Full Metamodel' strategy");
	
	Copier copier = new Copier();
	
	for (EClassifier lc : languageMM.getEClassifiers()) {
		EClassifier errorClassifier = errorMM.getEClassifier(lc.getName());
		if ( errorClassifier == null ) {
			EClassifier newClass = (EClassifier) copier.copy(lc);
			errorMM.getEClassifiers().add(newClass);
			continue;
		}
		
		// Now map lc to errorClassifier in the copier in case they need to be resolved
		copier.put(lc, errorClassifier);
		
		if ( errorClassifier instanceof EClass ){
			EClass errorClass = (EClass) errorClassifier;
			EClass langClass  = (EClass) lc;
			for (EStructuralFeature f : langClass.getEStructuralFeatures()) {
				if ( errorClass.getEStructuralFeature(f.getName()) == null ) {
					EStructuralFeature newFeature = (EStructuralFeature) copier.copy(f);
					errorClass.getEStructuralFeatures().add(newFeature);
				} else {
					copier.put(f, errorClass.getEStructuralFeature(f.getName()));
				}
			}
		}
	}
	
	
	copier.copyReferences();

	removeUnnecessaryElements(errorMM);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:39,代码来源:FullMetamodelStrategy.java

示例14: copy

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
/**
 * Copies the collection.
 * 
 * @param <T>
 *            a collection type
 * @return the copied collection instance
 */
@SuppressWarnings("unchecked")
public <T extends IdEObjectCollection> T copy() {
	final Copier copier = new IdEObjectCollectionCopier();
	final T result = (T) copier.copy(this);
	((IdEObjectCollectionImpl) result).cachesInitialized = true;
	copier.copyReferences();
	return result;
}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:16,代码来源:IdEObjectCollectionImpl.java

示例15: createCreateDeleteOperation

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
/**
 * Create a CreateDeleteOperation.
 * 
 * @param modelElement
 *            the model element to delete or create
 * @param delete
 *            whether the element is deleted or created
 * @return the operation
 */
private CreateDeleteOperation createCreateDeleteOperation(EObject modelElement, boolean delete) {
	final CreateDeleteOperation createDeleteOperation = OperationsFactory.eINSTANCE.createCreateDeleteOperation();
	createDeleteOperation.setDelete(delete);
	final EObject element = modelElement;

	final List<EObject> allContainedModelElements = ModelUtil.getAllContainedModelElementsAsList(element, false);
	allContainedModelElements.add(element);

	final Copier copier = new Copier(true, false);
	final EObject copiedElement = copier.copy(element);
	copier.copyReferences();

	final List<EObject> copiedAllContainedModelElements = ModelUtil.getAllContainedModelElementsAsList(
		copiedElement,
		false);
	copiedAllContainedModelElements.add(copiedElement);

	for (int i = 0; i < allContainedModelElements.size(); i++) {
		final EObject child = allContainedModelElements.get(i);

		if (ModelUtil.isIgnoredDatatype(child)) {
			continue;
		}

		final EObject copiedChild = copiedAllContainedModelElements.get(i);
		final ModelElementId childId = collection.getModelElementId(child);

		((CreateDeleteOperationImpl) createDeleteOperation).getEObjectToIdMap().put(copiedChild, childId);
	}

	createDeleteOperation.setModelElement(copiedElement);
	createDeleteOperation.setModelElementId(collection.getModelElementId(modelElement));

	createDeleteOperation.setClientDate(new Date());
	return createDeleteOperation;
}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:46,代码来源:OperationRecorder.java


注:本文中的org.eclipse.emf.ecore.util.EcoreUtil.Copier.copyReferences方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。