Search in sources :

Example 1 with FileExtensionProvider

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

the class WrappingInjectorProvider method registerFactory.

private void registerFactory(Injector injector) {
    IResourceFactory factory = injector.getInstance(IResourceFactory.class);
    IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
    FileExtensionProvider fileExtensionProvider = injector.getInstance(FileExtensionProvider.class);
    for (String ext : fileExtensionProvider.getFileExtensions()) {
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, factory);
        IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, serviceProvider);
    }
}
Also used : IResourceServiceProvider(org.eclipse.xtext.resource.IResourceServiceProvider) FileExtensionProvider(org.eclipse.xtext.resource.FileExtensionProvider) IResourceFactory(org.eclipse.xtext.resource.IResourceFactory)

Example 2 with FileExtensionProvider

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

the class N4JSParseHelper method setFileExtension.

private void setFileExtension(String ext) {
    FileExtensionProvider dummy = new FileExtensionProvider() {

        {
            setExtensions(ext);
        }
    };
    resourceHelper.setFileExtensionProvider(dummy);
}
Also used : FileExtensionProvider(org.eclipse.xtext.resource.FileExtensionProvider)

Example 3 with FileExtensionProvider

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

the class N4JSXParseHelper method setFileExtension.

private void setFileExtension(String ext) {
    FileExtensionProvider dummy = new FileExtensionProvider() {

        {
            setExtensions(ext);
        }
    };
    resourceHelper.setFileExtensionProvider(dummy);
}
Also used : FileExtensionProvider(org.eclipse.xtext.resource.FileExtensionProvider)

Example 4 with FileExtensionProvider

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

the class WrappingInjectorProvider method registerFactory.

private void registerFactory(Injector injector) {
    IResourceFactory factory = injector.getInstance(IResourceFactory.class);
    IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
    FileExtensionProvider fileExtensionProvider = injector.getInstance(FileExtensionProvider.class);
    for (String ext : fileExtensionProvider.getFileExtensions()) {
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, factory);
        IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, serviceProvider);
    }
}
Also used : IResourceServiceProvider(org.eclipse.xtext.resource.IResourceServiceProvider) FileExtensionProvider(org.eclipse.xtext.resource.FileExtensionProvider) IResourceFactory(org.eclipse.xtext.resource.IResourceFactory)

Example 5 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