Class FormattingContext

  • All Implemented Interfaces:
    IFormattingContext

    public class FormattingContext
    extends java.lang.Object
    implements IFormattingContext
    Default implementation of IFormattingContext.
    Since:
    3.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Dispose of the formatting context.
      java.lang.String[] getPreferenceKeys()
      Returns the preference keys used for the retrieval of formatting preferences.
      java.lang.Object getProperty​(java.lang.Object key)
      Retrieves the property key from the formatting context
      boolean isBooleanPreference​(java.lang.String key)
      Is this preference key for a boolean preference?
      boolean isDoublePreference​(java.lang.String key)
      Is this preference key for a double preference?
      boolean isFloatPreference​(java.lang.String key)
      Is this preference key for a float preference?
      boolean isIntegerPreference​(java.lang.String key)
      Is this preference key for an integer preference?
      boolean isLongPreference​(java.lang.String key)
      Is this preference key for a long preference?
      boolean isStringPreference​(java.lang.String key)
      Is this preference key for a string preference?
      void mapToStore​(java.util.Map<java.lang.Object,​java.lang.Object> map, IPreferenceStore store)
      Stores the preferences from a map to a preference store.
      void setProperty​(java.lang.Object key, java.lang.Object property)
      Stores the property key in the formatting context.
      void storeToMap​(IPreferenceStore store, java.util.Map<java.lang.Object,​java.lang.Object> map, boolean useDefault)
      Retrieves the preferences from a preference store in a map.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FormattingContext

        public FormattingContext()
    • Method Detail

      • dispose

        public void dispose()
        Description copied from interface: IFormattingContext
        Dispose of the formatting context.

        Must be called after the formatting context has been used in a formatting process.

        Specified by:
        dispose in interface IFormattingContext
      • getPreferenceKeys

        public java.lang.String[] getPreferenceKeys()
        Description copied from interface: IFormattingContext
        Returns the preference keys used for the retrieval of formatting preferences.
        Specified by:
        getPreferenceKeys in interface IFormattingContext
        Returns:
        The preference keys for formatting
      • getProperty

        public java.lang.Object getProperty​(java.lang.Object key)
        Description copied from interface: IFormattingContext
        Retrieves the property key from the formatting context
        Specified by:
        getProperty in interface IFormattingContext
        Parameters:
        key - the key of the property to store in the context. Must be a String.
        Returns:
        the property key if available, null otherwise
      • isBooleanPreference

        public boolean isBooleanPreference​(java.lang.String key)
        Description copied from interface: IFormattingContext
        Is this preference key for a boolean preference?
        Specified by:
        isBooleanPreference in interface IFormattingContext
        Parameters:
        key - the preference key to query its type
        Returns:
        true iff this key is for a boolean preference, false otherwise.
      • isDoublePreference

        public boolean isDoublePreference​(java.lang.String key)
        Description copied from interface: IFormattingContext
        Is this preference key for a double preference?
        Specified by:
        isDoublePreference in interface IFormattingContext
        Parameters:
        key - the preference key to query its type
        Returns:
        true iff this key is for a double preference, false otherwise.
      • isFloatPreference

        public boolean isFloatPreference​(java.lang.String key)
        Description copied from interface: IFormattingContext
        Is this preference key for a float preference?
        Specified by:
        isFloatPreference in interface IFormattingContext
        Parameters:
        key - The preference key to query its type
        Returns:
        true iff this key is for a float preference, false otherwise.
      • isIntegerPreference

        public boolean isIntegerPreference​(java.lang.String key)
        Description copied from interface: IFormattingContext
        Is this preference key for an integer preference?
        Specified by:
        isIntegerPreference in interface IFormattingContext
        Parameters:
        key - The preference key to query its type
        Returns:
        true iff this key is for an integer preference, false otherwise.
      • isLongPreference

        public boolean isLongPreference​(java.lang.String key)
        Description copied from interface: IFormattingContext
        Is this preference key for a long preference?
        Specified by:
        isLongPreference in interface IFormattingContext
        Parameters:
        key - The preference key to query its type
        Returns:
        true iff this key is for a long preference, false otherwise.
      • isStringPreference

        public boolean isStringPreference​(java.lang.String key)
        Description copied from interface: IFormattingContext
        Is this preference key for a string preference?
        Specified by:
        isStringPreference in interface IFormattingContext
        Parameters:
        key - The preference key to query its type
        Returns:
        true iff this key is for a string preference, false otherwise.
      • mapToStore

        public void mapToStore​(java.util.Map<java.lang.Object,​java.lang.Object> map,
                               IPreferenceStore store)
        Description copied from interface: IFormattingContext
        Stores the preferences from a map to a preference store.

        Note that the preference keys returned by IFormattingContext.getPreferenceKeys() must not be used in the preference store. Otherwise the preferences are overwritten.

        Specified by:
        mapToStore in interface IFormattingContext
        Parameters:
        map - Map to retrieve the preferences from
        store - Preference store to store the preferences in
      • setProperty

        public void setProperty​(java.lang.Object key,
                                java.lang.Object property)
        Description copied from interface: IFormattingContext
        Stores the property key in the formatting context.
        Specified by:
        setProperty in interface IFormattingContext
        Parameters:
        key - Key of the property to store in the context. Must be a String.
        property - Property to store in the context. If already present, the new property overwrites the present one.
      • storeToMap

        public void storeToMap​(IPreferenceStore store,
                               java.util.Map<java.lang.Object,​java.lang.Object> map,
                               boolean useDefault)
        Description copied from interface: IFormattingContext
        Retrieves the preferences from a preference store in a map.

        Note that the preference keys returned by IFormattingContext.getPreferenceKeys() must not be used in the map. Otherwise the preferences are overwritten.

        Specified by:
        storeToMap in interface IFormattingContext
        Parameters:
        store - Preference store to retrieve the preferences from
        map - Map to store the preferences in
        useDefault - true if the default preferences should be used, false otherwise