Package org.eclipse.jface.text.formatter
Class FormattingContext
- java.lang.Object
-
- org.eclipse.jface.text.formatter.FormattingContext
-
- All Implemented Interfaces:
IFormattingContext
public class FormattingContext extends Object implements IFormattingContext
Default implementation ofIFormattingContext.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description FormattingContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Dispose of the formatting context.String[]getPreferenceKeys()Returns the preference keys used for the retrieval of formatting preferences.ObjectgetProperty(Object key)Retrieves the propertykeyfrom the formatting contextbooleanisBooleanPreference(String key)Is this preference key for a boolean preference?booleanisDoublePreference(String key)Is this preference key for a double preference?booleanisFloatPreference(String key)Is this preference key for a float preference?booleanisIntegerPreference(String key)Is this preference key for an integer preference?booleanisLongPreference(String key)Is this preference key for a long preference?booleanisStringPreference(String key)Is this preference key for a string preference?voidmapToStore(Map<Object,Object> map, IPreferenceStore store)Stores the preferences from a map to a preference store.voidsetProperty(Object key, Object property)Stores the propertykeyin the formatting context.voidstoreToMap(IPreferenceStore store, Map<Object,Object> map, boolean useDefault)Retrieves the preferences from a preference store in a map.
-
-
-
Method Detail
-
dispose
public void dispose()
Description copied from interface:IFormattingContextDispose of the formatting context.Must be called after the formatting context has been used in a formatting process.
- Specified by:
disposein interfaceIFormattingContext
-
getPreferenceKeys
public String[] getPreferenceKeys()
Description copied from interface:IFormattingContextReturns the preference keys used for the retrieval of formatting preferences.- Specified by:
getPreferenceKeysin interfaceIFormattingContext- Returns:
- The preference keys for formatting
-
getProperty
public Object getProperty(Object key)
Description copied from interface:IFormattingContextRetrieves the propertykeyfrom the formatting context- Specified by:
getPropertyin interfaceIFormattingContext- Parameters:
key- the key of the property to store in the context. Must be aString.- Returns:
- the property
keyif available,nullotherwise
-
isBooleanPreference
public boolean isBooleanPreference(String key)
Description copied from interface:IFormattingContextIs this preference key for a boolean preference?- Specified by:
isBooleanPreferencein interfaceIFormattingContext- Parameters:
key- the preference key to query its type- Returns:
trueiff this key is for a boolean preference,falseotherwise.
-
isDoublePreference
public boolean isDoublePreference(String key)
Description copied from interface:IFormattingContextIs this preference key for a double preference?- Specified by:
isDoublePreferencein interfaceIFormattingContext- Parameters:
key- the preference key to query its type- Returns:
trueiff this key is for a double preference,falseotherwise.
-
isFloatPreference
public boolean isFloatPreference(String key)
Description copied from interface:IFormattingContextIs this preference key for a float preference?- Specified by:
isFloatPreferencein interfaceIFormattingContext- Parameters:
key- The preference key to query its type- Returns:
trueiff this key is for a float preference,falseotherwise.
-
isIntegerPreference
public boolean isIntegerPreference(String key)
Description copied from interface:IFormattingContextIs this preference key for an integer preference?- Specified by:
isIntegerPreferencein interfaceIFormattingContext- Parameters:
key- The preference key to query its type- Returns:
trueiff this key is for an integer preference,falseotherwise.
-
isLongPreference
public boolean isLongPreference(String key)
Description copied from interface:IFormattingContextIs this preference key for a long preference?- Specified by:
isLongPreferencein interfaceIFormattingContext- Parameters:
key- The preference key to query its type- Returns:
trueiff this key is for a long preference,falseotherwise.
-
isStringPreference
public boolean isStringPreference(String key)
Description copied from interface:IFormattingContextIs this preference key for a string preference?- Specified by:
isStringPreferencein interfaceIFormattingContext- Parameters:
key- The preference key to query its type- Returns:
trueiff this key is for a string preference,falseotherwise.
-
mapToStore
public void mapToStore(Map<Object,Object> map, IPreferenceStore store)
Description copied from interface:IFormattingContextStores 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:
mapToStorein interfaceIFormattingContext- Parameters:
map- Map to retrieve the preferences fromstore- Preference store to store the preferences in
-
setProperty
public void setProperty(Object key, Object property)
Description copied from interface:IFormattingContextStores the propertykeyin the formatting context.- Specified by:
setPropertyin interfaceIFormattingContext- Parameters:
key- Key of the property to store in the context. Must be aString.property- Property to store in the context. If already present, the new property overwrites the present one.
-
storeToMap
public void storeToMap(IPreferenceStore store, Map<Object,Object> map, boolean useDefault)
Description copied from interface:IFormattingContextRetrieves 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:
storeToMapin interfaceIFormattingContext- Parameters:
store- Preference store to retrieve the preferences frommap- Map to store the preferences inuseDefault-trueif the default preferences should be used,falseotherwise
-
-