Eclipse Platform
2.1

org.eclipse.jface.dialogs
Class ErrorDialog

java.lang.Object
  |
  +--org.eclipse.jface.window.Window
        |
        +--org.eclipse.jface.dialogs.Dialog
              |
              +--org.eclipse.jface.dialogs.IconAndMessageDialog
                    |
                    +--org.eclipse.jface.dialogs.ErrorDialog

public class ErrorDialog
extends IconAndMessageDialog

A dialog to display one or more errors to the user, as contained in an IStatus object. If an error contains additional detailed information then a Details button is automatically supplied, which shows or hides an error details viewer when pressed by the user.

See Also:
IStatus

Inner classes inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
 
Field Summary
static boolean AUTOMATED_MODE
          Static to prevent opening of error dialogs for automated testing.
 
Fields inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog
message, messageLabel
 
Fields inherited from class org.eclipse.jface.dialogs.Dialog
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
 
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK
 
Constructor Summary
ErrorDialog(Shell parentShell, String dialogTitle, String message, IStatus status, int displayMask)
          Creates an error dialog.
 
Method Summary
protected  void buttonPressed(int id)
          Notifies that this dialog's button with the given id has been pressed.
protected  void configureShell(Shell shell)
          Configures the given shell in preparation for opening this window in it.
protected  void createButtonsForButtonBar(Composite parent)
          Adds buttons to this dialog's button bar.
protected  void createDialogAndButtonArea(Composite parent)
          Create the dialog area and the button bar for the receiver.
protected  Control createDialogArea(Composite parent)
          This implementation of the Dialog framework method creates and lays out a composite and calls createMessageArea and createCustomArea to populate it.
protected  List createDropDownList(Composite parent)
          Create this dialog's drop-down list component.
protected  Image getImage()
          Returns the image to display beside the message in this dialog.
 int open()
          Extends Window.open().
static int openError(Shell parent, String dialogTitle, String message, IStatus status)
          Opens an error dialog to display the given error.
static int openError(Shell parentShell, String title, String message, IStatus status, int displayMask)
          Opens an error dialog to display the given error.
protected static boolean shouldDisplay(IStatus status, int mask)
          Returns whether the given status object should be displayed.
 
Methods inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog
createButtonBar, createContents, createMessageArea
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, cancelPressed, close, constrainShellSize, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, createButton, getButton, getButtonBar, getCancelButton, getDialogArea, getImage, getOKButton, initializeBounds, initializeDialogUnits, okPressed, setButtonLayoutData, setButtonLayoutFormData
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, create, createShell, getContents, getDefaultImage, getInitialLocation, getInitialSize, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, setBlockOnOpen, setDefaultImage, setExceptionHandler, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTOMATED_MODE

public static boolean AUTOMATED_MODE
Static to prevent opening of error dialogs for automated testing.
Constructor Detail

ErrorDialog

public ErrorDialog(Shell parentShell,
                   String dialogTitle,
                   String message,
                   IStatus status,
                   int displayMask)
Creates an error dialog. Note that the dialog will have no visual representation (no widgets) until it is told to open.

Normally one should use openError to create and open one of these. This constructor is useful only if the error object being displayed contains child items and you need to specify a mask which will be used to filter the displaying of these children.

Parameters:
parentShell - the shell under which to create this dialog
dialogTitle - the title to use for this dialog, or null to indicate that the default title should be used
message - the message to show in this dialog, or null to indicate that the error's message should be shown as the primary message
status - the error to show to the user
displayMask - the mask to use to filter the displaying of child items, as per IStatus.matches
See Also:
IStatus.matches(int)
Method Detail

buttonPressed

protected void buttonPressed(int id)
Description copied from class: Dialog
Notifies that this dialog's button with the given id has been pressed.

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.

Overrides:
buttonPressed in class Dialog
Following copied from class: org.eclipse.jface.dialogs.Dialog
Parameters:
buttonId - the id of the button that was pressed (see IDialogConstants.*_ID constants)

configureShell

protected void configureShell(Shell shell)
Description copied from class: Window
Configures the given shell in preparation for opening this window in it.

The default implementation of this framework method sets the shell's image and gives it a grid layout. Subclasses may extend or reimplement.

Overrides:
configureShell in class Dialog
Following copied from class: org.eclipse.jface.window.Window
Parameters:
newShell - the shell

createButtonsForButtonBar

protected void createButtonsForButtonBar(Composite parent)
Description copied from class: Dialog
Adds buttons to this dialog's button bar.

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.

Overrides:
createButtonsForButtonBar in class Dialog
Following copied from class: org.eclipse.jface.dialogs.Dialog
Parameters:
parent - the button bar composite

createDialogArea

protected Control createDialogArea(Composite parent)
This implementation of the Dialog framework method creates and lays out a composite and calls createMessageArea and createCustomArea to populate it. Subclasses should override createCustomArea to add contents below the message.
Overrides:
createDialogArea in class Dialog
Following copied from class: org.eclipse.jface.dialogs.Dialog
Parameters:
parent - the parent composite to contain the dialog area
Returns:
the dialog area control

createDialogAndButtonArea

protected void createDialogAndButtonArea(Composite parent)
Description copied from class: IconAndMessageDialog
Create the dialog area and the button bar for the receiver.
Overrides:
createDialogAndButtonArea in class IconAndMessageDialog
Following copied from class: org.eclipse.jface.dialogs.IconAndMessageDialog
Parameters:
parent -  

getImage

protected Image getImage()
Description copied from class: IconAndMessageDialog
Returns the image to display beside the message in this dialog.

Subclasses may override.

Overrides:
getImage in class IconAndMessageDialog
Following copied from class: org.eclipse.jface.dialogs.IconAndMessageDialog
Returns:
the image to display beside the message

createDropDownList

protected List createDropDownList(Composite parent)
Create this dialog's drop-down list component.
Parameters:
parent - the parent composite
Returns:
the drop-down list component

open

public int open()
Extends Window.open(). Opens an error dialog to display the error. If you specified a mask to filter the displaying of these children, the error dialog will only be displayed if there is at least one child status matching the mask.
Overrides:
open in class Window
Following copied from class: org.eclipse.jface.window.Window
Returns:
the return code
See Also:
Window.create()

openError

public static int openError(Shell parent,
                            String dialogTitle,
                            String message,
                            IStatus status)
Opens an error dialog to display the given error. Use this method if the error object being displayed does not contain child items, or if you wish to display all such items without filtering.
Parameters:
parent - the parent shell of the dialog, or null if none
dialogTitle - the title to use for this dialog, or null to indicate that the default title should be used
message - the message to show in this dialog, or null to indicate that the error's message should be shown as the primary message
status - the error to show to the user
Returns:
the code of the button that was pressed that resulted in this dialog closing. This will be Dialog.OK if the OK button was pressed, or Dialog.CANCEL if this dialog's close window decoration or the ESC key was used.

openError

public static int openError(Shell parentShell,
                            String title,
                            String message,
                            IStatus status,
                            int displayMask)
Opens an error dialog to display the given error. Use this method if the error object being displayed contains child items and you wish to specify a mask which will be used to filter the displaying of these children. The error dialog will only be displayed if there is at least one child status matching the mask.
Parameters:
parentShell - the parent shell of the dialog, or null if none
dialogTitle - the title to use for this dialog, or null to indicate that the default title should be used
message - the message to show in this dialog, or null to indicate that the error's message should be shown as the primary message
status - the error to show to the user
displayMask - the mask to use to filter the displaying of child items, as per IStatus.matches
Returns:
the code of the button that was pressed that resulted in this dialog closing. This will be Dialog.OK if the OK button was pressed, or Dialog.CANCEL if this dialog's close window decoration or the ESC key was used.
See Also:
IStatus.matches(int)

shouldDisplay

protected static boolean shouldDisplay(IStatus status,
                                       int mask)
Returns whether the given status object should be displayed.
Parameters:
status - a status object
mask - a mask as per IStatus.matches
Returns:
true if the given status should be displayed, and false otherwise
See Also:
IStatus.matches(int)

Eclipse Platform
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.