Search in sources :

Example 1 with OrderedResourceDescriptionsData

use of org.eclipse.n4js.resource.OrderedResourceDescriptionsData in project n4js by eclipse.

the class N4JSRuntimeCore method installIndex.

private void installIndex(ResourceSet resourceSet) {
    // Fill index
    ResourceDescriptionsData index = new OrderedResourceDescriptionsData(Collections.<IResourceDescription>emptyList());
    List<Resource> resources = Lists.newArrayList(resourceSet.getResources());
    for (Resource resource : resources) {
        index(resource, resource.getURI(), index);
    }
    Adapter existing = EcoreUtil.getAdapter(resourceSet.eAdapters(), ResourceDescriptionsData.class);
    if (existing != null) {
        resourceSet.eAdapters().remove(existing);
    }
    ResourceDescriptionsData.ResourceSetAdapter.installResourceDescriptionsData(resourceSet, index);
}
Also used : ResourceDescriptionsData(org.eclipse.xtext.resource.impl.ResourceDescriptionsData) OrderedResourceDescriptionsData(org.eclipse.n4js.resource.OrderedResourceDescriptionsData) OrderedResourceDescriptionsData(org.eclipse.n4js.resource.OrderedResourceDescriptionsData) Resource(org.eclipse.emf.ecore.resource.Resource) Adapter(org.eclipse.emf.common.notify.Adapter)

Example 2 with OrderedResourceDescriptionsData

use of org.eclipse.n4js.resource.OrderedResourceDescriptionsData in project n4js by eclipse.

the class N4HeadlessCompiler method createResourceSet.

/**
 * Creates the common resource set to use during compilation. Installs a light weight index.
 *
 * @return the resource set
 */
private ResourceSet createResourceSet() {
    // TODO try to reuse code from IN4JSCore.createResourceSet
    XtextResourceSet resourceSet = xtextResourceSetProvider.get();
    resourceSet.setClasspathURIContext(classLoader);
    // Install containerState as adapter.
    resourceSet.eAdapters().add(new DelegatingIAllContainerAdapter(rsbAcs));
    // Install a lightweight index.
    OrderedResourceDescriptionsData index = new OrderedResourceDescriptionsData(Collections.emptyList());
    ResourceDescriptionsData.ResourceSetAdapter.installResourceDescriptionsData(resourceSet, index);
    return resourceSet;
}
Also used : DelegatingIAllContainerAdapter(org.eclipse.xtext.resource.containers.DelegatingIAllContainerAdapter) XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) OrderedResourceDescriptionsData(org.eclipse.n4js.resource.OrderedResourceDescriptionsData)

Aggregations

OrderedResourceDescriptionsData (org.eclipse.n4js.resource.OrderedResourceDescriptionsData)2 Adapter (org.eclipse.emf.common.notify.Adapter)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)1 DelegatingIAllContainerAdapter (org.eclipse.xtext.resource.containers.DelegatingIAllContainerAdapter)1 ResourceDescriptionsData (org.eclipse.xtext.resource.impl.ResourceDescriptionsData)1