net.sourceforge.java.feednread.frontend.configuration
Class ConfigurationDialog

java.lang.Object
  extended byorg.eclipse.jface.window.Window
      extended byorg.eclipse.jface.dialogs.Dialog
          extended byorg.eclipse.jface.dialogs.TrayDialog
              extended byorg.eclipse.jface.preference.PreferenceDialog
                  extended bynet.sourceforge.java.feednread.frontend.configuration.ConfigurationDialog
All Implemented Interfaces:
IPageChangeProvider, IPreferencePageContainer, IShellProvider

public class ConfigurationDialog
extends PreferenceDialog

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

Author:
Sebastian Machhausen

Nested Class Summary
 
Nested classes inherited from class org.eclipse.jface.preference.PreferenceDialog
 
Nested classes inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
 
Field Summary
private  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.TrayDialog
 
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(Shell parentShell, PreferenceManager manager)
           Creates a new ConfigurationDialog under the control of the given PreferenceManager.
 
Method Summary
protected  void addListeners(TreeViewer viewer)
          Add the listeners to the tree viewer.
private  void clearLastSelectedNode()
           Clear the last selected node.
protected  void createButtonsForButtonBar(Composite parent)
           Creates the buttons for the embedded hutton bar.
private  FormData createMessageAreaData()
           Create the layout data for the message area.
protected  Sash createSash(Composite composite, Control leftControl)
           Create the Sashwith left control on the left.
protected  Composite createTitleArea(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.
private  void selectLastVisitedPageAgain()
           Selects the page determined by lastSuccessfulNode in the page hierarchy.
 void setErrorMessage(String newErrorMessage)
           Display the given error message.
 void setMessage(String newMessage, int newType)
           Sets the message for this dialog with an indication of what type of message it is.
protected  boolean showPage(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, 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, create, 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 IPreferenceNode lastSuccessfulNode

The last successful IPreferenceNode visited

Constructor Detail

ConfigurationDialog

public ConfigurationDialog(Shell parentShell,
                           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

setMessage

public void setMessage(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.

Parameters:
newMessage - the message, or null to clear the message
newType - the message type
See Also:
PreferenceDialog.setMessage(String, int)

setErrorMessage

public void setErrorMessage(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.

Parameters:
newErrorMessage - the errorMessage to display or null

updateMessage

public void updateMessage()

Updates the message.

See Also:
IPreferencePageContainer.updateMessage()

updateTitle

public void updateTitle()

Updates the title.

See Also:
IPreferencePageContainer.updateTitle()

updateButtons

public void updateButtons()

Updates the buttons.

See Also:
IPreferencePageContainer.updateButtons()

addListeners

protected void addListeners(TreeViewer viewer)
Add the listeners to the tree viewer.

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.


createTitleArea

protected Composite createTitleArea(Composite parent)

Creates the wizard's title area.

Parameters:
parent - the SWT parent for the title area composite
Returns:
the created title area composite

createButtonsForButtonBar

protected void createButtonsForButtonBar(Composite parent)

Creates the buttons for the embedded hutton bar.

See Also:
Dialog.createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)

createSash

protected Sash createSash(Composite composite,
                          Control leftControl)

Create the Sashwith left control on the left. Note that this method assumes GridData for the layout data of the leftControl.

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

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 FormData createMessageAreaData()

Create the layout data for the message area.

Returns:
FormData for the message area.