Search in sources :

Example 1 with Manager

use of org.eclipse.xtext.resource.IResourceDescription.Manager in project ow by vtst.

the class ResourceDescriptionLoader method getResourceDescription.

public IResourceDescription getResourceDescription(ResourceSet resourceSet, URI uri) {
    Resource resource = resourceSet.getResource(uri, true);
    if (resource != null) {
        IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(uri);
        if (serviceProvider == null)
            throw new IllegalStateException("No " + IResourceServiceProvider.class.getSimpleName() + " found in registry for uri " + uri);
        final Manager resourceDescriptionManager = serviceProvider.getResourceDescriptionManager();
        if (resourceDescriptionManager == null)
            throw new IllegalStateException("No " + IResourceDescription.Manager.class.getName() + " provided by service provider for URI " + uri);
        return resourceDescriptionManager.getResourceDescription(resource);
    }
    return null;
}
Also used : IResourceServiceProvider(org.eclipse.xtext.resource.IResourceServiceProvider) Resource(org.eclipse.emf.ecore.resource.Resource) Manager(org.eclipse.xtext.resource.IResourceDescription.Manager)

Aggregations

Resource (org.eclipse.emf.ecore.resource.Resource)1 Manager (org.eclipse.xtext.resource.IResourceDescription.Manager)1 IResourceServiceProvider (org.eclipse.xtext.resource.IResourceServiceProvider)1