Eclipse eRCP
Release 1.1

org.eclipse.jface.preference
Class PreferenceDialog

java.lang.Object
  extended byorg.eclipse.swt.widgets.Dialog
      extended byorg.eclipse.ercp.swt.mobile.MultiPageDialog
          extended byorg.eclipse.jface.preference.PreferenceDialog
All Implemented Interfaces:
IPreferencePageContainer

public class PreferenceDialog
extends MultiPageDialog
implements IPreferencePageContainer

A preference dialog is a presentation of preference pages. Each page is represented by a node that may be selected from within the dialog. When a node is selected, the corresponding page is shown.


Field Summary
protected  PreferenceManager preferenceManager
           
 
Constructor Summary
PreferenceDialog(Shell parentShell)
          Construct PreferenceDialog
PreferenceDialog(Shell parentShell, PreferenceManager manager)
          Construct PreferenceDialog and set its PreferenceManager
 
Method Summary
protected  void cancelPressed()
           
protected  void checkSubclass()
          Override checkSubclass so that Mobile Extensions impl does not complain about sublcassing MultiPageDialog
 void close()
          Override MultiPageDialog close in order to clean up commands
protected  Control createContents(PreferenceDialog parent)
          Create all the pages and select one if directed
protected  Composite createPage(IPreferenceNode node)
           
protected  void createPageControl(PreferencePage page, Composite parent)
          Create the page control for the supplied page.
protected  Composite createSubPages(IPreferenceNode node)
           
 IPreferenceStore getPreferenceStore()
          Returns the preference store.
protected  void handleSave()
          Save the values specified in the pages.
protected  void okPressed()
          The preference dialog implementation of this Dialog framework method sends performOk to all Nodes of the preference dialog, then calls handleSave on this dialog to save any state, and then calls close to close this dialog.
 void open()
          Override MultiPageDialog open in order to get pages created
 void setPreferenceStore(IPreferenceStore store)
          Sets the preference store for this preference dialog.
 void setSelectedNode(String pageId)
          Sets the name of the selected item preference.
 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.
 
Methods inherited from class org.eclipse.ercp.swt.mobile.MultiPageDialog
addListener, addSelectionListener, createPage, deletePage, dispose, getPage, getPageCount, getSelectionIndex, getTitle, removeListener, removeSelectionListener, setImage, setSelection, setTitle
 
Methods inherited from class org.eclipse.swt.widgets.Dialog
getParent, getStyle, getText, setText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preferenceManager

protected PreferenceManager preferenceManager
Constructor Detail

PreferenceDialog

public PreferenceDialog(Shell parentShell)
Construct PreferenceDialog

Parameters:
parentShell -

PreferenceDialog

public PreferenceDialog(Shell parentShell,
                        PreferenceManager manager)
Construct PreferenceDialog and set its PreferenceManager

Parameters:
parentShell -
manager -
Method Detail

checkSubclass

protected void checkSubclass()
Override checkSubclass so that Mobile Extensions impl does not complain about sublcassing MultiPageDialog

Overrides:
checkSubclass in class Dialog
See Also:
Widget.checkSubclass()

createContents

protected Control createContents(PreferenceDialog parent)
Create all the pages and select one if directed

Parameters:
parent -
Returns:
control parentDialog

createSubPages

protected Composite createSubPages(IPreferenceNode node)

createPage

protected Composite createPage(IPreferenceNode node)

createPageControl

protected void createPageControl(PreferencePage page,
                                 Composite parent)
Create the page control for the supplied page.

Parameters:
page - - the preference page to be shown
parent - - the composite to parent the page
Since:
3.1

open

public void open()
Override MultiPageDialog open in order to get pages created

Overrides:
open in class MultiPageDialog

close

public void close()
Override MultiPageDialog close in order to clean up commands

Overrides:
close in class MultiPageDialog
See Also:
Shell.close()

okPressed

protected void okPressed()
The preference dialog implementation of this Dialog framework method sends performOk to all Nodes of the preference dialog, then calls handleSave on this dialog to save any state, and then calls close to close this dialog.


cancelPressed

protected void cancelPressed()

setPreferenceStore

public void setPreferenceStore(IPreferenceStore store)
Sets the preference store for this preference dialog.

Parameters:
store - the preference store
See Also:
getPreferenceStore()

getPreferenceStore

public IPreferenceStore getPreferenceStore()
Description copied from interface: IPreferencePageContainer
Returns the preference store.

Specified by:
getPreferenceStore in interface IPreferencePageContainer
Returns:
the preference store, or null if none

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:
updateButtons in interface IPreferencePageContainer

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:
updateMessage in interface IPreferencePageContainer

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:
updateTitle in interface IPreferencePageContainer

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 a PreferenceStore).

Subclasses may override.


setSelectedNode

public void setSelectedNode(String pageId)
Sets the name of the selected item preference. Public equivalent to setSelectedNodePreference.

Parameters:
pageId - The identifier for the page
Since:
3.0

Eclipse eRCP
Release 1.1