use of org.eclipse.xtext.builder.builderState.impl.EObjectDescriptionImpl in project xtext-eclipse by eclipse.
the class BuilderStateUtil method create.
public static EObjectDescriptionImpl create(IEObjectDescription desc) {
EObjectDescriptionImpl objectDescription = (EObjectDescriptionImpl) BuilderStateFactory.eINSTANCE.createEObjectDescription();
objectDescription.setEClass(desc.getEClass());
objectDescription.setFragment(desc.getEObjectURI().fragment());
objectDescription.setName(desc.getName());
for (String key : desc.getUserDataKeys()) {
objectDescription.getUserData().put(key, desc.getUserData(key));
}
return objectDescription;
}
use of org.eclipse.xtext.builder.builderState.impl.EObjectDescriptionImpl in project xtext-eclipse by eclipse.
the class AbstractEMFBasedPersisterTest method createObjectDescription.
public IEObjectDescription createObjectDescription(int idx) {
EObjectDescriptionImpl result = (EObjectDescriptionImpl) BuilderStateFactory.eINSTANCE.createEObjectDescription();
result.setEClass(BuilderStatePackage.eINSTANCE.getEObjectDescription());
result.setFragment("newFragment" + idx);
result.setName(createQualifiedName("name" + idx));
return result;
}
use of org.eclipse.xtext.builder.builderState.impl.EObjectDescriptionImpl in project xtext-xtend by eclipse.
the class BuilderStateUtilBenchmark method createExportedObjects.
private void createExportedObjects(ResourceDescriptionImpl resourceDescription) {
List<IEObjectDescription> list = resourceDescription.getExportedObjects();
for (int i = 0; i < objectDescriptions; i++) {
final int idx = i;
EObjectDescriptionImpl objectDescription = new EObjectDescriptionImpl() {
URI uri = URI.createURI("myURI#myFragment/" + idx);
@Override
public URI getEObjectURI() {
return uri;
}
};
objectDescription.setEClass(BuilderStatePackage.Literals.EOBJECT_DESCRIPTION);
objectDescription.setName(QualifiedName.create("myFragment", String.valueOf(i)));
createUserData(objectDescription);
list.add(objectDescription);
}
}
use of org.eclipse.xtext.builder.builderState.impl.EObjectDescriptionImpl in project xtext-eclipse by eclipse.
the class EObjectDescriptionImplTest method testContainerAndFragmentChange.
@Test
public void testContainerAndFragmentChange() {
EObjectDescriptionImpl objectDescription = (EObjectDescriptionImpl) BuilderStateFactory.eINSTANCE.createEObjectDescription();
objectDescription.setFragment("myFragment");
ResourceDescriptionImpl resourceDescription = (ResourceDescriptionImpl) BuilderStateFactory.eINSTANCE.createResourceDescription();
resourceDescription.getExportedObjects().add(objectDescription);
resourceDescription.setURI(URI.createURI("some.uri"));
assertEquals(URI.createURI("some.uri#myFragment"), objectDescription.getEObjectURI());
resourceDescription.setURI(URI.createURI("some2.uri"));
assertEquals(URI.createURI("some2.uri#myFragment"), objectDescription.getEObjectURI());
objectDescription.setFragment("newFragment");
assertEquals(URI.createURI("some2.uri#newFragment"), objectDescription.getEObjectURI());
}
use of org.eclipse.xtext.builder.builderState.impl.EObjectDescriptionImpl in project xtext-eclipse by eclipse.
the class EObjectDescriptionImplTest method testNoNPE.
@Test
public void testNoNPE() {
EObjectDescriptionImpl objectDescription = (EObjectDescriptionImpl) BuilderStateFactory.eINSTANCE.createEObjectDescription();
objectDescription.setFragment("myFragment");
ResourceDescriptionImpl resourceDescription = (ResourceDescriptionImpl) BuilderStateFactory.eINSTANCE.createResourceDescription();
resourceDescription.getExportedObjects().add(objectDescription);
resourceDescription.setURI(URI.createURI("does.not.matter"));
EClass doesNotExist = EcoreFactory.eINSTANCE.createEClass();
InternalEObject proxy = (InternalEObject) doesNotExist;
proxy.eSetProxyURI(URI.createURI("does.not.exist"));
objectDescription.setEClass(doesNotExist);
assertSame(doesNotExist, objectDescription.getEClass());
assertNull(objectDescription.getEObjectOrProxy());
assertEquals("does.not.matter#myFragment", objectDescription.getEObjectURI().toString());
}
Aggregations