|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.window.Window
org.eclipse.jface.dialogs.Dialog
org.eclipse.jface.preference.PreferenceDialog
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 |
---|
Nested classes inherited from class org.eclipse.jface.window.Window |
---|
Window.IExceptionHandler |
Field Summary | |
---|---|
static String |
PREF_DLG_IMG_TITLE_ERROR
Indentifier for the error image |
static String |
PREF_DLG_TITLE_IMG
Title area fields |
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(Shell parentShell,
PreferenceManager manager)
Creates a new preference dialog under the control of the given preference manager. |
Method Summary | |
---|---|
protected void |
addListeners(TreeViewer viewer)
Add the listeners to the tree viewer. |
void |
addPageChangedListener(IPageChangedListener listener)
Adds a listener for page changes in this page change provider. |
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. |
boolean |
close()
Closes this window, disposes its shell, and removes this window from its window manager (if it has one). |
protected void |
configureShell(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(Composite parent)
Adds buttons to this dialog's button bar. |
protected Control |
createContents(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 Control |
createDialogArea(Composite parent)
Creates and returns the contents of the upper part of this dialog (above the button bar). |
protected void |
createPage(IPreferenceNode node)
Create the page for the node. |
protected Composite |
createPageContainer(Composite parent)
Creates the inner page container. |
protected void |
createPageControl(IPreferencePage page,
Composite parent)
Create the page control for the supplied page. |
protected Sash |
createSash(Composite composite,
Control rightControl)
Create the sash with right control on the right. |
protected Composite |
createTitleArea(Composite parent)
Creates the wizard's title area. |
protected Control |
createTreeAreaContents(Composite parent)
|
protected TreeViewer |
createTreeViewer(Composite parent)
Create a new TreeViewer . |
protected IPreferenceNode |
findNodeMatching(String nodeId)
Find the IPreferenceNode that has data the same id as the
supplied value. |
protected void |
firePageChanged(PageChangedEvent event)
Notifies any selection changed listeners that the selected page has changed. |
protected IPreferencePage |
getCurrentPage()
Returns the currentPage. |
protected int |
getLastRightWidth()
Get the last known right side width. |
protected IPreferencePage |
getPage(IPreferenceNode node)
Get the page for the node. |
protected Composite |
getPageContainer()
Get the composite that is showing the page. |
protected Layout |
getPageLayout()
Return the layout for the composite that contains the pages. |
PreferenceManager |
getPreferenceManager()
Returns the preference mananger used by this preference dialog. |
IPreferenceStore |
getPreferenceStore()
Returns the preference store. |
protected String |
getSelectedNodePreference()
Get the name of the selected item preference |
Object |
getSelectedPage()
Returns the currently selected page in the dialog. |
protected IPreferenceNode |
getSingleSelection(ISelection selection)
|
protected 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(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. |
void |
removePageChangedListener(IPageChangedListener listener)
Removes the given page change listener from this page change provider. |
protected void |
selectSavedItem()
Selects the saved item in the tree of preference pages. |
protected void |
setCurrentPage(IPreferencePage currentPage)
Sets the current page. |
void |
setErrorMessage(String newErrorMessage)
Display the given error message. |
void |
setHelpAvailable(boolean b)
Sets whether a Help button is available for this dialog. |
void |
setMessage(String newMessage)
Set the message text. |
void |
setMessage(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(Point size)
Sets the minimum page size. |
protected void |
setPageContainer(Composite pageContainer)
Set the composite that is showing the page. |
void |
setPreferenceStore(IPreferenceStore store)
Sets the preference store for this preference dialog. |
void |
setSelectedNode(String pageId)
Sets the name of the selected item preference. |
protected void |
setSelectedNodePreference(String pageId)
Sets the name of the selected item preference. |
protected void |
setTreeViewer(TreeViewer treeViewer)
Set the treeViewer. |
protected boolean |
showPage(IPreferenceNode node)
Shows the preference page corresponding to the given preference node. |
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(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, getDefaultOrientation, getInitialLocation, getInitialSize, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String PREF_DLG_IMG_TITLE_ERROR
public static final String PREF_DLG_TITLE_IMG
Constructor Detail |
public PreferenceDialog(Shell parentShell, PreferenceManager manager)
parentShell
- the parent shellmanager
- the preference managerMethod Detail |
protected void buttonPressed(int buttonId)
Dialog
The Dialog
implementation of this framework method calls
okPressed
if the ok button is the pressed, and
cancelPressed
if the cancel button is the pressed. All
other button presses are ignored. Subclasses may override to handle other
buttons, but should call super.buttonPressed
if the
default handling of the ok and cancel buttons is desired.
buttonPressed
in class Dialog
buttonId
- the id of the button that was pressed (see
IDialogConstants.*_ID
constants)protected void cancelPressed()
Dialog
The Dialog
implementation of this framework method sets
this dialog's return code to Window.CANCEL
and closes the
dialog. Subclasses may override if desired.
cancelPressed
in class Dialog
public boolean close()
Window
This framework method may be extended (super.close
must
be called).
close
in class Dialog
Window.close()
protected void configureShell(Shell newShell)
Window
The default implementation of this framework method sets the shell's image and gives it a grid layout. Subclasses may extend or reimplement.
configureShell
in class Window
newShell
- the shellprotected void constrainShellSize()
Window
constrainShellSize
in class Window
protected void createButtonsForButtonBar(Composite parent)
Dialog
The Dialog
implementation of this framework method adds
standard ok and cancel buttons using the createButton
framework method. These standard buttons will be accessible from
getCancelButton
, and getOKButton
.
Subclasses may override.
createButtonsForButtonBar
in class Dialog
parent
- the button bar compositeprotected Control createContents(Composite parent)
Dialog
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. It then calls the createDialogArea
and
createButtonBar
methods to create the dialog area and
button bar, respectively. Overriding createDialogArea
and
createButtonBar
are recommended rather than overriding
this method.
createContents
in class Dialog
protected Control createDialogArea(Composite parent)
Dialog
The Dialog
implementation of this framework method creates
and returns a new Composite
with 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 super
as
in the following example:
Composite composite = (Composite) super.createDialogArea(parent); //add controls to composite as necessary return composite;
createDialogArea
in class Dialog
parent
- the parent composite to contain the dialog area
protected Sash createSash(Composite composite, Control rightControl)
composite
- rightControl
-
protected Composite createPageContainer(Composite parent)
parent
-
protected Layout getPageLayout()
protected Composite createTitleArea(Composite parent)
parent
- the SWT parent for the title area composite.
protected Control createTreeAreaContents(Composite parent)
parent
- the SWT parent for the tree area controls.
Control
.protected TreeViewer createTreeViewer(Composite parent)
TreeViewer
.
parent
- the parent Composite
.
TreeViewer
.protected void addListeners(TreeViewer viewer)
viewer
- protected IPreferenceNode findNodeMatching(String nodeId)
IPreferenceNode
that has data the same id as the
supplied value.
nodeId
- the id to search for.
IPreferenceNode
or null
if not
found.protected int getLastRightWidth()
public PreferenceManager getPreferenceManager()
public IPreferenceStore getPreferenceStore()
IPreferencePageContainer
getPreferenceStore
in interface IPreferencePageContainer
null
if noneprotected String getSelectedNodePreference()
protected IPreferenceNode getSingleSelection(ISelection selection)
selection
- the ISelection
to examine.
protected TreeViewer getTreeViewer()
TreeViewer
for this dialog.protected void handleSave()
The default implementation of this framework method saves all pages of
type PreferencePage
(if their store needs saving and is a
PreferenceStore
).
Subclasses may override.
protected void handleShellCloseEvent()
The default implementation of this framework method sets the window's
return code to CANCEL
and closes the window using
close
. Subclasses may extend or reimplement.
handleShellCloseEvent
in class Window
protected void helpPressed()
The default implementation of this framework method calls
performHelp
on the currently active page.
protected boolean isCurrentPageValid()
false
if the current page is not valid, or or
true
if the current page is valid or there is no
current pageprotected void layoutTreeAreaControl(Control control)
control
- the Control
to lay out.protected void okPressed()
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.
okPressed
in class Dialog
protected void selectSavedItem()
public void setErrorMessage(String newErrorMessage)
null
.
newErrorMessage
- the errorMessage to display or null
public void setHelpAvailable(boolean b)
Clients must call this framework method before the dialog's control has been created.
b
- true
to include a Help button, and
false
to not include one (the default)public void setMessage(String newMessage)
Shortcut for setMessage(newMessage, NONE)
newMessage
- the message, or null
to clear the messagepublic void setMessage(String newMessage, int newType)
The valid message types are one of NONE
,
INFORMATION
,WARNING
, or
ERROR
.
Note that for backward compatibility, a message of type
ERROR
is different than an error message (set using
setErrorMessage
). 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.
newMessage
- the message, or null
to clear the messagenewType
- the message typepublic void setMinimumPageSize(int minWidth, int minHeight)
minWidth
- the minimum page widthminHeight
- the minimum page heightsetMinimumPageSize(Point)
public void setMinimumPageSize(Point size)
size
- the page size encoded as new Point(width,height)
setMinimumPageSize(int,int)
public void setPreferenceStore(IPreferenceStore store)
store
- the preference storegetPreferenceStore()
public void setSelectedNode(String pageId)
setSelectedNodePreference
.
pageId
- The identifier for the pageprotected void setSelectedNodePreference(String pageId)
pageId
- The identifier for the pageprotected boolean showPage(IPreferenceNode node)
node
- the preference node, or null
if none
true
if the page flip was successful, and
false
is unsuccessfulprotected void createPage(IPreferenceNode node)
node
- protected IPreferencePage getPage(IPreferenceNode node)
node
-
protected void update()
public void updateButtons()
IPreferencePageContainer
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.
updateButtons
in interface IPreferencePageContainer
public void updateMessage()
IPreferencePageContainer
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.
updateMessage
in interface IPreferencePageContainer
public void updateTitle()
IPreferencePageContainer
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.
updateTitle
in interface IPreferencePageContainer
protected void updateTreeFont(Font dialogFont)
Font
.
dialogFont
- the Font
to use.protected IPreferencePage getCurrentPage()
protected void setCurrentPage(IPreferencePage currentPage)
currentPage
- protected void setTreeViewer(TreeViewer treeViewer)
treeViewer
- protected Composite getPageContainer()
protected void setPageContainer(Composite pageContainer)
pageContainer
- Compositeprotected void createPageControl(IPreferencePage page, Composite parent)
page
- - the preference page to be shownparent
- - the composite to parent the pagepublic Object getSelectedPage()
IPageChangeProvider
getSelectedPage
in interface IPageChangeProvider
null
if none is
selected. The type may be domain specific. In
the JFace provided dialogs this will be an instance of
IDialogPage
.IPageChangeProvider.getSelectedPage()
public void addPageChangedListener(IPageChangedListener listener)
IPageChangeProvider
addPageChangedListener
in interface IPageChangeProvider
listener
- a page changed listenerIPageChangeProvider.addPageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener)
public void removePageChangedListener(IPageChangedListener listener)
IPageChangeProvider
removePageChangedListener
in interface IPageChangeProvider
listener
- a page changed listenerIPageChangeProvider.removePageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener)
protected void firePageChanged(PageChangedEvent event)
event
- a selection changed eventIPageChangedListener.pageChanged(org.eclipse.jface.dialogs.PageChangedEvent)
|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.