mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 16:58:56 +00:00
[xtext][encoding] Make backwards binding of encoding provider backwards compatible
Also mark the stateful instance as a singleton. Change-Id: Ic4e20432a228b5c94b58c81f1888feed65932ab0
This commit is contained in:
parent
24ff1ee0fb
commit
d797a9e26c
2 changed files with 11 additions and 1 deletions
|
@ -17,6 +17,8 @@ import java.util.Properties;
|
|||
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Use this class to retrieve resource encodings from Eclipse project properties. The provider can be used
|
||||
* without a running Eclipse context, but depends on resources being stored in Eclipse projects.
|
||||
|
@ -25,6 +27,7 @@ import org.eclipse.emf.common.util.URI;
|
|||
* @author Miro Spoenemann - Initial contribution and API
|
||||
* @since 2.8
|
||||
*/
|
||||
@Singleton
|
||||
public class EclipseProjectPropertiesEncodingProvider extends IEncodingProvider.Runtime {
|
||||
|
||||
private static final String PROPERTIES_DIRNAME = ".settings";
|
||||
|
|
|
@ -205,7 +205,14 @@ public abstract class DefaultRuntimeModule extends AbstractGenericModule {
|
|||
}
|
||||
|
||||
public void configureRuntimeEncodingProvider(Binder binder) {
|
||||
binder.bind(IEncodingProvider.class).annotatedWith(DispatchingProvider.Runtime.class).to(EclipseProjectPropertiesEncodingProvider.class);
|
||||
binder.bind(IEncodingProvider.class).annotatedWith(DispatchingProvider.Runtime.class).to(IEncodingProvider.Runtime.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8
|
||||
*/
|
||||
public Class<? extends IEncodingProvider.Runtime> bindRuntimeEncodingProvider() {
|
||||
return EclipseProjectPropertiesEncodingProvider.class;
|
||||
}
|
||||
|
||||
public Class<? extends Provider<IEncodingProvider>> provideIEncodingProvider() {
|
||||
|
|
Loading…
Reference in a new issue