Java 类org.eclipse.xtext.resource.FileExtensionProvider 实例源码

项目:xtext-core    文件:ResourceServiceProviderServiceLoader.java   
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;
}
项目:n4js    文件:N4JSXParseHelper.java   
private void setFileExtension(String ext) {
    FileExtensionProvider dummy = new FileExtensionProvider() {
        {
            setExtensions(ext);
        }
    };
    resourceHelper.setFileExtensionProvider(dummy);
}
项目:n4js    文件:N4JSParseHelper.java   
private void setFileExtension(String ext) {
    FileExtensionProvider dummy = new FileExtensionProvider() {
        {
            setExtensions(ext);
        }
    };
    resourceHelper.setFileExtensionProvider(dummy);
}
项目:xtext-core    文件:WrappingInjectorProvider.java   
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);
    }
}
项目:n4js    文件:XpectN4JSES5TranspilerHelper.java   
ReadOutWorkspaceConfiguration(FileSetupContext ctx, IN4JSCore core,
        FileExtensionProvider fileExtensionProvider) {
    super(ctx, core);
    this.fileExtensionProvider = fileExtensionProvider;
}
项目:xtext-core    文件:ResourceHelper.java   
@Inject
public void setFileExtensionProvider(FileExtensionProvider extensionProvider) {
    fileExtension = extensionProvider.getPrimaryFileExtension();
}
项目:xtext-core    文件:ParseHelper.java   
@Inject
public void setFileExtensionProvider(FileExtensionProvider extensionProvider) {
    fileExtension = extensionProvider.getPrimaryFileExtension();
}
项目:dsl-devkit    文件:AbstractCheckTestCase.java   
public String getFileExtension() {
  return get(FileExtensionProvider.class).getFileExtensions().iterator().next();
}
项目:xsemantics    文件:AbstractOutlineWorkbenchTest.java   
@Inject
public void setFileExtensionProvider(FileExtensionProvider extensionProvider) {
    fileExtension = extensionProvider.getPrimaryFileExtension();
}
项目:dsl-devkit    文件:AbstractXtextTestUtil.java   
/**
 * File extension associated with the instance's grammar.
 *
 * @return grammar specific file extension
 */
public String getFileExtension() {
  return get(FileExtensionProvider.class).getPrimaryFileExtension();
}