本文整理汇总了Java中org.eclipse.xtext.parser.IEncodingProvider类的典型用法代码示例。如果您正苦于以下问题:Java IEncodingProvider类的具体用法?Java IEncodingProvider怎么用?Java IEncodingProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEncodingProvider类属于org.eclipse.xtext.parser包,在下文中一共展示了IEncodingProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: configure
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
@Override
protected void configure() {
this.<Resource.Factory>bind(Resource.Factory.class).to(JavaResource.Factory.class);
this.<IResourceValidator>bind(IResourceValidator.class).toInstance(IResourceValidator.NULL);
this.<IGenerator>bind(IGenerator.class).to(IGenerator.NullGenerator.class);
this.<IEncodingProvider>bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class);
this.<IResourceServiceProvider>bind(IResourceServiceProvider.class).to(JavaResourceServiceProvider.class);
this.<IContainer.Manager>bind(IContainer.Manager.class).to(SimpleResourceDescriptionsBasedContainerManager.class);
this.<IResourceDescription.Manager>bind(IResourceDescription.Manager.class).to(JavaResourceDescriptionManager.class);
this.<IQualifiedNameProvider>bind(IQualifiedNameProvider.class).to(JvmIdentifiableQualifiedNameProvider.class);
this.<String>bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("java");
this.<String>bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.java.Java");
this.<IJvmTypeProvider.Factory>bind(IJvmTypeProvider.Factory.class).to(ClasspathTypeProviderFactory.class);
this.<ClassLoader>bind(ClassLoader.class).toInstance(JavaSourceLanguageRuntimeModule.class.getClassLoader());
this.<IReferableElementsUnloader>bind(IReferableElementsUnloader.class).to(IReferableElementsUnloader.GenericUnloader.class);
final IResourceDescriptionsProvider _function = (ResourceSet it) -> {
return ChunkedResourceDescriptions.findInEmfObject(it);
};
this.<IResourceDescriptionsProvider>bind(IResourceDescriptionsProvider.class).toInstance(_function);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:21,代码来源:JavaSourceLanguageRuntimeModule.java
示例2: initializeEncoding
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
protected void initializeEncoding() {
final IResourceServiceProvider.Registry serviceProviderRegistry = IResourceServiceProvider.Registry.INSTANCE;
Object _get = serviceProviderRegistry.getExtensionToFactoryMap().get("xtext");
final IResourceServiceProvider serviceProvider = ((IResourceServiceProvider) _get);
String _elvis = null;
if (this.grammarEncoding != null) {
_elvis = this.grammarEncoding;
} else {
String _encoding = this.configuration.getCode().getEncoding();
_elvis = _encoding;
}
final String encoding = _elvis;
if (((serviceProvider != null) && (encoding != null))) {
final IEncodingProvider encodingProvider = serviceProvider.<IEncodingProvider>get(IEncodingProvider.class);
if ((encodingProvider instanceof IEncodingProvider.Runtime)) {
((IEncodingProvider.Runtime)encodingProvider).setDefaultEncoding(encoding);
}
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:XtextGenerator.java
示例3: getCharset
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
protected String getCharset(final Resource resource) {
String _xblockexpression = null;
{
final IEncodingProvider xtextEncodingProvider = this.registry.getResourceServiceProvider(resource.getURI()).<IEncodingProvider>get(IEncodingProvider.class);
String _xifexpression = null;
if ((xtextEncodingProvider != null)) {
return xtextEncodingProvider.getEncoding(resource.getURI());
} else {
String _xifexpression_1 = null;
if ((resource instanceof XMLResource)) {
_xifexpression_1 = ((XMLResource)resource).getEncoding();
} else {
_xifexpression_1 = Charset.defaultCharset().toString();
}
_xifexpression = _xifexpression_1;
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:21,代码来源:ChangeConverter.java
示例4: configure
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
binder.bind(IResourceValidator.class).to(SCTResourceValidatorImpl.class);
binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("sct");
binder.bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class);
binder.bind(IQualifiedNameProvider.class).to(StextNameProvider.class);
binder.bind(org.eclipse.jface.viewers.ILabelProvider.class)
.annotatedWith(org.eclipse.xtext.ui.resource.ResourceServiceDescriptionLabelProvider.class)
.to(DefaultDescriptionLabelProvider.class);
binder.bind(IDefaultResourceDescriptionStrategy.class).to(SCTResourceDescriptionStrategy.class);
binder.bind(MarkerCreator.class).to(SCTMarkerCreator.class);
binder.bind(MarkerTypeProvider.class).to(SCTMarkerTypeProvider.class);
binder.bind(IDiagnosticConverter.class).to(SCTDiagnosticConverterImpl.class);
binder.bind(IURIEditorOpener.class).annotatedWith(LanguageSpecific.class).to(SCTFileEditorOpener.class);
binder.bind(IMarkerContributor.class).to(TaskMarkerContributor.class);
binder.bind(ITaskFinder.class).to(DomainSpecificTaskFinder.class);
binder.bind(TaskMarkerCreator.class).to(SCTTaskMarkerCreator.class);
binder.bind(TaskMarkerTypeProvider.class).to(SCTTaskMarkerTypeProvider.class);
}
开发者ID:Yakindu,项目名称:statecharts,代码行数:22,代码来源:SCTXtextIntegrationModule.java
示例5: configure
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
@Override
protected void configure() {
this.<IResourceDescriptions>bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(ResourceSetBasedResourceDescriptions.class);
this.<IResourceDescriptions>bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE)).to(ResourceSetBasedResourceDescriptions.class);
this.<IResourceDescriptions>bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
this.<IResourceDescriptions>bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
this.<IIssueHandler>bind(IIssueHandler.class).to(this.bindIIssueHandler());
this.<AbstractFileSystemAccess>bind(AbstractFileSystemAccess.class).to(this.bindJavaIoFileSystemAccess());
this.<IJavaCompiler>bind(IJavaCompiler.class).to(this.bindIJavaCompiler());
this.<IEncodingProvider>bind(IEncodingProvider.class).to(this.bindIEncodingProvider());
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:12,代码来源:StandaloneBuilderModule.java
示例6: fileEncodingSetup
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
public void fileEncodingSetup(final Collection<LanguageAccess> langs, final String encoding) {
for (final LanguageAccess lang : langs) {
IEncodingProvider _encodingProvider = lang.getEncodingProvider();
final IEncodingProvider provider = _encodingProvider;
boolean _matched = false;
if (provider instanceof IEncodingProvider.Runtime) {
_matched=true;
((IEncodingProvider.Runtime)provider).setDefaultEncoding(encoding);
}
if (!_matched) {
this.forceDebugLog((((("Couldn\'t set encoding \'" + encoding) + "\' for provider \'") + provider) +
"\'. Only subclasses of IEncodingProvider.Runtime are supported."));
}
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:16,代码来源:StandaloneBuilder.java
示例7: JavaIoFileSystemAccess
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
/**
* @since 2.4
*/
public JavaIoFileSystemAccess(IResourceServiceProvider.Registry registry, IEncodingProvider encodingProvider,
TraceFileNameProvider traceFileNameProvider, TraceRegionSerializer traceRegionSerializer) {
this.registry = registry;
this.encodingProvider = encodingProvider;
this.traceFileNameProvider = traceFileNameProvider;
this.traceSerializer = traceRegionSerializer;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:11,代码来源:JavaIoFileSystemAccess.java
示例8: configureIEncodingProvider
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
public void configureIEncodingProvider(final Binder binder) {
AnnotatedBindingBuilder<IEncodingProvider> _bind = binder.<IEncodingProvider>bind(IEncodingProvider.class);
IEncodingProvider.Runtime _runtime = new IEncodingProvider.Runtime();
final Procedure1<IEncodingProvider.Runtime> _function = (IEncodingProvider.Runtime it) -> {
it.setDefaultEncoding(this.code.getEncoding());
};
IEncodingProvider.Runtime _doubleArrow = ObjectExtensions.<IEncodingProvider.Runtime>operator_doubleArrow(_runtime, _function);
_bind.toInstance(_doubleArrow);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:10,代码来源:DefaultGeneratorModule.java
示例9: testEncoding
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
@Test
public void testEncoding() throws Exception {
File file = null;
FileInputStream fileInputStream = null;
try {
JavaIoFileSystemAccess fileSystemAccess = new JavaIoFileSystemAccess(
IResourceServiceProvider.Registry.INSTANCE, new IEncodingProvider() {
@Override
public String getEncoding(URI uri) {
return "ISO-8859-1";
}
});
File tmpDir = configureFileSystemAccess(fileSystemAccess);
String contents = "g�rkenbr�d";
fileSystemAccess.generateFile("test.txt", contents);
file = new File(tmpDir, "test.txt");
assertTrue(file.exists());
fileInputStream = new FileInputStream(file);
byte[] buffer = new byte[512];
int read = fileInputStream.read(buffer);
String utfString = new String(buffer, 0, read, "UTF-8");
assertFalse(equal(contents, utfString));
String isoString = new String(buffer, 0, read, "ISO-8859-1");
assertEquals(contents, isoString);
} finally {
if (fileInputStream != null)
fileInputStream.close();
if (file != null)
file.delete();
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:32,代码来源:JavaIoFileSystemAccessTest.java
示例10: testTraceIsCreated
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
@Test
public void testTraceIsCreated() throws Exception {
File file = null;
try {
JavaIoFileSystemAccess fileSystemAccess = new JavaIoFileSystemAccess(
IResourceServiceProvider.Registry.INSTANCE, new IEncodingProvider.Runtime(),
new TraceFileNameProvider(), new TraceRegionSerializer());
File tmpDir = configureFileSystemAccess(fileSystemAccess);
SourceRelativeURI uri = new SourceRelativeURI(URI.createURI("foo/bar"));
CharSequenceTraceWrapper wrapper = new CharSequenceTraceWrapper();
fileSystemAccess.generateFile("tmp/X", wrapper.wrapWithTraceData("XX", uri, 0, 10, 0, 1));
file = new File(tmpDir, "tmp/X");
assertTrue(file.exists());
assertTrue(file.isFile());
assertEquals("XX", fileSystemAccess.readTextFile("tmp/X"));
file = new File(tmpDir, "tmp/.X._trace");
assertTrue(file.exists());
assertTrue(file.isFile());
} finally {
if (file != null)
file.delete();
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:29,代码来源:JavaIoFileSystemAccessTest.java
示例11: setUp
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
with(UnicodeTestLanguageStandaloneSetup.class);
IEncodingProvider.Runtime encodingProvider = get(IEncodingProvider.Runtime.class);
encodingProvider.setDefaultEncoding(getCharsetForTest().name());
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:UnicodeTest.java
示例12: getEncodingProvider
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
public IEncodingProvider getEncodingProvider() {
return resourceServiceProvider.get(Runtime.class);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:4,代码来源:LanguageAccess.java
示例13: bindIEncodingProvider
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
protected Class<? extends IEncodingProvider> bindIEncodingProvider() {
return IEncodingProvider.Runtime.class;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:4,代码来源:StandaloneBuilderModule.java
示例14: getEncodingProvider
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
@Override
public IEncodingProvider getEncodingProvider() {
return this.<IEncodingProvider>get(IEncodingProvider.class);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:5,代码来源:JavaResourceServiceProvider.java
示例15: getEncodingProvider
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
@Override
public IEncodingProvider getEncodingProvider() {
return encodingProvider;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:GenericResourceServiceProvider.java
示例16: bindIEncodingProvider
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
public Class<? extends IEncodingProvider> bindIEncodingProvider() {
return XMLEncodingProvider.class;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:AbstractGenericResourceRuntimeModule.java
示例17: configureRuntimeEncodingProvider
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
public void configureRuntimeEncodingProvider(Binder binder) {
binder.bind(IEncodingProvider.class).annotatedWith(DispatchingProvider.Runtime.class).to(IEncodingProvider.Runtime.class);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:DefaultRuntimeModule.java
示例18: bindRuntimeEncodingProvider
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
/**
* @since 2.8
*/
public Class<? extends IEncodingProvider.Runtime> bindRuntimeEncodingProvider() {
return EclipseProjectPropertiesEncodingProvider.class;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:7,代码来源:DefaultRuntimeModule.java
示例19: provideIEncodingProvider
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
public Class<? extends Provider<IEncodingProvider>> provideIEncodingProvider() {
return IEncodingProviderDispatcher.class;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:DefaultRuntimeModule.java
示例20: getEncodingProvider
import org.eclipse.xtext.parser.IEncodingProvider; //导入依赖的package包/类
@Pure
public IEncodingProvider getEncodingProvider() {
return this.encodingProvider;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:URIBasedFileSystemAccess.java
注:本文中的org.eclipse.xtext.parser.IEncodingProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论