## org.eclipse.emf.common.ui.dialogs
Class DiagnosticDialog

    java.lang.Object
      org.eclipse.jface.window.Window
          org.eclipse.jface.dialogs.Dialog
              org.eclipse.jface.dialogs.IconAndMessageDialog
                  org.eclipse.emf.common.ui.dialogs.DiagnosticDialog

All Implemented Interfaces:
  IShellProvider

    public class DiagnosticDialog

extends IconAndMessageDialog

A dialog to display one `Diagnostic` object to the user. If a diagnostic contains additional detailed information then a Details button is automatically supplied, which shows or hides an details viewer when pressed by the user.

Since:
  2.3
See Also:
  `Diagnostic`

Nested Class Summary

Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
`Window.IExceptionHandler`

Field Summary

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
`DiagnosticDialog(Shell parentShell, java.lang.String dialogTitle, java.lang.String message, Diagnostic diagnostic, int severityMask)` Creates an diagnostic dialog.

Method Summary
`protected void` `buttonPressed(int id)` Handles the pressing of the OK or Details button in this dialog.
`boolean` `close()`
`protected void` `configureShell(Shell shell)`
`protected void` `createButtonsForButtonBar(Composite parent)`
`protected void` `createDetailsButton(Composite parent)` Create the details button if it should be included.
`protected DiagnosticComposite` `createDiagnosticComposite(Composite parent)` Create the diagnostic composite.
`protected void` `createDialogAndButtonArea(Composite parent)`
`protected Control` `createDialogArea(Composite parent)` This implementation of the `Dialog` framework method creates and lays out a composite.
`protected Image` `getImage()`
`DiagnosticComposite.TextProvider` `getTextProvider()`
`int` `open()` Extends `Window.open()`.
`static int` `open(Shell parent, java.lang.String dialogTitle, java.lang.String message, Diagnostic diagnostic)` Opens a diagnostic dialog to display the given diagnostic.
`static int` `open(Shell parentShell, java.lang.String title, java.lang.String message, Diagnostic diagnostic, int displayMask)` Opens an diagnostic dialog to display the given diagnostic.
`static int` `openProblem(Shell parent, java.lang.String dialogTitle, java.lang.String message, Diagnostic diagnostic)` Opens a diagnostic dialog to display the given diagnostic.
`protected void` `setDiagnostic(Diagnostic diagnostic)` Set the diagnostic displayed by this diagnostic dialog to the given diagnostic.
`void` `setTextProvider(DiagnosticComposite.TextProvider textProvider)`
`protected static boolean` `shouldDisplay(Diagnostic diagnostic, int mask)` Returns whether the given diagnostic object should be displayed.
`protected boolean` `shouldShowDetailsButton()` Return whether the Details button should be included.

Methods inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog
`createButtonBar, createContents, createMessageArea, 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, createButton, dialogFontIsDefault, getBlockedHandler, getButton, 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, handleShellCloseEvent, 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`

Constructor Detail

### DiagnosticDialog

    public DiagnosticDialog(Shell parentShell,
                            java.lang.String dialogTitle,
                            java.lang.String message,
                            Diagnostic diagnostic,
                            int severityMask)

  Creates an diagnostic dialog. Note that the dialog will have no visual representation (no widgets) until it is told to open.

  Normally one should use `open` to create and open one of these. This constructor is useful only if the diagnostic object being displayed contains child items <it>and </it> you need to specify a mask which will be used to filter the displaying of these children. The diagnostic dialog will only be displayed if there is at least one child diagnostic matching the mask.

  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 diagnostic's message should be shown as the primary message
    `diagnostic` - the diagnostic to show to the user
    `severityMask` - the mask to use to filter the displaying of child items, as per `DiagnosticComposite.severityMatches(Diagnostic, int)`
  See Also:
    `DiagnosticComposite.severityMatches(Diagnostic, int)`

Method Detail

### open

    public static int open(Shell parent,
                           java.lang.String dialogTitle,
                           java.lang.String message,
                           Diagnostic diagnostic)

  Opens a diagnostic dialog to display the given diagnostic. Use this method if the diagnostic 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 diagnostic's message should be shown as the primary message
    `diagnostic` - the diagnostic 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.

### openProblem

    public static int openProblem(Shell parent,
                                  java.lang.String dialogTitle,
                                  java.lang.String message,
                                  Diagnostic diagnostic)

  Opens a diagnostic dialog to display the given diagnostic. Use this method if the diagnostic object being displayed is reporting either an error or a warning. Only children reporting one of this severities are presented.

  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 diagnostic's message should be shown as the primary message
    `diagnostic` - the diagnostic 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.

### open

    public static int open(Shell parentShell,
                           java.lang.String title,
                           java.lang.String message,
                           Diagnostic diagnostic,
                           int displayMask)

  Opens an diagnostic dialog to display the given diagnostic. Use this method if the diagnostic object being displayed contains child items <it>and </it> you wish to specify a mask which will be used to filter the displaying of these children. The diagnostic dialog will only be displayed if there is at least one child diagnostic matching the mask.

  Parameters:
    `parentShell` - the parent shell of the dialog, or `null` if none
    `title` - 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 diagnostic's message should be shown as the primary message
    `diagnostic` - the diagnostic to show to the user
    `displayMask` - the mask to use to filter the displaying of child items, as per `DiagnosticComposite.severityMatches(Diagnostic, int)`
  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:
    `DiagnosticComposite.severityMatches(Diagnostic, int)`

### shouldDisplay

    protected static boolean shouldDisplay(Diagnostic diagnostic,
                                           int mask)

  Returns whether the given diagnostic object should be displayed.

  Parameters:
    `diagnostic` - a diagnostic object
    `mask` - a mask as per `DiagnosticComposite.severityMatches(Diagnostic, int)`
  Returns:
    `true` if the given diagnostic should be displayed, and `false` otherwise
  See Also:
    `DiagnosticComposite.severityMatches(Diagnostic, int)`

### setTextProvider

    public void setTextProvider(DiagnosticComposite.TextProvider textProvider)

### getTextProvider

    public DiagnosticComposite.TextProvider getTextProvider()

### buttonPressed

    protected void buttonPressed(int id)

  Handles the pressing of the OK or Details button in this dialog. If the OK button was pressed then close this dialog. If the Details button was pressed then toggle the displaying of the diagnostic details area. Note that the Details button will only be visible if the diagnostic being displayed specifies child details.

  Overrides:
    `buttonPressed` in class `Dialog`

### configureShell

    protected void configureShell(Shell shell)

  Overrides:
    `configureShell` in class `Window`

### createButtonsForButtonBar

    protected void createButtonsForButtonBar(Composite parent)

  Overrides:
    `createButtonsForButtonBar` in class `Dialog`

### createDetailsButton

    protected void createDetailsButton(Composite parent)

  Create the details button if it should be included.

  Parameters:
    `parent` - the parent composite

### createDialogArea

    protected Control createDialogArea(Composite parent)

  This implementation of the `Dialog` framework method creates and lays out a composite. Subclasses that require a different dialog area may either override this method, or call the `super` implementation and add controls to the created composite.

  Overrides:
    `createDialogArea` in class `Dialog`

### createDialogAndButtonArea

    protected void createDialogAndButtonArea(Composite parent)

  Overrides:
    `createDialogAndButtonArea` in class `IconAndMessageDialog`

### getImage

    protected Image getImage()

  Specified by:
    `getImage` in class `IconAndMessageDialog`

### createDiagnosticComposite

    protected DiagnosticComposite createDiagnosticComposite(Composite parent)

  Create the diagnostic composite.

  Parameters:
    `parent` - the parent composite
  Returns:
    the diagnostic composite

### open

    public int open()

  Extends `Window.open()`. Opens an diagnostic dialog to display the diagnostic. If you specified a mask to filter the displaying of these children, the diagnostic dialog will only be displayed if there is at least one child diagnostic matching the mask.

  Overrides:
    `open` in class `Window`

### close

    public boolean close()

  Overrides:
    `close` in class `Dialog`

### shouldShowDetailsButton

    protected boolean shouldShowDetailsButton()

  Return whether the Details button should be included. This method is invoked once when the dialog is built. By default, the Details button is only included if the diagnostic used when creating the dialog was a multi-diagnostic or if the diagnostic contains an exception. Subclasses may override.

  Returns:
    whether the Details button should be included

### setDiagnostic

    protected final void setDiagnostic(Diagnostic diagnostic)

  Set the diagnostic displayed by this diagnostic dialog to the given diagnostic. This only affects the diagnostic displayed by the diagnostic composite. The message, image and title should be updated by the subclass, if desired.

  Parameters:
    `diagnostic` - the diagnostic to be displayed in the diagnostic composite

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.