Search in sources :

Example 1 with DelegatingIAllContainerAdapter

use of org.eclipse.xtext.resource.containers.DelegatingIAllContainerAdapter in project xtext-core by eclipse.

the class RuntimeResourceSetInitializer method getInitializedResourceSet.

public ResourceSet getInitializedResourceSet(List<String> pathes, UriFilter filter) {
    ResourceSet resourceSet = resourceSetProvider.get();
    Multimap<String, URI> pathToUriMap = getPathToUriMap(pathes, filter);
    IAllContainersState containersState = factory.getContainersState(pathes, pathToUriMap);
    resourceSet.eAdapters().add(new DelegatingIAllContainerAdapter(containersState));
    for (URI uri : pathToUriMap.values()) {
        resourceSet.createResource(uri);
    }
    return resourceSet;
}
Also used : IAllContainersState(org.eclipse.xtext.resource.containers.IAllContainersState) DelegatingIAllContainerAdapter(org.eclipse.xtext.resource.containers.DelegatingIAllContainerAdapter) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) URI(org.eclipse.emf.common.util.URI)

Example 2 with DelegatingIAllContainerAdapter

use of org.eclipse.xtext.resource.containers.DelegatingIAllContainerAdapter 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)

Example 3 with DelegatingIAllContainerAdapter

use of org.eclipse.xtext.resource.containers.DelegatingIAllContainerAdapter in project xtext-eclipse by eclipse.

the class PersistableResourceDescriptionsTest method createResourceSet.

public ResourceSet createResourceSet() {
    ResourceSetImpl resourceSetImpl = new ResourceSetImpl();
    resourceSetImpl.setURIConverter(uriConverter);
    resourceSetImpl.eAdapters().add(new DelegatingIAllContainerAdapter(new IAllContainersState() {

        @Override
        public List<String> getVisibleContainerHandles(String handle) {
            return null;
        }

        @Override
        public Collection<URI> getContainedURIs(String containerHandle) {
            return null;
        }

        @Override
        public String getContainerHandle(URI uri) {
            return null;
        }

        @Override
        public boolean isEmpty(String containerHandle) {
            return true;
        }
    }));
    return resourceSetImpl;
}
Also used : DelegatingIAllContainerAdapter(org.eclipse.xtext.resource.containers.DelegatingIAllContainerAdapter) IAllContainersState(org.eclipse.xtext.resource.containers.IAllContainersState) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) URI(org.eclipse.emf.common.util.URI)

Aggregations

DelegatingIAllContainerAdapter (org.eclipse.xtext.resource.containers.DelegatingIAllContainerAdapter)3 URI (org.eclipse.emf.common.util.URI)2 IAllContainersState (org.eclipse.xtext.resource.containers.IAllContainersState)2 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)1 OrderedResourceDescriptionsData (org.eclipse.n4js.resource.OrderedResourceDescriptionsData)1 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)1