|
Eclipse GEF 3.8.0.201206112118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gef.ui.palette.DefaultPaletteViewerPreferences
public class DefaultPaletteViewerPreferences
This is the default implementation for PaletteViewerPreferences. It uses a single IPreferenceStore to load and save the palette viewer settings.
It is recommended that the default constructor be used (which will use the
preference store in the GEF plugin) as that will cause the preferences to be
shared across different types of editors. If the client does not wish to
share one of the existing preferences for their editor (say the auto-collapse
setting), they will have to sub-class this class and override the necessary
methods (in this case, getAutoCollapseSetting()
and
setAutoCollapseSetting(int)
) and save that preference in some other
preference store. Sub-classes can add newer preferences to the store by using
getPreferenceStore()
.
Field Summary |
---|
Fields inherited from interface org.eclipse.gef.ui.palette.PaletteViewerPreferences |
---|
COLLAPSE_ALWAYS, COLLAPSE_AS_NEEDED, COLLAPSE_NEVER, LAYOUT_COLUMNS, LAYOUT_DETAILS, LAYOUT_FOLDER, LAYOUT_ICONS, LAYOUT_LIST, PREFERENCE_AUTO_COLLAPSE, PREFERENCE_COLUMNS_ICON_SIZE, PREFERENCE_DETAILS_ICON_SIZE, PREFERENCE_FOLDER_ICON_SIZE, PREFERENCE_FONT, PREFERENCE_ICONS_ICON_SIZE, PREFERENCE_LAYOUT, PREFERENCE_LIST_ICON_SIZE |
Constructor Summary | |
---|---|
DefaultPaletteViewerPreferences()
Default Constructor Uses the GEF Plugin's IPreferenceStore to store the preferences. |
|
DefaultPaletteViewerPreferences(IPreferenceStore store)
Constructor |
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
NOTE: The oldValue field of the
PropertyChangeEvent used to notify listeners will always be
null . |
static String |
convertLayoutToPreferenceName(int layout)
This is a convenience method that converts the given layout mode to the matching preference name. |
static int |
convertPreferenceNameToLayout(String preference)
This convenience method converts the given preference to the matching layout mode. |
protected void |
firePropertyChanged(String property,
Object newVal)
The oldValue of the PropertyChangeEvent that is fired will always be null . |
int |
getAutoCollapseSetting()
Returns the current auto-collapse setting. |
FontData |
getFontData()
|
int |
getLayoutSetting()
Returns the current layout setting. |
protected IPreferenceStore |
getPreferenceStore()
|
int[] |
getSupportedLayoutModes()
Returns the layout modes that are supported. |
protected void |
handlePreferenceStorePropertyChanged(String property)
This method is invoked when the preference store fires a property change. |
boolean |
isSupportedLayoutMode(int layout)
This is a convenience method. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
|
void |
setAutoCollapseSetting(int newVal)
Sets the auto-collapse setting. |
void |
setCurrentUseLargeIcons(boolean newVal)
Sets the "Use Large Icons" option for the currently active layout. |
void |
setFontData(FontData data)
Sets the FontData for the palette. |
void |
setLayoutSetting(int newVal)
Sets the given setting as the current layout. |
void |
setSupportedLayoutModes(int[] modes)
NOTE: Restricting the layout modes here does not in any way restrict those values from being stored in the preference store. |
void |
setUseLargeIcons(int layout,
boolean newVal)
Sets the "Use Large Icons" option for the given layout. |
boolean |
useLargeIcons()
|
boolean |
useLargeIcons(int layout)
Indicated whether large icons should be used with the given layout mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultPaletteViewerPreferences()
Uses the GEF Plugin's IPreferenceStore to store the preferences.
public DefaultPaletteViewerPreferences(IPreferenceStore store)
store
- The IPreferenceStore where the settings are to be saved.Method Detail |
---|
public void addPropertyChangeListener(PropertyChangeListener listener)
oldValue
field of the
PropertyChangeEvent
used to notify listeners will always be
null
.
addPropertyChangeListener
in interface PaletteViewerPreferences
listener
- the PropertyChangeListener to be notified of changesPaletteViewerPreferences.addPropertyChangeListener(PropertyChangeListener)
public static String convertLayoutToPreferenceName(int layout)
layout
- LAYOUT_LIST, LAYOUT_DETAILS, LAYOUT_COLUMNS, or LAYOUT_ICONS
public static int convertPreferenceNameToLayout(String preference)
preference
- PREFERENCE_DETAILS_ICON_SIZE, PREFERENCE_COLUMNS_ICON_SIZE,
PREFERENCE_ICONS_ICON_SIZE or PREFERENCE_LIST_ICON_SIZE
protected void firePropertyChanged(String property, Object newVal)
null
.
property
- The programmatic name of the property that was changednewVal
- The new value of the propertyPropertyChangeSupport.firePropertyChange(java.lang.String,
java.lang.Object, java.lang.Object)
public int getAutoCollapseSetting()
PaletteViewerPreferences
Possible values returned:
getAutoCollapseSetting
in interface PaletteViewerPreferences
PaletteViewerPreferences.getAutoCollapseSetting()
public FontData getFontData()
getFontData
in interface PaletteViewerPreferences
PaletteViewerPreferences.getFontData()
public int getLayoutSetting()
PaletteViewerPreferences
Possible values returned:
getLayoutSetting
in interface PaletteViewerPreferences
PaletteViewerPreferences.getLayoutSetting()
public int[] getSupportedLayoutModes()
PaletteViewerPreferences
getSupportedLayoutModes
in interface PaletteViewerPreferences
PaletteViewerPreferences.getSupportedLayoutModes()
protected void handlePreferenceStorePropertyChanged(String property)
property
- The property String used for the change fired by the
preference storeprotected IPreferenceStore getPreferenceStore()
public boolean isSupportedLayoutMode(int layout)
PaletteViewerPreferences
isSupportedLayoutMode
in interface PaletteViewerPreferences
layout
- LAYOUT_COLUMNS, LAYOUT_LIST, LAYOUT_ICONS, or LAYOUT_DETAILS
true
if the given layout is a supported modePaletteViewerPreferences.isSupportedLayoutMode(int)
public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface PaletteViewerPreferences
listener
- the PropertyChangeListener that should not be notified
hereafterPaletteViewerPreferences.removePropertyChangeListener(PropertyChangeListener)
public void setAutoCollapseSetting(int newVal)
PaletteViewerPreferences
Possible values:
setAutoCollapseSetting
in interface PaletteViewerPreferences
newVal
- One of the above-mentioned constantsPaletteViewerPreferences.setAutoCollapseSetting(int)
public void setFontData(FontData data)
PaletteViewerPreferences
setFontData
in interface PaletteViewerPreferences
data
- The FontData for the font to be used in the palettePaletteViewerPreferences.setFontData(FontData)
public void setLayoutSetting(int newVal)
PaletteViewerPreferences
Possible values:
setLayoutSetting
in interface PaletteViewerPreferences
newVal
- One of the above-mentioned constantsPaletteViewerPreferences.setLayoutSetting(int)
public void setCurrentUseLargeIcons(boolean newVal)
PaletteViewerPreferences
setCurrentUseLargeIcons
in interface PaletteViewerPreferences
newVal
- true
if large icons are to be used with the
current layout settingPaletteViewerPreferences.setCurrentUseLargeIcons(boolean)
public void setSupportedLayoutModes(int[] modes)
setSupportedLayoutModes
in interface PaletteViewerPreferences
modes
- an array of layout modes desiredPaletteViewerPreferences.setSupportedLayoutModes(int[])
public void setUseLargeIcons(int layout, boolean newVal)
PaletteViewerPreferences
true
false
true
false
setUseLargeIcons
in interface PaletteViewerPreferences
layout
- any of the above-mentioned constantsnewVal
- true
if large icons are to be used with the given
layoutPaletteViewerPreferences.setUseLargeIcons(int,
boolean)
public boolean useLargeIcons(int layout)
PaletteViewerPreferences
true
false
true
false
useLargeIcons
in interface PaletteViewerPreferences
layout
- any of the above-mentioned constants
true
if large icons are to be used with the given
layoutPaletteViewerPreferences.useLargeIcons(int)
public boolean useLargeIcons()
useLargeIcons
in interface PaletteViewerPreferences
true
if large icons are to be used with the
currently active layoutPaletteViewerPreferences.useLargeIcons()
|
Eclipse GEF 3.8.0.201206112118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |