public class PreferenceConverter extends Object
Usage:
IPreferenceStore store = ...; PreferenceConverter.setValue(store, "bg", new RGB(127,127,127)); ... RBG bgColor = PreferenceConverter.getValue(store, "bg");
This class contains static methods and fields only and cannot be instantiated.
Note: touching this class has the side effect of creating a display (static initializer).Modifier and Type | Field and Description |
---|---|
static RGB |
COLOR_DEFAULT_DEFAULT
The default-default value for color preferences
(black,
RGB(0,0,0) ). |
static FontData[] |
FONTDATA_ARRAY_DEFAULT_DEFAULT
The default-default value for
FontData[] preferences. |
static FontData |
FONTDATA_DEFAULT_DEFAULT
The default-default value for
FontData preferences. |
static Point |
POINT_DEFAULT_DEFAULT
The default-default value for point preferences
(the origin,
(0,0) ). |
static Rectangle |
RECTANGLE_DEFAULT_DEFAULT
The default-default value for rectangle preferences
(the empty rectangle
(0,0,0,0) ). |
Modifier and Type | Method and Description |
---|---|
static FontData[] |
basicGetFontData(String value)
Helper method to construct a
FontData from the given string. |
static RGB |
getColor(IPreferenceStore store,
String name)
Returns the current value of the color-valued preference with the
given name in the given preference store.
|
static RGB |
getDefaultColor(IPreferenceStore store,
String name)
Returns the default value for the color-valued preference
with the given name in the given preference store.
|
static FontData |
getDefaultFontData(IPreferenceStore store,
String name)
Returns a single default value for the font-valued preference
with the given name in the given preference store.
|
static FontData[] |
getDefaultFontDataArray(IPreferenceStore store,
String name)
Returns the default value array for the font-valued preference
with the given name in the given preference store.
|
static Point |
getDefaultPoint(IPreferenceStore store,
String name)
Returns the default value for the point-valued preference
with the given name in the given preference store.
|
static Rectangle |
getDefaultRectangle(IPreferenceStore store,
String name)
Returns the default value for the rectangle-valued preference
with the given name in the given preference store.
|
static FontData |
getFontData(IPreferenceStore store,
String name)
Returns the current value of the first entry of the
font-valued preference with the
given name in the given preference store.
|
static FontData[] |
getFontDataArray(IPreferenceStore store,
String name)
Returns the current value of the font-valued preference with the
given name in the given preference store.
|
static Point |
getPoint(IPreferenceStore store,
String name)
Returns the current value of the point-valued preference with the
given name in the given preference store.
|
static Rectangle |
getRectangle(IPreferenceStore store,
String name)
Returns the current value of the rectangle-valued preference with the
given name in the given preference store.
|
static String |
getStoredRepresentation(FontData[] fontData)
Returns the stored representation of the given array of FontData objects.
|
static void |
putValue(IPreferenceStore store,
String name,
FontData[] value)
Sets the current value of the preference with the given name
in the given preference store.
|
static FontData[] |
readFontData(String fontDataValue)
Reads the supplied string and returns its corresponding
FontData.
|
static void |
setDefault(IPreferenceStore store,
String name,
FontData value)
Sets the default value of the preference with the given name
in the given preference store.
|
static void |
setDefault(IPreferenceStore store,
String name,
FontData[] value)
Sets the default value of the preference with the given name
in the given preference store.
|
static void |
setDefault(IPreferenceStore store,
String name,
Point value)
Sets the default value of the preference with the given name
in the given preference store.
|
static void |
setDefault(IPreferenceStore store,
String name,
Rectangle value)
Sets the default value of the preference with the given name
in the given preference store.
|
static void |
setDefault(IPreferenceStore store,
String name,
RGB value)
Sets the default value of the preference with the given name
in the given preference store.
|
static void |
setValue(IPreferenceStore store,
String name,
FontData value)
Sets the current value of the preference with the given name
in the given preference store.
|
static void |
setValue(IPreferenceStore store,
String name,
FontData[] value)
Sets the current value of the preference with the given name
in the given preference store.
|
static void |
setValue(IPreferenceStore store,
String name,
Point value)
Sets the current value of the preference with the given name
in the given preference store.
|
static void |
setValue(IPreferenceStore store,
String name,
Rectangle value)
Sets the current value of the preference with the given name
in the given preference store.
|
static void |
setValue(IPreferenceStore store,
String name,
RGB value)
Sets the current value of the preference with the given name
in the given preference store.
|
public static final Point POINT_DEFAULT_DEFAULT
(0,0)
).public static final Rectangle RECTANGLE_DEFAULT_DEFAULT
(0,0,0,0)
).public static final RGB COLOR_DEFAULT_DEFAULT
RGB(0,0,0)
).public static final FontData[] FONTDATA_ARRAY_DEFAULT_DEFAULT
FontData[]
preferences.public static final FontData FONTDATA_DEFAULT_DEFAULT
FontData
preferences.public static FontData[] basicGetFontData(String value)
FontData
from the given string.
String is in the form FontData;FontData; in order that
multiple FontDatas can be defined.value
- the identifier for the fontpublic static FontData[] readFontData(String fontDataValue)
fontDataValue
- the string value for the font datapublic static RGB getColor(IPreferenceStore store, String name)
COLOR_DEFAULT_DEFAULT
)
if there is no preference with the given name, or if the current value
cannot be treated as a color.store
- the preference storename
- the name of the preferencepublic static RGB getDefaultColor(IPreferenceStore store, String name)
COLOR_DEFAULT_DEFAULT
)
is no default preference with the given name, or if the default
value cannot be treated as a color.store
- the preference storename
- the name of the preferencepublic static FontData[] getDefaultFontDataArray(IPreferenceStore store, String name)
FONTDATA_ARRAY_DEFAULT_DEFAULT
)
is no default preference with the given name, or if the default
value cannot be treated as font data.store
- the preference storename
- the name of the preferencepublic static FontData getDefaultFontData(IPreferenceStore store, String name)
FONTDATA_DEFAULT_DEFAULT
)
is no default preference with the given name, or if the default
value cannot be treated as font data.
This method is provided for backwards compatibility. It is
recommended that getDefaultFontDataArray
is
used instead.store
- the preference storename
- the name of the preferencepublic static Point getDefaultPoint(IPreferenceStore store, String name)
POINT_DEFAULT_DEFAULT
)
is no default preference with the given name, or if the default
value cannot be treated as a point.store
- the preference storename
- the name of the preferencepublic static Rectangle getDefaultRectangle(IPreferenceStore store, String name)
RECTANGLE_DEFAULT_DEFAULT
)
is no default preference with the given name, or if the default
value cannot be treated as a rectangle.store
- the preference storename
- the name of the preferencepublic static FontData[] getFontDataArray(IPreferenceStore store, String name)
FONTDATA_ARRAY_DEFAULT_DEFAULT
)
if there is no preference with the given name, or if the current value
cannot be treated as font data.store
- the preference storename
- the name of the preferencepublic static FontData getFontData(IPreferenceStore store, String name)
FONTDATA_ARRAY_DEFAULT_DEFAULT
)
if there is no preference with the given name, or if the current value
cannot be treated as font data.
This API is provided for backwards compatibility. It is
recommended that getFontDataArray
is used instead.store
- the preference storename
- the name of the preferencepublic static Point getPoint(IPreferenceStore store, String name)
POINT_DEFAULT_DEFAULT
)
if there is no preference with the given name, or if the current value
cannot be treated as a point.store
- the preference storename
- the name of the preferencepublic static Rectangle getRectangle(IPreferenceStore store, String name)
RECTANGLE_DEFAULT_DEFAULT
)
if there is no preference with the given name, or if the current value
cannot be treated as a rectangle.store
- the preference storename
- the name of the preferencepublic static void setDefault(IPreferenceStore store, String name, FontData value)
setDefault(IPreferenceStore, String, FontData[])
instead.store
- the preference storename
- the name of the preferencevalue
- the new default value of the preferencepublic static void setDefault(IPreferenceStore store, String name, FontData[] value)
store
- the preference storename
- the name of the preferencevalue
- the new default value of the preferencepublic static void setDefault(IPreferenceStore store, String name, Point value)
store
- the preference storename
- the name of the preferencevalue
- the new default value of the preferencepublic static void setDefault(IPreferenceStore store, String name, Rectangle value)
store
- the preference storename
- the name of the preferencevalue
- the new default value of the preferencepublic static void setDefault(IPreferenceStore store, String name, RGB value)
store
- the preference storename
- the name of the preferencevalue
- the new default value of the preferencepublic static void setValue(IPreferenceStore store, String name, FontData value)
Included for backwards compatibility. This method is equivalent to setValue(store, name, new FontData[]{value}).
store
- the preference storename
- the name of the preferencevalue
- the new current value of the preferencepublic static void setValue(IPreferenceStore store, String name, FontData[] value)
Note that this API does not update any other settings that may be dependant upon it. Only the value in the preference store and in the font registry is updated.
store
- the preference storename
- the name of the preferencevalue
- the new current value of the preferenceputValue(IPreferenceStore, String, FontData[])
public static void putValue(IPreferenceStore store, String name, FontData[] value)
store
- the preference storename
- the name of the preferencevalue
- the new current value of the preferencesetValue(IPreferenceStore, String, FontData[])
public static String getStoredRepresentation(FontData[] fontData)
fontData
- the array of FontData objectspublic static void setValue(IPreferenceStore store, String name, Point value)
store
- the preference storename
- the name of the preferencevalue
- the new current value of the preferencepublic static void setValue(IPreferenceStore store, String name, Rectangle value)
store
- the preference storename
- the name of the preferencevalue
- the new current value of the preferencepublic static void setValue(IPreferenceStore store, String name, RGB value)
store
- the preference storename
- the name of the preferencevalue
- the new current value of the preference
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.