private IResourceServiceProvider.Registry loadRegistry() { final ResourceServiceProviderRegistryImpl registry = new ResourceServiceProviderRegistryImpl(); for (final ISetup cp : this.setupLoader) { { final Injector injector = cp.createInjectorAndDoEMFRegistration(); final IResourceServiceProvider resourceServiceProvider = injector.<IResourceServiceProvider>getInstance(IResourceServiceProvider.class); final FileExtensionProvider extensionProvider = injector.<FileExtensionProvider>getInstance(FileExtensionProvider.class); Set<String> _fileExtensions = extensionProvider.getFileExtensions(); for (final String ext : _fileExtensions) { boolean _containsKey = registry.getExtensionToFactoryMap().containsKey(ext); if (_containsKey) { String _primaryFileExtension = extensionProvider.getPrimaryFileExtension(); boolean _equals = Objects.equal(_primaryFileExtension, ext); if (_equals) { registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider); } } else { registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider); } } } } return registry; }
private void setFileExtension(String ext) { FileExtensionProvider dummy = new FileExtensionProvider() { { setExtensions(ext); } }; resourceHelper.setFileExtensionProvider(dummy); }
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); } }
ReadOutWorkspaceConfiguration(FileSetupContext ctx, IN4JSCore core, FileExtensionProvider fileExtensionProvider) { super(ctx, core); this.fileExtensionProvider = fileExtensionProvider; }
@Inject public void setFileExtensionProvider(FileExtensionProvider extensionProvider) { fileExtension = extensionProvider.getPrimaryFileExtension(); }
public String getFileExtension() { return get(FileExtensionProvider.class).getFileExtensions().iterator().next(); }
/** * File extension associated with the instance's grammar. * * @return grammar specific file extension */ public String getFileExtension() { return get(FileExtensionProvider.class).getPrimaryFileExtension(); }