Package com.iizigo
Class ExceptionDetailsErrorDialog
java.lang.Object
org.eclipse.jface.window.Window
org.eclipse.jface.dialogs.Dialog
org.eclipse.jface.dialogs.IconAndMessageDialog
com.iizigo.ExceptionDetailsErrorDialog
- All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
public class ExceptionDetailsErrorDialog extends org.eclipse.jface.dialogs.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
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandlerField Summary
Fields inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog
imageLabel, message, messageLabelFields 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, ELLIPSISFields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurredConstructor Summary
ConstructorsConstructorDescriptionExceptionDetailsErrorDialog(org.eclipse.swt.widgets.Shell parentShell, String dialogTitle, String message, org.eclipse.core.runtime.IStatus status, int displayMask) Creates an error dialog.Method Summary
Modifier and TypeMethodDescriptionprotected voidbuttonPressed(int id) booleanclose()protected voidconfigureShell(org.eclipse.swt.widgets.Shell shell) protected voidcreateButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent) protected voidcreateDetailsButton(org.eclipse.swt.widgets.Composite parent) Create the details button if it should be included.protected voidcreateDialogAndButtonArea(org.eclipse.swt.widgets.Composite parent) protected org.eclipse.swt.widgets.ControlcreateDialogArea(org.eclipse.swt.widgets.Composite parent) This implementation of theDialogframework method creates and lays out a composite and callscreateMessageAreaandcreateCustomAreato populate it.protected org.eclipse.swt.widgets.TextcreateDropDownList(org.eclipse.swt.widgets.Composite parent) Create this dialog's drop-down list component.protected org.eclipse.swt.graphics.ImagegetImage()intopen()ExtendsWindow.open().static intopenError(org.eclipse.swt.widgets.Shell parent, String dialogTitle, String message, org.eclipse.core.runtime.IStatus status) Opens an error dialog to display the given error.static intopenError(org.eclipse.swt.widgets.Shell parentShell, String title, String message, org.eclipse.core.runtime.IStatus status, int displayMask) Opens an error dialog to display the given error.protected final voidsetStatus(org.eclipse.core.runtime.IStatus status) Set the status displayed by this error dialog to the given status.protected static booleanshouldDisplay(org.eclipse.core.runtime.IStatus status, int mask) Returns whether the given status object should be displayed.protected booleanReturn whether the Details button should be included.protected final voidShow the details portion of the dialog if it is not already visible.Methods inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog
createButtonBar, createContents, createMessageArea, getColumnCount, getErrorImage, getInfoImage, getMessageLabelStyle, getQuestionImage, getWarningImageMethods 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, shortenTextMethods 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
Constructor Details
ExceptionDetailsErrorDialog
public ExceptionDetailsErrorDialog(org.eclipse.swt.widgets.Shell parentShell, String dialogTitle, String message, org.eclipse.core.runtime.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
openErrorto 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, ornullto indicate that the default title should be used.message- The message to show in this dialog, ornullto 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 perIStatus.matches.- See Also:
IStatus.matches(int)
Method Details
buttonPressed
protected void buttonPressed(int id) - Overrides:
buttonPressedin classorg.eclipse.jface.dialogs.Dialog
configureShell
protected void configureShell(org.eclipse.swt.widgets.Shell shell) - Overrides:
configureShellin classorg.eclipse.jface.window.Window
createButtonsForButtonBar
protected void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent) - Overrides:
createButtonsForButtonBarin classorg.eclipse.jface.dialogs.Dialog
createDetailsButton
protected void createDetailsButton(org.eclipse.swt.widgets.Composite parent) Create the details button if it should be included.- Parameters:
parent- The parent composite
createDialogArea
protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent) This implementation of theDialogframework method creates and lays out a composite and callscreateMessageAreaandcreateCustomAreato populate it. Subclasses should overridecreateCustomAreato add contents below the message.- Overrides:
createDialogAreain classorg.eclipse.jface.dialogs.Dialog
createDialogAndButtonArea
protected void createDialogAndButtonArea(org.eclipse.swt.widgets.Composite parent) - Overrides:
createDialogAndButtonAreain classorg.eclipse.jface.dialogs.IconAndMessageDialog
getImage
protected org.eclipse.swt.graphics.Image getImage()- Specified by:
getImagein classorg.eclipse.jface.dialogs.IconAndMessageDialog
createDropDownList
protected org.eclipse.swt.widgets.Text createDropDownList(org.eclipse.swt.widgets.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()ExtendsWindow.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:
openin classorg.eclipse.jface.window.Window
openError
public static int openError(org.eclipse.swt.widgets.Shell parent, String dialogTitle, String message, org.eclipse.core.runtime.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, ornullif nonedialogTitle- the title to use for this dialog, ornullto indicate that the default title should be usedmessage- the message to show in this dialog, ornullto indicate that the error's message should be shown as the primary messagestatus- 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.OKif the OK button was pressed, orDialog.CANCELif this dialog's close window decoration or the ESC key was used.
openError
public static int openError(org.eclipse.swt.widgets.Shell parentShell, String title, String message, org.eclipse.core.runtime.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, ornullif nonetitle- the title to use for this dialog, ornullto indicate that the default title should be usedmessage- the message to show in this dialog, ornullto indicate that the error's message should be shown as the primary messagestatus- the error to show to the userdisplayMask- the mask to use to filter the displaying of child items, as perIStatus.matches- Returns:
- the code of the button that was pressed that resulted in this dialog closing. This will be
Dialog.OKif the OK button was pressed, orDialog.CANCELif this dialog's close window decoration or the ESC key was used. - See Also:
IStatus.matches(int)
shouldDisplay
protected static boolean shouldDisplay(org.eclipse.core.runtime.IStatus status, int mask) Returns whether the given status object should be displayed.- Parameters:
status- a status objectmask- a mask as perIStatus.matches- Returns:
trueif the given status should be displayed, andfalseotherwise- See Also:
IStatus.matches(int)
close
public boolean close()- Overrides:
closein classorg.eclipse.jface.dialogs.Dialog
showDetailsArea
protected final void showDetailsArea()Show the details portion of the dialog if it is not already visible. This method will only work when it is invoked after the control of the dialog has been set. In other words, after thecreateContentsmethod has been invoked and has returned the control for the content area of the dialog. Invoking the method before the content area has been set or after the dialog has been disposed will have no effect.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 status used when creating the dialog was a multi-status or if the status contains an exception. Subclasses may override.- Returns:
- whether the Details button should be included
setStatus
protected final void setStatus(org.eclipse.core.runtime.IStatus status) Set the status displayed by this error dialog to the given status. This only affects the status displayed by the Details list. The message, image and title should be updated by the subclass, if desired.- Parameters:
status- the status to be displayed in the details list