Class 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 from EclipsePreferences.
    Since:
    2.8
    • Constructor Detail

      • EclipseProjectPropertiesEncodingProvider

        public EclipseProjectPropertiesEncodingProvider()
    • Method Detail

      • getEncoding

        public java.lang.String getEncoding​(org.eclipse.emf.common.util.URI uri)
        Description copied from interface: IEncodingProvider
        Returns the encoding that should be used to read a resource from the given uri. If the uri is null, the default encoding for the language is returned. At runtime, the default encoding was either configured externally or it is obtained from the class Charset. In the UI environment, the encoding should usually be read from the workspace metadata.
        Specified by:
        getEncoding in interface IEncodingProvider
        Overrides:
        getEncoding in class IEncodingProvider.Runtime
        Parameters:
        uri - the uri of the specific resource or null to 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)