Class PaletteSettingsDialog
- java.lang.Object
-
- org.eclipse.jface.window.Window
-
- org.eclipse.jface.dialogs.Dialog
-
- org.eclipse.gef.ui.palette.customize.PaletteSettingsDialog
-
- All Implemented Interfaces:
IShellProvider
public class PaletteSettingsDialog extends Dialog
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected static intAPPLY_IDThe unique IDs for the various widgets.protected static java.lang.StringCACHE_COLLAPSEHashMap keys used for caching the various settings displayed in this dialog.protected static java.lang.StringCACHE_COLUMNS_ICON_SIZEHashMap keys used for caching the various settings displayed in this dialog.protected static java.lang.StringCACHE_DETAILS_ICON_SIZEHashMap keys used for caching the various settings displayed in this dialog.protected static java.lang.StringCACHE_FONTHashMap keys used for caching the various settings displayed in this dialog.protected static java.lang.StringCACHE_ICONS_ICON_SIZEHashMap keys used for caching the various settings displayed in this dialog.protected static java.lang.StringCACHE_LAYOUTHashMap keys used for caching the various settings displayed in this dialog.protected static java.lang.StringCACHE_LIST_ICON_SIZEHashMap keys used for caching the various settings displayed in this dialog.protected static intCLIENT_IDSub - classes that need to create their own unique IDs should do so by adding to this ID.protected static intCOLLAPSE_ALWAYS_IDThe unique IDs for the various widgets.protected static intCOLLAPSE_NEEDED_IDThe unique IDs for the various widgets.protected static intCOLLAPSE_NEVER_IDThe unique IDs for the various widgets.protected static intDEFAULT_FONT_IDThe unique IDs for the various widgets.protected static intFONT_CHANGE_IDThe unique IDs for the various widgets.protected static intLAYOUT_COLUMNS_ICON_SIZE_IDThe unique IDs for the various widgets.protected static intLAYOUT_COLUMNS_VIEW_IDThe unique IDs for the various widgets.protected static intLAYOUT_DETAILS_ICON_SIZE_IDThe unique IDs for the various widgets.protected static intLAYOUT_DETAILS_VIEW_IDThe unique IDs for the various widgets.protected static intLAYOUT_ICONS_ICON_SIZE_IDThe unique IDs for the various widgets.protected static intLAYOUT_ICONS_VIEW_IDThe unique IDs for the various widgets.protected static intLAYOUT_LIST_ICON_SIZE_IDThe unique IDs for the various widgets.protected static intLAYOUT_LIST_VIEW_IDThe unique IDs for the various widgets.protected java.util.HashMapsettingsA HashMap to cache the various settings displayed in this dialog-
Fields inherited from class org.eclipse.jface.dialogs.Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
-
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred
-
-
Constructor Summary
Constructors Constructor Description PaletteSettingsDialog(Shell parentShell, PaletteViewerPreferences prefs)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuttonPressed(int buttonId)This method will be invoked whenever anyButtoncreated usingcreateButton(Composite, int, String, int, ImageDescriptor)orDialog.createButton(Composite, int, String, boolean)is selected.protected voidcacheSettings()This method saves the various settings in this dialog, so that they can be restored later on if "Cancel" is pressed.booleanclose()protected voidconfigureShell(Shell newShell)protected ButtoncreateButton(Composite parent, int id, java.lang.String label, int stylebits, ImageDescriptor descriptor)This method should not be used to create buttons for the button bar.protected ControlcreateColumnsOptions(Composite parent)Creates and initializes (i.e. loads the current settings from PaletteViewerPreferences) the options for columns layout.protected ControlcreateDetailsOptions(Composite parent)Creates and initializes (i.e. loads the current settings from PaletteViewerPreferences) the options for details layout.protected ControlcreateDialogArea(Composite parent)protected ControlcreateDrawerCollapseOptions(Composite container)Creates and initializes (i.e., loads the current value from the PaletteViewerPreferences) the part of the dialog where the options to close drawers will be displayed.protected ControlcreateFontSettings(Composite parent)Creates and initializes (i.e. loads the current settings from PaletteViewerPreferences) the part of the dialog that displays the font settings.protected ControlcreateIconsOnlyOptions(Composite parent)Creates and initializes (i.e. loads the current settings from PaletteViewerPreferences) the options for icons layout.protected ControlcreateLayoutOptions(Composite parent)Creates the part of the dialog that displays the various options for the selected layout.protected ControlcreateLayoutSettings(Composite parent)Creates the part of the dialog that displays the lists the available layout modes.protected ControlcreateListOptions(Composite parent)Creates and initializes (i.e. loads the current settings from PaletteViewerPreferences) the options for list layout.protected ControlcreateOptionsPage(Composite parent, java.lang.String title, int buttonId)This helper method is a result of code-factoring.protected ButtongetButton(int id)Returns the Button with the given id; ornullif none was found.protected WidgetgetWidget(int id)TheWidgets that were created with a unique ID and added to this class' internal map can be retrieved through this method.protected voidhandleAutoCollapseSettingChanged(int newSetting)Called when any one of the "Auto - Collapse" radio buttons is clicked.protected voidhandleCancelPressed()This method is invoked when "Cancel" is invoked on the dialog.protected voidhandleChangeFontPressed()This method is invoked when the user selects the "Change" font button.protected voidhandleDefaultFontRequested()This method is invoked when the user selects the "Restore Default" font button.protected voidhandleIconSizeChanged(boolean selection)This method is invoked when the "Use Large Icons" checkbox is selected/deselected for the currently active layout mode.protected voidhandleLayoutSettingChanged(int newSetting)This method is called when any one of the "Layout" radio buttons is clicked.protected voidrestoreSettings()Restores the cached settings, thus undoing any changes made since the last caching of settings.protected voidshowLayoutOptionsPage(Control page)This helper method is mainly a result of code-factoring.protected voidupdateFontName()Updates the label showing the font's name to show the name of the current font.-
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createButtonsForButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, isResizable, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
-
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
-
-
-
-
Field Detail
-
settings
protected java.util.HashMap settings
A HashMap to cache the various settings displayed in this dialog
-
CACHE_LAYOUT
protected static final java.lang.String CACHE_LAYOUT
HashMap keys used for caching the various settings displayed in this dialog.- See Also:
- Constant Field Values
-
CACHE_COLUMNS_ICON_SIZE
protected static final java.lang.String CACHE_COLUMNS_ICON_SIZE
HashMap keys used for caching the various settings displayed in this dialog.- See Also:
- Constant Field Values
-
CACHE_LIST_ICON_SIZE
protected static final java.lang.String CACHE_LIST_ICON_SIZE
HashMap keys used for caching the various settings displayed in this dialog.- See Also:
- Constant Field Values
-
CACHE_ICONS_ICON_SIZE
protected static final java.lang.String CACHE_ICONS_ICON_SIZE
HashMap keys used for caching the various settings displayed in this dialog.- See Also:
- Constant Field Values
-
CACHE_DETAILS_ICON_SIZE
protected static final java.lang.String CACHE_DETAILS_ICON_SIZE
HashMap keys used for caching the various settings displayed in this dialog.- See Also:
- Constant Field Values
-
CACHE_FONT
protected static final java.lang.String CACHE_FONT
HashMap keys used for caching the various settings displayed in this dialog.- See Also:
- Constant Field Values
-
CACHE_COLLAPSE
protected static final java.lang.String CACHE_COLLAPSE
HashMap keys used for caching the various settings displayed in this dialog.- See Also:
- Constant Field Values
-
LAYOUT_COLUMNS_VIEW_ID
protected static final int LAYOUT_COLUMNS_VIEW_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
LAYOUT_LIST_VIEW_ID
protected static final int LAYOUT_LIST_VIEW_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
LAYOUT_ICONS_VIEW_ID
protected static final int LAYOUT_ICONS_VIEW_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
LAYOUT_COLUMNS_ICON_SIZE_ID
protected static final int LAYOUT_COLUMNS_ICON_SIZE_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
LAYOUT_LIST_ICON_SIZE_ID
protected static final int LAYOUT_LIST_ICON_SIZE_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
LAYOUT_ICONS_ICON_SIZE_ID
protected static final int LAYOUT_ICONS_ICON_SIZE_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
LAYOUT_DETAILS_ICON_SIZE_ID
protected static final int LAYOUT_DETAILS_ICON_SIZE_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
COLLAPSE_NEVER_ID
protected static final int COLLAPSE_NEVER_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
COLLAPSE_ALWAYS_ID
protected static final int COLLAPSE_ALWAYS_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
COLLAPSE_NEEDED_ID
protected static final int COLLAPSE_NEEDED_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
APPLY_ID
protected static final int APPLY_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
LAYOUT_DETAILS_VIEW_ID
protected static final int LAYOUT_DETAILS_VIEW_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
FONT_CHANGE_ID
protected static final int FONT_CHANGE_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
DEFAULT_FONT_ID
protected static final int DEFAULT_FONT_ID
The unique IDs for the various widgets. These IDs can be used to retrieve these widgets from the internal map (usinggetWidget(int)), or to identify widgets inbuttonPressed(int).- See Also:
- Constant Field Values
-
CLIENT_ID
protected static final int CLIENT_ID
Sub - classes that need to create their own unique IDs should do so by adding to this ID.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PaletteSettingsDialog
public PaletteSettingsDialog(Shell parentShell, PaletteViewerPreferences prefs)
Constructor- Parameters:
parentShell- The parent shell, ornullto create a top - level shellprefs- The PaletteViewerPreferences object that can provide access to and allow modification of the palette's settings. It cannot benull.
-
-
Method Detail
-
buttonPressed
protected void buttonPressed(int buttonId)
This method will be invoked whenever anyButtoncreated usingcreateButton(Composite, int, String, int, ImageDescriptor)orDialog.createButton(Composite, int, String, boolean)is selected.- Overrides:
buttonPressedin classDialog- See Also:
Dialog.buttonPressed(int)
-
cacheSettings
protected void cacheSettings()
This method saves the various settings in this dialog, so that they can be restored later on if "Cancel" is pressed.- See Also:
restoreSettings()
-
close
public boolean close()
- Overrides:
closein classDialog- See Also:
Window.close()
-
configureShell
protected void configureShell(Shell newShell)
- Overrides:
configureShellin classWindow- See Also:
Window.configureShell(Shell)
-
createButton
protected Button createButton(Composite parent, int id, java.lang.String label, int stylebits, ImageDescriptor descriptor)
This method should not be used to create buttons for the button bar. UseDialog.createButton(Composite, int, String, boolean)for that. This method can be used to create any other button in the dialog. The parentCompositemust have a GridLayout. These buttons will be available throughgetButton(int)andgetWidget(int). Ensure that the various buttons created by this method are given unique IDs. Pass in a null image descriptor if you don't want the button to have an icon. This method will take care of disposing the images that it creates.buttonPressed(int)will be called when any of the buttons created by this method are clicked (selected).- Parameters:
parent- The composite in which the button is to be createdid- The button's unique IDlabel- The button's textstylebits- The style bits for creating the button (eg.,SWT.PUSHSWT.CHECK)descriptor- The ImageDescriptor from which the image/icon for this button should be created- Returns:
- The newly created button for convenience
-
createDrawerCollapseOptions
protected Control createDrawerCollapseOptions(Composite container)
Creates and initializes (i.e., loads the current value from the PaletteViewerPreferences) the part of the dialog where the options to close drawers will be displayed.- Parameters:
container- The parent composite- Returns:
- The newly created Control which has the drawer collapse options
-
createDetailsOptions
protected Control createDetailsOptions(Composite parent)
Creates and initializes (i.e. loads the current settings from PaletteViewerPreferences) the options for details layout.- Parameters:
parent- the parent composite- Returns:
- the newly created Control
-
createDialogArea
protected Control createDialogArea(Composite parent)
- Overrides:
createDialogAreain classDialog- See Also:
Dialog.createDialogArea(Composite)
-
createColumnsOptions
protected Control createColumnsOptions(Composite parent)
Creates and initializes (i.e. loads the current settings from PaletteViewerPreferences) the options for columns layout.- Parameters:
parent- the parent composite- Returns:
- the newly created Control
-
createFontSettings
protected Control createFontSettings(Composite parent)
Creates and initializes (i.e. loads the current settings from PaletteViewerPreferences) the part of the dialog that displays the font settings.- Parameters:
parent- the parent composite- Returns:
- the newly created Control
-
createIconsOnlyOptions
protected Control createIconsOnlyOptions(Composite parent)
Creates and initializes (i.e. loads the current settings from PaletteViewerPreferences) the options for icons layout.- Parameters:
parent- the parent composite- Returns:
- the newly created Control
-
createLayoutOptions
protected Control createLayoutOptions(Composite parent)
Creates the part of the dialog that displays the various options for the selected layout.- Parameters:
parent- the parent composite- Returns:
- the newly created Control
-
createLayoutSettings
protected Control createLayoutSettings(Composite parent)
Creates the part of the dialog that displays the lists the available layout modes.- Parameters:
parent- the parent composite- Returns:
- the newly created Control
-
createListOptions
protected Control createListOptions(Composite parent)
Creates and initializes (i.e. loads the current settings from PaletteViewerPreferences) the options for list layout.- Parameters:
parent- the parent composite- Returns:
- the newly created Control
-
createOptionsPage
protected Control createOptionsPage(Composite parent, java.lang.String title, int buttonId)
This helper method is a result of code-factoring. It creates a Group displaying the given title and creates a "Use Large Icons" checkbox with the given buttonId in it. This method is used to create the options for the different layout modes.- Parameters:
parent- the parent compositetitle- The title for the group to be created.buttonId- The ID for the "Use Large Icons" checkbox to be created in the group.- Returns:
- the newly created Group
-
getButton
protected Button getButton(int id)
Returns the Button with the given id; ornullif none was found.- Overrides:
getButtonin classDialog- See Also:
Dialog.getButton(int)
-
getWidget
protected Widget getWidget(int id)
TheWidgets that were created with a unique ID and added to this class' internal map can be retrieved through this method.- Parameters:
id- The unique ID of the Widget that you wish to retrieve- Returns:
- The Widget, if one with the given id exists.
nullotherwise.
-
handleAutoCollapseSettingChanged
protected void handleAutoCollapseSettingChanged(int newSetting)
Called when any one of the "Auto - Collapse" radio buttons is clicked. It changes the setting in thePaletteViewerPreferencesobject.- Parameters:
newSetting- The flag for the new setting
-
handleCancelPressed
protected void handleCancelPressed()
This method is invoked when "Cancel" is invoked on the dialog. It simply restores the settings, thus undoing any changes made in this Dialog.
-
handleChangeFontPressed
protected void handleChangeFontPressed()
This method is invoked when the user selects the "Change" font button. It opens the FontDialog to allow the user to change the font.
-
handleDefaultFontRequested
protected void handleDefaultFontRequested()
This method is invoked when the user selects the "Restore Default" font button. It changes the font, in case it was different, to the default one, which is the Workbench Dialog font.
-
handleIconSizeChanged
protected void handleIconSizeChanged(boolean selection)
This method is invoked when the "Use Large Icons" checkbox is selected/deselected for the currently active layout mode.- Parameters:
selection- indicates whether large icons are to be used or not.
-
handleLayoutSettingChanged
protected void handleLayoutSettingChanged(int newSetting)
This method is called when any one of the "Layout" radio buttons is clicked. It changes the setting in thePaletteViewerPreferencesobject.- Parameters:
newSetting- The flag for the new setting
-
restoreSettings
protected void restoreSettings()
Restores the cached settings, thus undoing any changes made since the last caching of settings.- See Also:
cacheSettings()
-
showLayoutOptionsPage
protected void showLayoutOptionsPage(Control page)
This helper method is mainly a result of code-factoring. It shows the given page (which should be one of the controls showing the layout options) in the PageBook and grows the dialog if necessary.- Parameters:
page- One of the controls showing the layout options that already belongs to the PageBook book.
-
updateFontName
protected void updateFontName()
Updates the label showing the font's name to show the name of the current font.
-
-