|
|||||||||
| Home >> All >> org >> eclipse >> jface >> [ preference overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.jface.preference
Class PreferenceDialog

java.lang.Objectorg.eclipse.jface.window.Window
org.eclipse.jface.dialogs.Dialog
org.eclipse.jface.preference.PreferenceDialog
- All Implemented Interfaces:
- IPreferencePageContainer
- public class PreferenceDialog
- extends org.eclipse.jface.dialogs.Dialog
- implements IPreferencePageContainer
- extends org.eclipse.jface.dialogs.Dialog
A preference dialog is a hierarchical presentation of preference pages. Each page is represented by a node in the tree shown on the left hand side of the dialog; when a node is selected, the corresponding page is shown on the right hand side.
| Nested Class Summary | |
private class |
PreferenceDialog.PageLayout
Layout for the page container. |
| Nested classes inherited from class org.eclipse.jface.window.Window |
org.eclipse.jface.window.Window.IExceptionHandler |
| Fields inherited from class org.eclipse.jface.dialogs.Dialog |
blockedHandler, buttonBar, dialogArea, DLG_IMG_ERROR, 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 |
| Constructor Summary | |
PreferenceDialog(org.eclipse.swt.widgets.Shell parentShell,
PreferenceManager manager)
Creates a new preference dialog under the control of the given preference manager. |
|
| Method Summary | |
protected void |
buttonPressed(int buttonId)
Notifies that this dialog's button with the given id has been pressed. |
protected void |
cancelPressed()
Notifies that the cancel button of this dialog has been pressed. |
(package private) void |
clearSelectedNode()
Clear the last selected node. |
boolean |
close()
Closes this window, disposes its shell, and removes this window from its window manager (if it has one). |
protected void |
configureShell(org.eclipse.swt.widgets.Shell newShell)
Configures the given shell in preparation for opening this window in it. |
protected void |
constrainShellSize()
Constrain the shell size to be no larger than the display bounds. |
protected void |
createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent)
Adds buttons to this dialog's button bar. |
protected org.eclipse.swt.widgets.Control |
createContents(org.eclipse.swt.widgets.Composite parent)
The Dialog implementation of this Window
method creates and lays out the top level composite for the dialog, and
determines the appropriate horizontal and vertical dialog units based on
the font size. |
protected org.eclipse.swt.widgets.Control |
createDialogArea(org.eclipse.swt.widgets.Composite parent)
Creates and returns the contents of the upper part of this dialog (above the button bar). |
private org.eclipse.swt.layout.FormData |
createMessageAreaData()
Create the layout data for the message area. |
private org.eclipse.swt.widgets.Composite |
createPageContainer(org.eclipse.swt.widgets.Composite parent)
Creates the inner page container. |
private org.eclipse.swt.widgets.Composite |
createTitleArea(org.eclipse.swt.widgets.Composite parent)
Creates the wizard's title area. |
protected org.eclipse.swt.widgets.Control |
createTreeAreaContents(org.eclipse.swt.widgets.Composite parent)
|
protected org.eclipse.jface.viewers.TreeViewer |
createTreeViewer(org.eclipse.swt.widgets.Composite parent)
Create a new TreeViewer. |
protected IPreferenceNode |
findNodeMatching(java.lang.String nodeId)
Find the IPreferenceNode that has data the same id as the
supplied value. |
private int |
getLastTreeWidth()
Get the last known tree width. |
PreferenceManager |
getPreferenceManager()
Returns the preference mananger used by this preference dialog. |
IPreferenceStore |
getPreferenceStore()
Returns the preference store. |
protected java.lang.String |
getSelectedNodePreference()
Get the name of the selected item preference |
private java.lang.String |
getShortenedString(java.lang.String textValue)
Shortened the message if too long. |
protected IPreferenceNode |
getSingleSelection(org.eclipse.jface.viewers.ISelection selection)
|
protected org.eclipse.jface.viewers.TreeViewer |
getTreeViewer()
|
protected void |
handleSave()
Save the values specified in the pages. |
protected void |
handleShellCloseEvent()
Notifies that the window's close button was pressed, the close menu was selected, or the ESCAPE key pressed. |
protected void |
helpPressed()
Notifies of the pressing of the Help button. |
protected boolean |
isCurrentPageValid()
Returns whether the current page is valid. |
protected void |
layoutTreeAreaControl(org.eclipse.swt.widgets.Control control)
|
protected void |
okPressed()
The preference dialog implementation of this Dialog
framework method sends performOk to all pages of the
preference dialog, then calls handleSave on this dialog to
save any state, and then calls close to close this dialog. |
(package private) void |
selectCurrentPageAgain()
Selects the page determined by lastSuccessfulNode in the
page hierarchy. |
protected void |
selectSavedItem()
Selects the saved item in the tree of preference pages. |
void |
setErrorMessage(java.lang.String newErrorMessage)
Display the given error message. |
void |
setHelpAvailable(boolean b)
Sets whether a Help button is available for this dialog. |
private void |
setLastTreeWidth(int width)
Save the last known tree width. |
void |
setMessage(java.lang.String newMessage)
Set the message text. |
void |
setMessage(java.lang.String newMessage,
int newType)
Sets the message for this dialog with an indication of what type of message it is. |
void |
setMinimumPageSize(int minWidth,
int minHeight)
Sets the minimum page size. |
void |
setMinimumPageSize(org.eclipse.swt.graphics.Point size)
Sets the minimum page size. |
void |
setPreferenceStore(IPreferenceStore store)
Sets the preference store for this preference dialog. |
private void |
setSelectedNode()
Save the currently selected node. |
void |
setSelectedNode(java.lang.String pageId)
Sets the name of the selected item preference. |
protected void |
setSelectedNodePreference(java.lang.String pageId)
Sets the name of the selected item preference. |
private void |
setShellSize(int width,
int height)
Changes the shell size to the given size, ensuring that it is no larger than the display bounds. |
protected boolean |
showPage(IPreferenceNode node)
Shows the preference page corresponding to the given preference node. |
(package private) void |
showPageFlippingAbortDialog()
Shows the "Page Flipping abort" dialog. |
protected void |
update()
Updates this dialog's controls to reflect the current page. |
void |
updateButtons()
Adjusts the enable state of the OK button to reflect the state of the currently active page in this container. |
void |
updateMessage()
Updates the message (or error message) shown in the message line to reflect the state of the currently active page in this container. |
void |
updateTitle()
Updates the title to reflect the state of the currently active page in this container. |
protected void |
updateTreeFont(org.eclipse.swt.graphics.Font dialogFont)
Update the tree to use the specified Font. |
| Methods inherited from class org.eclipse.jface.window.Window |
canHandleShellCloseEvent, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getInitialLocation, getInitialSize, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setExceptionHandler, setReturnCode, setShellStyle, setWindowManager |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
lastPreferenceId
private static java.lang.String lastPreferenceId
lastTreeWidth
private static int lastTreeWidth
PREF_DLG_IMG_TITLE_ERROR
public static final java.lang.String PREF_DLG_IMG_TITLE_ERROR
- Indentifier for the error image
- See Also:
- Constant Field Values
PREF_DLG_TITLE_IMG
public static final java.lang.String PREF_DLG_TITLE_IMG
- Title area fields
- See Also:
- Constant Field Values
currentPage
private IPreferencePage currentPage
- The current preference page, or
nullif there is none.
messageArea
private org.eclipse.jface.dialogs.DialogMessageArea messageArea
isHelpAvailable
private boolean isHelpAvailable
- Indicates whether help is available;
falseby default.'- See Also:
setHelpAvailable(boolean)55
lastShellSize
private org.eclipse.swt.graphics.Point lastShellSize
lastSuccessfulNode
private IPreferenceNode lastSuccessfulNode
minimumPageSize
private org.eclipse.swt.graphics.Point minimumPageSize
- The minimum page size; 400 by 400 by default.
- See Also:
setMinimumPageSize(Point)55
okButton
private org.eclipse.swt.widgets.Button okButton
- The OK button.
pageContainer
private org.eclipse.swt.widgets.Composite pageContainer
- The Composite in which a page is shown.
preferenceManager
private PreferenceManager preferenceManager
- The preference manager.
showingError
private boolean showingError
- Flag for the presence of the error message.
preferenceStore
private IPreferenceStore preferenceStore
- Preference store, initially
nullmeaning none.
titleArea
private org.eclipse.swt.widgets.Composite titleArea
titleImage
private org.eclipse.swt.widgets.Label titleImage
treeViewer
private org.eclipse.jface.viewers.TreeViewer treeViewer
- The tree viewer.
ellipsis
private final java.lang.String ellipsis
- See Also:
- Constant Field Values
| Constructor Detail |
PreferenceDialog
public PreferenceDialog(org.eclipse.swt.widgets.Shell parentShell, PreferenceManager manager)
- Creates a new preference dialog under the control of the given preference
manager.
| Method Detail |
buttonPressed
protected void buttonPressed(int buttonId)
- Description copied from class:
org.eclipse.jface.dialogs.Dialog - Notifies that this dialog's button with the given id has been pressed.
The
Dialogimplementation of this framework method callsokPressedif the ok button is the pressed, andcancelPressedif the cancel button is the pressed. All other button presses are ignored. Subclasses may override to handle other buttons, but should callsuper.buttonPressedif the default handling of the ok and cancel buttons is desired.
cancelPressed
protected void cancelPressed()
- Description copied from class:
org.eclipse.jface.dialogs.Dialog - Notifies that the cancel button of this dialog has been pressed.
The
Dialogimplementation of this framework method sets this dialog's return code toWindow.CANCELand closes the dialog. Subclasses may override if desired.
clearSelectedNode
void clearSelectedNode()
- Clear the last selected node. This is so that we not chache the last
selection in case of an error.
close
public boolean close()
- Description copied from class:
org.eclipse.jface.window.Window - Closes this window, disposes its shell, and removes this
window from its window manager (if it has one).
This framework method may be extended (
super.closemust be called).
configureShell
protected void configureShell(org.eclipse.swt.widgets.Shell newShell)
- Description copied from class:
org.eclipse.jface.window.Window - Configures the given shell in preparation for opening this window
in it.
The default implementation of this framework method sets the shell's image and gives it a grid layout. Subclasses may extend or reimplement.
constrainShellSize
protected void constrainShellSize()
- Description copied from class:
org.eclipse.jface.window.Window - Constrain the shell size to be no larger than the display bounds.
createButtonsForButtonBar
protected void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent)
- Description copied from class:
org.eclipse.jface.dialogs.Dialog - Adds buttons to this dialog's button bar.
The
Dialogimplementation of this framework method adds standard ok and cancel buttons using thecreateButtonframework method. These standard buttons will be accessible fromgetCancelButton, andgetOKButton. Subclasses may override.
createContents
protected org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
- Description copied from class:
org.eclipse.jface.dialogs.Dialog - The
Dialogimplementation of thisWindowmethod creates and lays out the top level composite for the dialog, and determines the appropriate horizontal and vertical dialog units based on the font size. It then calls thecreateDialogAreaandcreateButtonBarmethods to create the dialog area and button bar, respectively. OverridingcreateDialogAreaandcreateButtonBarare recommended rather than overriding this method.
createDialogArea
protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
- Description copied from class:
org.eclipse.jface.dialogs.Dialog - Creates and returns the contents of the upper part of this dialog (above
the button bar).
The
Dialogimplementation of this framework method creates and returns a newCompositewith standard margins and spacing.The returned control's layout data must be an instance of
GridData. This method must not modify the parent's layout.Subclasses must override this method but may call
superas in the following example:Composite composite = (Composite) super.createDialogArea(parent); //add controls to composite as necessary return composite;
createPageContainer
private org.eclipse.swt.widgets.Composite createPageContainer(org.eclipse.swt.widgets.Composite parent)
- Creates the inner page container.
createTitleArea
private org.eclipse.swt.widgets.Composite createTitleArea(org.eclipse.swt.widgets.Composite parent)
- Creates the wizard's title area.
createMessageAreaData
private org.eclipse.swt.layout.FormData createMessageAreaData()
- Create the layout data for the message area.
createTreeAreaContents
protected org.eclipse.swt.widgets.Control createTreeAreaContents(org.eclipse.swt.widgets.Composite parent)
- Since:
- 3.0
createTreeViewer
protected org.eclipse.jface.viewers.TreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite parent)
- Create a new
TreeViewer.- Since:
- 3.0
findNodeMatching
protected IPreferenceNode findNodeMatching(java.lang.String nodeId)
- Find the
IPreferenceNodethat has data the same id as the supplied value.
getLastTreeWidth
private int getLastTreeWidth()
- Get the last known tree width.
getPreferenceManager
public PreferenceManager getPreferenceManager()
- Returns the preference mananger used by this preference dialog.
getPreferenceStore
public IPreferenceStore getPreferenceStore()
- Description copied from interface:
IPreferencePageContainer - Returns the preference store.
- Specified by:
getPreferenceStorein interfaceIPreferencePageContainer
getSelectedNodePreference
protected java.lang.String getSelectedNodePreference()
- Get the name of the selected item preference
getSingleSelection
protected IPreferenceNode getSingleSelection(org.eclipse.jface.viewers.ISelection selection)
getTreeViewer
protected org.eclipse.jface.viewers.TreeViewer getTreeViewer()
- Since:
- 3.0
handleSave
protected void handleSave()
- Save the values specified in the pages.
The default implementation of this framework method saves all pages of type
PreferencePage(if their store needs saving and is aPreferenceStore).Subclasses may override.
handleShellCloseEvent
protected void handleShellCloseEvent()
- Notifies that the window's close button was pressed, the close menu was
selected, or the ESCAPE key pressed.
The default implementation of this framework method sets the window's return code to
CANCELand closes the window usingclose. Subclasses may extend or reimplement.
helpPressed
protected void helpPressed()
- Notifies of the pressing of the Help button.
The default implementation of this framework method calls
performHelpon the currently active page.
isCurrentPageValid
protected boolean isCurrentPageValid()
- Returns whether the current page is valid.
layoutTreeAreaControl
protected void layoutTreeAreaControl(org.eclipse.swt.widgets.Control control)
- Since:
- 3.0
okPressed
protected void okPressed()
- The preference dialog implementation of this
Dialogframework method sendsperformOkto all pages of the preference dialog, then callshandleSaveon this dialog to save any state, and then callscloseto close this dialog.
selectCurrentPageAgain
void selectCurrentPageAgain()
- Selects the page determined by
lastSuccessfulNodein the page hierarchy.
selectSavedItem
protected void selectSavedItem()
- Selects the saved item in the tree of preference pages. If it cannot do
this it saves the first one.
setErrorMessage
public void setErrorMessage(java.lang.String newErrorMessage)
- Display the given error message. The currently displayed message is saved
and will be redisplayed when the error message is set to
null.
setLastTreeWidth
private void setLastTreeWidth(int width)
- Save the last known tree width.
setHelpAvailable
public void setHelpAvailable(boolean b)
- Sets whether a Help button is available for this dialog.
Clients must call this framework method before the dialog's control has been created.
setMessage
public void setMessage(java.lang.String newMessage)
- Set the message text. If the message line currently displays an error,
the message is stored and will be shown after a call to clearErrorMessage
Shortcut for
setMessage(newMessage, NONE)
setMessage
public void setMessage(java.lang.String newMessage, int newType)
- Sets the message for this dialog with an indication of what type of
message it is.
The valid message types are one of
NONE,INFORMATION,WARNING, orERROR.Note that for backward compatibility, a message of type
ERRORis different than an error message (set usingsetErrorMessage). An error message overrides the current message until the error message is cleared. This method replaces the current message and does not affect the error message.- Since:
- 2.0
setMinimumPageSize
public void setMinimumPageSize(int minWidth,
int minHeight)
- Sets the minimum page size.
setMinimumPageSize
public void setMinimumPageSize(org.eclipse.swt.graphics.Point size)
- Sets the minimum page size.
setPreferenceStore
public void setPreferenceStore(IPreferenceStore store)
- Sets the preference store for this preference dialog.
setSelectedNode
private void setSelectedNode()
- Save the currently selected node.
setSelectedNode
public void setSelectedNode(java.lang.String pageId)
- Sets the name of the selected item preference.
Public equivalent to
setSelectedNodePreference.- Since:
- 3.0
setSelectedNodePreference
protected void setSelectedNodePreference(java.lang.String pageId)
- Sets the name of the selected item preference.
setShellSize
private void setShellSize(int width,
int height)
- Changes the shell size to the given size, ensuring that it is no larger
than the display bounds.
showPage
protected boolean showPage(IPreferenceNode node)
- Shows the preference page corresponding to the given preference node.
Does nothing if that page is already current.
showPageFlippingAbortDialog
void showPageFlippingAbortDialog()
- Shows the "Page Flipping abort" dialog.
update
protected void update()
- Updates this dialog's controls to reflect the current page.
updateButtons
public void updateButtons()
- Description copied from interface:
IPreferencePageContainer - Adjusts the enable state of the OK
button to reflect the state of the currently active
page in this container.
This method is called by the container itself when its preference page changes and may be called by the page at other times to force a button state update.
- Specified by:
updateButtonsin interfaceIPreferencePageContainer
updateMessage
public void updateMessage()
- Description copied from interface:
IPreferencePageContainer - Updates the message (or error message) shown in the message line to
reflect the state of the currently active page in this container.
This method is called by the container itself when its preference page changes and may be called by the page at other times to force a message update.
- Specified by:
updateMessagein interfaceIPreferencePageContainer
getShortenedString
private java.lang.String getShortenedString(java.lang.String textValue)
- Shortened the message if too long.
updateTitle
public void updateTitle()
- Description copied from interface:
IPreferencePageContainer - Updates the title to reflect the state of the
currently active page in this container.
This method is called by the container itself when its page changes and may be called by the page at other times to force a title update.
- Specified by:
updateTitlein interfaceIPreferencePageContainer
updateTreeFont
protected void updateTreeFont(org.eclipse.swt.graphics.Font dialogFont)
- Update the tree to use the specified
Font.- Since:
- 3.0
|
|||||||||
| Home >> All >> org >> eclipse >> jface >> [ preference overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC