Class RuntimeExecutionErrorDialog

  • All Implemented Interfaces:
    org.eclipse.jface.window.IShellProvider

    public class RuntimeExecutionErrorDialog
    extends org.eclipse.jface.dialogs.MessageDialog
    Error message dialog with stack trace information.
    • Nested Class Summary

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

        org.eclipse.jface.window.Window.IExceptionHandler
    • Field Summary

      • Fields inherited from class org.eclipse.jface.dialogs.MessageDialog

        CONFIRM, ERROR, INFORMATION, NONE, QUESTION, QUESTION_WITH_CANCEL, 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, resizeHasOccurred
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void buttonPressed​(int id)
      Handles the pressing of the OK or Details button in this dialog.
      protected void createButtonsForButtonBar​(org.eclipse.swt.widgets.Composite parent)  
      protected org.eclipse.swt.widgets.Control createDetailsArea​(org.eclipse.swt.widgets.Composite parent)
      Create the details composite.
      protected static <T extends Exception>
      T
      getCauseOfType​(Throwable exception, Class<T> causeType)
      Returns the cause of the type causeType from the given exception, or null if the exception is not caused by an exception with type causeType.
      protected String getMessage​(Throwable exception)
      Returns error message for given exception.
      protected static <T extends Exception>
      T
      getRootCauseOfType​(Throwable exception, Class<T> causeType)
      Returns the root cause of the type causeType from the given exception, or null if the exception is not caused by an exception with type causeType.
      protected void initializeBounds()  
      protected boolean isInitiallyOpened​(Throwable throwable)
      Returns whether error dialog details areas for the given throwable will be initially opened.
      static int openError​(org.eclipse.swt.widgets.Shell parentShell, String message, Throwable exception)
      Opens an error dialog to display the given error, containing in status.
      static int openError​(org.eclipse.swt.widgets.Shell parentShell, org.eclipse.core.runtime.IStatus status)
      Opens an error dialog to display the given error, containing in status.
      void setInitiallyOpened​(boolean initiallyOpened)
      Set whether error dialog details areas will be initially opened.
      protected String toString​(org.eclipse.core.runtime.IStatus status, String prefix)
      Returns multi line String presentation of the given multi-status.
      • Methods inherited from class org.eclipse.jface.dialogs.MessageDialog

        configureShell, createButton, createCustomArea, createDialogArea, customShouldTakeFocus, getButton, getButtonLabels, getDefaultButtonIndex, getImage, getMinimumMessageWidth, handleShellCloseEvent, open, open, openConfirm, openError, openInformation, openQuestion, openWarning, setButtonLabels, setButtons
      • Methods inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog

        createButtonBar, createContents, createDialogAndButtonArea, createMessageArea, getColumnCount, getErrorImage, getInfoImage, getMessageLabelStyle, getQuestionImage, getWarningImage
      • Methods inherited from class org.eclipse.jface.dialogs.Dialog

        applyDialogFont, cancelPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, dialogFontIsDefault, getBlockedHandler, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, 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
    • Constructor Detail

      • RuntimeExecutionErrorDialog

        public RuntimeExecutionErrorDialog​(org.eclipse.swt.widgets.Shell parentShell,
                                           org.eclipse.core.runtime.IStatus status)
        Parameters:
        parentShell - the parent shell, or null to create a top-level shell
        status - the error to show to the user, cannot be null
      • RuntimeExecutionErrorDialog

        public RuntimeExecutionErrorDialog​(org.eclipse.swt.widgets.Shell parentShell,
                                           String message,
                                           Throwable exception)
        Constructor of RuntimeExecutionErrorDialog with ERROR dialog image type.
        Parameters:
        parentShell - the parent shell, or null to create a top-level shell
        message - the message to show in dialog header, cannot be null
        exception - the exception to print in dialog content, cannot be null
      • RuntimeExecutionErrorDialog

        public RuntimeExecutionErrorDialog​(org.eclipse.swt.widgets.Shell parentShell,
                                           String message,
                                           String title,
                                           int dialogImageType,
                                           Throwable exception)
        Parameters:
        parentShell - the parent shell, or null to create a top-level shell
        message - the message to show in dialog header, cannot be null
        title - the shell title, cannot be null
        dialogImageType - one of the following values:
        • MessageDialog.NONE for a dialog with no image
        • MessageDialog.ERROR for a dialog with an error image
        • MessageDialog.INFORMATION for a dialog with an information image
        • MessageDialog.QUESTION for a dialog with a question image
        • MessageDialog.WARNING for a dialog with a warning image
        exception - the exception to print in dialog content, cannot be null
    • Method Detail

      • openError

        public static int openError​(org.eclipse.swt.widgets.Shell parentShell,
                                    org.eclipse.core.runtime.IStatus status)
        Opens an error dialog to display the given error, containing in status.
        Parameters:
        parentShell - the parent shell, or null to create a top-level shell
        status - the error to show to the user, cannot be null
        Returns:
        the code of the button that was pressed that resulted in this dialog closing
      • openError

        public static int openError​(org.eclipse.swt.widgets.Shell parentShell,
                                    String message,
                                    Throwable exception)
        Opens an error dialog to display the given error, containing in status.
        Parameters:
        parentShell - the parent shell, or null to create a top-level shell
        message - the message to show in dialog header, cannot be null
        exception - the exception to print in dialog content, cannot be null
        Returns:
        the code of the button that was pressed that resulted in this dialog closing
      • setInitiallyOpened

        public void setInitiallyOpened​(boolean initiallyOpened)
        Set whether error dialog details areas will be initially opened.
        Parameters:
        initiallyOpened - new initially opened state
      • 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 exceptions details area.

        Overrides:
        buttonPressed in class org.eclipse.jface.dialogs.MessageDialog
      • initializeBounds

        protected void initializeBounds()
        Overrides:
        initializeBounds in class org.eclipse.jface.dialogs.Dialog
      • createButtonsForButtonBar

        protected void createButtonsForButtonBar​(org.eclipse.swt.widgets.Composite parent)
        Overrides:
        createButtonsForButtonBar in class org.eclipse.jface.dialogs.MessageDialog
      • createDetailsArea

        protected org.eclipse.swt.widgets.Control createDetailsArea​(org.eclipse.swt.widgets.Composite parent)
        Create the details composite. Details composite will contains information about occurred exception.
        Parameters:
        parent - the parent composite, cannot be null
        Returns:
        the details composite, never null
      • getMessage

        protected String getMessage​(Throwable exception)
        Returns error message for given exception.
        Parameters:
        exception - exception to get error message for, or null if undefined
        Returns:
        error message for given exception, never null
      • toString

        protected String toString​(org.eclipse.core.runtime.IStatus status,
                                  String prefix)
        Returns multi line String presentation of the given multi-status.
        Parameters:
        status - the multi-status to get String presentation for, cannot be null
        prefix - the prefix to add, cannot be null, may be empty
        Returns:
        multi line String presentation of the given multi-status, never null
      • isInitiallyOpened

        protected boolean isInitiallyOpened​(Throwable throwable)
        Returns whether error dialog details areas for the given throwable will be initially opened.
        Parameters:
        throwable - the throwable to check, cannot be null
        Returns:
        whether error dialog details areas for the given throwable will be initially opened
      • getCauseOfType

        protected static <T extends Exception> T getCauseOfType​(Throwable exception,
                                                                Class<T> causeType)
        Returns the cause of the type causeType from the given exception, or null if the exception is not caused by an exception with type causeType.

        If the given exception is instance of causeType, returns it.

        Parameters:
        exception - the exception to get cause from, cannot be null
        causeType - the exceptiont type to find cause with, cannot be null
        Returns:
        the cause of causeType type, if there is one or null if none
      • getRootCauseOfType

        protected static <T extends Exception> T getRootCauseOfType​(Throwable exception,
                                                                    Class<T> causeType)
        Returns the root cause of the type causeType from the given exception, or null if the exception is not caused by an exception with type causeType.

        If the given exception is instance of causeType, returns it.

        Parameters:
        exception - the exception to get cause from, cannot be null
        causeType - the exceptiont type to find cause with, cannot be null
        Returns:
        the root cause of causeType type, if there is one or null if none