com.ibm.commons.swt.dialog
Class LWPDMessageDialog

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by org.eclipse.jface.dialogs.IconAndMessageDialog
              extended by org.eclipse.jface.dialogs.MessageDialog
                  extended by com.ibm.commons.swt.dialog.LWPDMessageDialog
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider

public class LWPDMessageDialog
extends org.eclipse.jface.dialogs.MessageDialog

Subclass of MessageDialog to add some accessibility features. Static helper methods have been supplied to allow users to open error/warning/info dialogs easily.

See Also:
MessageDialog

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
protected  org.eclipse.swt.accessibility.AccessibleListener imageAccListener
           
 
Fields inherited from class org.eclipse.jface.dialogs.MessageDialog
ERROR, INFORMATION, NONE, QUESTION, WARNING
 
Fields inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog
imageLabel, message, messageLabel
 
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
LWPDMessageDialog(org.eclipse.swt.widgets.Shell parentShell, java.lang.String dialogTitle, org.eclipse.swt.graphics.Image dialogTitleImage, java.lang.String dialogMessage, int dialogImageType, java.lang.String[] dialogButtonLabels, int defaultIndex)
          Create a message dialog.
 
Method Summary
 boolean close()
           
protected  org.eclipse.swt.widgets.Control createMessageArea(org.eclipse.swt.widgets.Composite composite)
           
protected  java.lang.String getImageTooltip()
           
static boolean openConfirm(org.eclipse.swt.widgets.Shell parent, java.lang.String title, java.lang.String message)
           
static void openError(org.eclipse.swt.widgets.Shell shell, java.lang.Exception ex)
          Opens a dialog with error in the title bar.
static void openError(org.eclipse.swt.widgets.Shell parent, java.lang.String title, java.lang.String message)
           
static void openInformation(org.eclipse.swt.widgets.Shell parent, java.lang.String title, java.lang.String message)
           
static boolean openQuestion(org.eclipse.swt.widgets.Shell parent, java.lang.String title, java.lang.String message)
           
static void openWarning(org.eclipse.swt.widgets.Shell parent, java.lang.String title, java.lang.String message)
           
 
Methods inherited from class org.eclipse.jface.dialogs.MessageDialog
buttonPressed, configureShell, createButton, createButtonsForButtonBar, createCustomArea, createDialogArea, customShouldTakeFocus, getButton, getButtonLabels, getDefaultButtonIndex, getImage, getMinimumMessageWidth, handleShellCloseEvent, setButtonLabels, setButtons
 
Methods inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog
createButtonBar, createContents, createDialogAndButtonArea, getErrorImage, getInfoImage, getMessageLabelStyle, getQuestionImage, getWarningImage
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, dialogFontIsDefault, getBlockedHandler, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, isResizable, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, 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

imageAccListener

protected org.eclipse.swt.accessibility.AccessibleListener imageAccListener
Constructor Detail

LWPDMessageDialog

public LWPDMessageDialog(org.eclipse.swt.widgets.Shell parentShell,
                         java.lang.String dialogTitle,
                         org.eclipse.swt.graphics.Image dialogTitleImage,
                         java.lang.String dialogMessage,
                         int dialogImageType,
                         java.lang.String[] dialogButtonLabels,
                         int defaultIndex)
Create a message dialog. Note that the dialog will have no visual representation (no widgets) until it is told to open.

The labels of the buttons to appear in the button bar are supplied in this constructor as an array. The Window.open() method will return the index of the label in this array corresponding to the button that was pressed to close the dialog. If the dialog was dismissed without pressing a button (ESC, etc.) then -1 is returned.
Note that the open method blocks.

Parameters:
parentShell - the parent shell
dialogTitle - the message to appear in the dialog's title bar
dialogTitleImage - the image to appear in the dialog's title bar
dialogMessage - the message to appear in the dialog's body
dialogImageType - the image to appear in the dialog's body
dialogButtonLabels - an array of labels to be used for buttons in the button bar
defaultIndex - the index of the button that is to be selected by default
Method Detail

createMessageArea

protected org.eclipse.swt.widgets.Control createMessageArea(org.eclipse.swt.widgets.Composite composite)
Overrides:
createMessageArea in class org.eclipse.jface.dialogs.IconAndMessageDialog

close

public boolean close()
Overrides:
close in class org.eclipse.jface.dialogs.Dialog

getImageTooltip

protected java.lang.String getImageTooltip()

openConfirm

public static boolean openConfirm(org.eclipse.swt.widgets.Shell parent,
                                  java.lang.String title,
                                  java.lang.String message)

openError

public static void openError(org.eclipse.swt.widgets.Shell parent,
                             java.lang.String title,
                             java.lang.String message)

openError

public static void openError(org.eclipse.swt.widgets.Shell shell,
                             java.lang.Exception ex)
Opens a dialog with error in the title bar. Calls openError(Shell, String, String).

Parameters:
shell - the parent shell
ex - the exception to display to the end user

openInformation

public static void openInformation(org.eclipse.swt.widgets.Shell parent,
                                   java.lang.String title,
                                   java.lang.String message)

openQuestion

public static boolean openQuestion(org.eclipse.swt.widgets.Shell parent,
                                   java.lang.String title,
                                   java.lang.String message)

openWarning

public static void openWarning(org.eclipse.swt.widgets.Shell parent,
                               java.lang.String title,
                               java.lang.String message)