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);
}
}
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);
}
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);
}
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);
}
}
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);
}
}
Aggregations