use of org.eclipse.xtext.resource.IDerivedStateComputer in project xtext-xtend by eclipse.
the class IndexingTest method doTestResourceDescriptionWithoutGetContents.
private void doTestResourceDescriptionWithoutGetContents(final String input) throws IOException {
XtextResourceSet resourceSet = getResourceSet();
new ClasspathTypeProvider(classLoader, resourceSet, null, null);
final Wrapper<Boolean> wrapper = Wrapper.wrap(Boolean.FALSE);
for (int i = 0; i < 10; i++) {
DerivedStateAwareResource resource = (DerivedStateAwareResource) resourceSet.createResource(URI.createURI("Dummy" + i + ".xtend"));
resource.setDerivedStateComputer(new IDerivedStateComputer() {
@Override
public void installDerivedState(DerivedStateAwareResource resource, boolean preLinkingPhase) {
if (!preLinkingPhase) {
wrapper.set(Boolean.TRUE);
}
derivedStateComputer.installDerivedState(resource, preLinkingPhase);
}
@Override
public void discardDerivedState(DerivedStateAwareResource resource) {
derivedStateComputer.discardDerivedState(resource);
}
});
String actualInput = input;
if (i != 0) {
actualInput = "import C" + (i + 1) + " " + actualInput;
actualInput = "import C" + (i - 1) + " " + actualInput;
}
actualInput = String.format(actualInput, i, i + 1);
resource.load(new StringInputStream(actualInput), null);
}
for (int i = 0; i < 10; i++) {
Resource resource = resourceSet.getResources().get(i);
for (IEObjectDescription description : resourceDescriptionManager.getResourceDescription(resource).getExportedObjects()) {
description.getEObjectOrProxy();
}
}
assertFalse(wrapper.get());
}
Aggregations