org.mailster.gui.prefs
Class ConfigurationDialog

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by org.eclipse.jface.dialogs.TrayDialog
              extended by org.eclipse.jface.preference.PreferenceDialog
                  extended by org.mailster.gui.prefs.ConfigurationDialog
All Implemented Interfaces:
org.eclipse.jface.dialogs.IPageChangeProvider, org.eclipse.jface.preference.IPreferencePageContainer, org.eclipse.jface.window.IShellProvider

public class ConfigurationDialog
extends org.eclipse.jface.preference.PreferenceDialog

Dialog to manage the application configuration on end-user side.

Author:
Sebastian Machhausen This file has been used and modified., Edouard De Oliveira

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
private  org.eclipse.jface.preference.IPreferenceNode lastSuccessfulNode
          The last successful IPreferenceNode visited
private  DialogMessageArea messageArea
          The customized DialogMessageArea
 
Fields inherited from class org.eclipse.jface.preference.PreferenceDialog
FAILED, PREF_DLG_IMG_TITLE_ERROR, PREF_DLG_TITLE_IMG
 
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
 
Constructor Summary
ConfigurationDialog(org.eclipse.swt.widgets.Shell parentShell, org.eclipse.jface.preference.PreferenceManager manager)
          Creates a new ConfigurationDialog under the control of the given PreferenceManager.
 
Method Summary
protected  void addListeners(org.eclipse.jface.viewers.TreeViewer viewer)
          Add the listeners to the tree viewer.
private  void clearLastSelectedNode()
          Clear the last selected node.
 void create()
           
protected  void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent)
          Creates the buttons for the embedded hutton bar.
private  org.eclipse.swt.layout.FormData createMessageAreaData()
          Create the layout data for the message area.
private static void createPreferenceTree(org.eclipse.jface.preference.PreferenceManager mgr)
          Creates the preference tree structure.
protected  org.eclipse.swt.widgets.Sash createSash(org.eclipse.swt.widgets.Composite composite, org.eclipse.swt.widgets.Control leftControl)
          Create the Sashwith left control on the left.
protected  org.eclipse.swt.widgets.Composite createTitleArea(org.eclipse.swt.widgets.Composite parent)
          Creates the wizard's title area.
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.
static void run(org.eclipse.swt.widgets.Shell shell)
          Creates and shows the configuration dialog.
private  void selectLastVisitedPageAgain()
          Selects the page determined by lastSuccessfulNode in the page hierarchy.
 void setErrorMessage(java.lang.String newErrorMessage)
          Display the given error message.
 void setMessage(java.lang.String newMessage, int newType)
           Sets the message for this dialog with an indication of what type of message it is.
protected  boolean showPage(org.eclipse.jface.preference.IPreferenceNode node)
          Shows the preference page corresponding to the given preference node.
private  void showPageFlippingAbortError()
          Shows an error indicating that the status of the currently selected page is inavlid and has to be corrected.
 void updateButtons()
          Updates the buttons.
 void updateMessage()
          Updates the message.
 void updateTitle()
          Updates the title.
 
Methods inherited from class org.eclipse.jface.preference.PreferenceDialog
addPageChangedListener, buttonPressed, cancelPressed, close, configureShell, constrainShellSize, createContents, createDialogArea, createPage, createPageContainer, createPageControl, createTreeAreaContents, createTreeViewer, findNodeMatching, firePageChanged, getCurrentPage, getLastRightWidth, getPage, getPageContainer, getPageLayout, getPreferenceManager, getPreferenceStore, getSelectedNodePreference, getSelectedPage, getSingleSelection, getTreeViewer, handleSave, handleShellCloseEvent, helpPressed, isCurrentPageValid, isResizable, layoutTreeAreaControl, removePageChangedListener, selectSavedItem, setCurrentPage, setMessage, setMinimumPageSize, setMinimumPageSize, setPageContainer, setPreferenceStore, setSelectedNode, setSelectedNodePreference, setTreeViewer, update, updateTreeFont
 
Methods inherited from class org.eclipse.jface.dialogs.TrayDialog
closeTray, createButtonBar, createHelpControl, getLayout, getTray, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, createButton, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, 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

messageArea

private DialogMessageArea messageArea
The customized DialogMessageArea


lastSuccessfulNode

private org.eclipse.jface.preference.IPreferenceNode lastSuccessfulNode
The last successful IPreferenceNode visited

Constructor Detail

ConfigurationDialog

public ConfigurationDialog(org.eclipse.swt.widgets.Shell parentShell,
                           org.eclipse.jface.preference.PreferenceManager manager)
Creates a new ConfigurationDialog under the control of the given PreferenceManager.

Parameters:
parentShell - the parent Shelll
manager - the PreferenceManager which controls this ConfigurationDialog
Method Detail

create

public void create()
Overrides:
create in class org.eclipse.jface.dialogs.Dialog

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, 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.

Overrides:
setMessage in class org.eclipse.jface.preference.PreferenceDialog
Parameters:
newMessage - the message, or null to clear the message
newType - the message type
See Also:
PreferenceDialog.setMessage(String, int)

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.

Overrides:
setErrorMessage in class org.eclipse.jface.preference.PreferenceDialog
Parameters:
newErrorMessage - the errorMessage to display or null

updateMessage

public void updateMessage()
Updates the message.

Specified by:
updateMessage in interface org.eclipse.jface.preference.IPreferencePageContainer
Overrides:
updateMessage in class org.eclipse.jface.preference.PreferenceDialog
See Also:
IPreferencePageContainer.updateMessage()

updateTitle

public void updateTitle()
Updates the title.

Specified by:
updateTitle in interface org.eclipse.jface.preference.IPreferencePageContainer
Overrides:
updateTitle in class org.eclipse.jface.preference.PreferenceDialog
See Also:
IPreferencePageContainer.updateTitle()

updateButtons

public void updateButtons()
Updates the buttons.

Specified by:
updateButtons in interface org.eclipse.jface.preference.IPreferencePageContainer
Overrides:
updateButtons in class org.eclipse.jface.preference.PreferenceDialog
See Also:
IPreferencePageContainer.updateButtons()

addListeners

protected void addListeners(org.eclipse.jface.viewers.TreeViewer viewer)
Add the listeners to the tree viewer.

Overrides:
addListeners in class org.eclipse.jface.preference.PreferenceDialog
Parameters:
viewer -
Since:
3.1

okPressed

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.

Overrides:
okPressed in class org.eclipse.jface.preference.PreferenceDialog

createTitleArea

protected org.eclipse.swt.widgets.Composite createTitleArea(org.eclipse.swt.widgets.Composite parent)
Creates the wizard's title area.

Overrides:
createTitleArea in class org.eclipse.jface.preference.PreferenceDialog
Parameters:
parent - the SWT parent for the title area composite
Returns:
the created title area composite

createButtonsForButtonBar

protected void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent)
Creates the buttons for the embedded hutton bar.

Overrides:
createButtonsForButtonBar in class org.eclipse.jface.preference.PreferenceDialog
See Also:
Dialog.createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)

createSash

protected org.eclipse.swt.widgets.Sash createSash(org.eclipse.swt.widgets.Composite composite,
                                                  org.eclipse.swt.widgets.Control leftControl)
Create the Sashwith left control on the left. Note that this method assumes GridData for the layout data of the leftControl.

Overrides:
createSash in class org.eclipse.jface.preference.PreferenceDialog
Parameters:
composite - the Composite to embed the Sash into
leftControl - the Control at the left side of the Sash
Returns:
Sash the created Sash

showPage

protected boolean showPage(org.eclipse.jface.preference.IPreferenceNode node)
Shows the preference page corresponding to the given preference node. Does nothing if that page is already current. This implementation prevents auto resizing.

Overrides:
showPage in class org.eclipse.jface.preference.PreferenceDialog
Parameters:
node - the preference node, or null if none
Returns:
true if the page flip was successful; false if unsuccessful

selectLastVisitedPageAgain

private void selectLastVisitedPageAgain()
Selects the page determined by lastSuccessfulNode in the page hierarchy.


clearLastSelectedNode

private void clearLastSelectedNode()
Clear the last selected node. This is so that we not chache the last selection in case of an error.


showPageFlippingAbortError

private void showPageFlippingAbortError()
Shows an error indicating that the status of the currently selected page is inavlid and has to be corrected.


createMessageAreaData

private org.eclipse.swt.layout.FormData createMessageAreaData()
Create the layout data for the message area.

Returns:
FormData for the message area.

run

public static void run(org.eclipse.swt.widgets.Shell shell)
Creates and shows the configuration dialog.

Parameters:
shell - the shell to attach to

createPreferenceTree

private static void createPreferenceTree(org.eclipse.jface.preference.PreferenceManager mgr)
Creates the preference tree structure.

Parameters:
mgr - the PreferenceManager that the PreferenceNodes should be embedded in