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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringHashMap keys used for caching the various settings displayed in this dialog.protected static final Stringprotected static final intSub - classes that need to create their own unique IDs should do so by adding to this ID.protected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intThe unique IDs for the various widgets.protected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intA HashMap to cache the various settings displayed in this dialogFields 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, ELLIPSISFields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred -
Constructor Summary
ConstructorsConstructorDescriptionPaletteSettingsDialog(Shell parentShell, PaletteViewerPreferences prefs) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 voidThis 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, 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, 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 voidThis method is invoked when "Cancel" is invoked on the dialog.protected voidThis method is invoked when the user selects the "Change" font button.protected voidThis 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 voidRestores 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 voidUpdates 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, shortenTextMethods 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 Details
-
settings
A HashMap to cache the various settings displayed in this dialog -
CACHE_LAYOUT
HashMap keys used for caching the various settings displayed in this dialog.- See Also:
-
CACHE_COLUMNS_ICON_SIZE
- See Also:
-
CACHE_LIST_ICON_SIZE
- See Also:
-
CACHE_ICONS_ICON_SIZE
- See Also:
-
CACHE_DETAILS_ICON_SIZE
- See Also:
-
CACHE_FONT
- See Also:
-
CACHE_COLLAPSE
- See Also:
-
LAYOUT_COLUMNS_VIEW_ID
protected static final int LAYOUT_COLUMNS_VIEW_IDThe 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:
-
LAYOUT_LIST_VIEW_ID
protected static final int LAYOUT_LIST_VIEW_ID- See Also:
-
LAYOUT_ICONS_VIEW_ID
protected static final int LAYOUT_ICONS_VIEW_ID- See Also:
-
LAYOUT_COLUMNS_ICON_SIZE_ID
protected static final int LAYOUT_COLUMNS_ICON_SIZE_ID- See Also:
-
LAYOUT_LIST_ICON_SIZE_ID
protected static final int LAYOUT_LIST_ICON_SIZE_ID- See Also:
-
LAYOUT_ICONS_ICON_SIZE_ID
protected static final int LAYOUT_ICONS_ICON_SIZE_ID- See Also:
-
LAYOUT_DETAILS_ICON_SIZE_ID
protected static final int LAYOUT_DETAILS_ICON_SIZE_ID- See Also:
-
COLLAPSE_NEVER_ID
protected static final int COLLAPSE_NEVER_ID- See Also:
-
COLLAPSE_ALWAYS_ID
protected static final int COLLAPSE_ALWAYS_ID- See Also:
-
COLLAPSE_NEEDED_ID
protected static final int COLLAPSE_NEEDED_ID- See Also:
-
APPLY_ID
protected static final int APPLY_ID- See Also:
-
LAYOUT_DETAILS_VIEW_ID
protected static final int LAYOUT_DETAILS_VIEW_ID- See Also:
-
FONT_CHANGE_ID
protected static final int FONT_CHANGE_ID- See Also:
-
DEFAULT_FONT_ID
protected static final int DEFAULT_FONT_ID- See Also:
-
CLIENT_ID
protected static final int CLIENT_IDSub - classes that need to create their own unique IDs should do so by adding to this ID.- See Also:
-
-
Constructor Details
-
PaletteSettingsDialog
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 Details
-
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:
-
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:
-
close
public boolean close() -
configureShell
- Overrides:
configureShellin classWindow- See Also:
-
createButton
protected Button createButton(Composite parent, int id, 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.PUSH) orSWT.CHECK)descriptor- The ImageDescriptor from which the image/icon for this button should be created- Returns:
- The newly created button for convenience
-
createDrawerCollapseOptions
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
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
- Overrides:
createDialogAreain classDialog- See Also:
-
createColumnsOptions
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
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
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
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
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
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
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
Returns the Button with the given id; ornullif none was found. -
getWidget
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:
-
showLayoutOptionsPage
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.
-