Search in sources :

Example 6 with FileExtensionProvider

use of org.eclipse.xtext.resource.FileExtensionProvider in project smarthome by eclipse.

the class RegistryProvider method register.

private void register(IResourceServiceProvider.Registry registry, Injector injector) {
    IResourceServiceProvider resourceServiceProvider = injector.getInstance(IResourceServiceProvider.class);
    FileExtensionProvider extensionProvider = injector.getInstance(FileExtensionProvider.class);
    for (String ext : extensionProvider.getFileExtensions()) {
        if (registry.getExtensionToFactoryMap().containsKey(ext)) {
            if (extensionProvider.getPrimaryFileExtension() == ext) {
                registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider);
            }
        } else {
            registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider);
        }
        IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, resourceFactory);
    }
}
Also used : IResourceServiceProvider(org.eclipse.xtext.resource.IResourceServiceProvider) FileExtensionProvider(org.eclipse.xtext.resource.FileExtensionProvider) IResourceFactory(org.eclipse.xtext.resource.IResourceFactory)

Aggregations

FileExtensionProvider (org.eclipse.xtext.resource.FileExtensionProvider)6 IResourceFactory (org.eclipse.xtext.resource.IResourceFactory)3 IResourceServiceProvider (org.eclipse.xtext.resource.IResourceServiceProvider)3