Package org.eclipse.xtext.parser
Class EclipseProjectPropertiesEncodingProvider
- java.lang.Object
-
- org.eclipse.xtext.parser.IEncodingProvider.Runtime
-
- org.eclipse.xtext.parser.EclipseProjectPropertiesEncodingProvider
-
- All Implemented Interfaces:
IEncodingProvider
public class EclipseProjectPropertiesEncodingProvider extends IEncodingProvider.Runtime
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. Parts of the implementation are copied fromEclipsePreferences.- Since:
- 2.8
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.xtext.parser.IEncodingProvider
IEncodingProvider.Runtime
-
-
Constructor Summary
Constructors Constructor Description EclipseProjectPropertiesEncodingProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetEncoding(org.eclipse.emf.common.util.URI uri)Returns the encoding that should be used to read a resource from the given uri.protected java.lang.StringgetFromProperties(org.eclipse.emf.common.util.URI uri)protected java.lang.StringgetValue(java.util.Properties properties, org.eclipse.emf.common.util.URI resourceUri, java.lang.String prefix)protected java.util.PropertiesloadProperties(org.eclipse.emf.common.util.URI projectURI)-
Methods inherited from class org.eclipse.xtext.parser.IEncodingProvider.Runtime
getDefaultEncoding, setDefaultEncoding
-
-
-
-
Method Detail
-
getEncoding
public java.lang.String getEncoding(org.eclipse.emf.common.util.URI uri)
Description copied from interface:IEncodingProviderReturns the encoding that should be used to read a resource from the given uri. If the uri isnull, the default encoding for the language is returned. At runtime, the default encoding was either configured externally or it is obtained from the classCharset. In the UI environment, the encoding should usually be read from the workspace metadata.- Specified by:
getEncodingin interfaceIEncodingProvider- Overrides:
getEncodingin classIEncodingProvider.Runtime- Parameters:
uri- the uri of the specific resource ornullto obtain the default encoding.
-
getFromProperties
protected java.lang.String getFromProperties(org.eclipse.emf.common.util.URI uri) throws java.io.IOException- Throws:
java.io.IOException
-
loadProperties
protected java.util.Properties loadProperties(org.eclipse.emf.common.util.URI projectURI) throws java.io.IOException- Throws:
java.io.IOException
-
getValue
protected java.lang.String getValue(java.util.Properties properties, org.eclipse.emf.common.util.URI resourceUri, java.lang.String prefix)
-
-