Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.ui.messages
Class SystemMessageDialog

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.ErrorDialog
                  extended by 
org.eclipse.rse.ui.messages.SystemMessageDialog
All Implemented Interfaces:
IShellProvider, Listener

public class SystemMessageDialog
extends ErrorDialog
implements Listener

A dialog for showing SystemMessages and optionally asking the user for Yes / No / Ok / Cancel type of response. The client may choose to construct and open the dialog itself, or use one of the provided static factory methods, which construct the dialog and synchronously open it without thread switch (must be called on the UI thread):

or one of the convenience static factory methods which also switch to the UI thread automatically to synchronously open the dialog there if needed:


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window. Window
Window.IExceptionHandler
 
Field Summary
static int BUTTON_ID
          button id number for the first button in the button bar.
protected   Button noShowAgainButton
           
protected  boolean noShowAgainOption
           
protected   String prefId
           
protected   IPreferenceStore prefStore
           
protected  boolean prefValAsSelected
           
 
Fields inherited from class org.eclipse.jface.dialogs. ErrorDialog
AUTOMATED_MODE
 
Fields inherited from class org.eclipse.jface.dialogs. IconAndMessageDialog
imageLabel, 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
SystemMessageDialog ( Shell parentShell, SystemMessage message)
          Creates an error dialog.
 
Method Summary
protected  void buttonPressed (int id)
           
protected  void createButtonsForButtonBar ( Composite parent)
           
protected   Control createDialogArea ( Composite parent)
           
protected   Text createDropDownList2 ( Composite parent)
          Create this dialog's drop-down list component.
protected   Button createNoShowAgainButton ( Composite c)
          Creates a button to allow option to not show this dialog again.
static void displayErrorMessage ( Shell shell, String msgText)
          For ease of use for simple error message text with no response from user.
static void displayErrorMessage ( Shell shell, SystemMessage msg)
          For ease of use for simple messages with no response from user.
static void displayErrorMessage ( Shell shell, SystemMessage msg, Throwable exc)
          For ease of use for simple messages which are the result of an exception
static void displayExceptionMessage ( Shell shell, Throwable exc)
          For displaying a generic error message when an unexpected exception happens.
static void displayHostErrorMessage ( Shell shell, String hostMsg)
          For ease of use for simple host error messages that are xlated already.
static void displayHostErrorMessage ( Shell shell, String hostMsg, String levelTwo)
          For ease of use for simple host error messages that are xlated already, and which have 2nd level text.
static void displayHostWarningMessage ( Shell shell, String hostMsg)
          For ease of use for simple host warning messages that are xlated already.
static void displayHostWarningMessage ( Shell shell, String hostMsg, String levelTwo)
          For ease of use for simple host warning messages that are xlated already, and which have 2nd level text.
static void displayMessage ( Shell shell, String msgText)
          For ease of use for simple message text with no response from user.
static void displayMessage ( Shell shell, SystemMessageException msgEx)
          Display this wrapped system message to the user
static void displayMessage ( SystemMessageException msgEx)
          Display this wrapped system message to the user
 int getButtonPressedId ()
          returns the id of the button pressed
static  Shell getDefaultShell ()
          Keeping for posterity.
static  SystemMessage getExceptionMessage ( Shell shell, Throwable exc)
          When an exception occurs and you want to turn it into a SystemMessage, call this...
 void handleEvent ( Event e)
          Handles events generated by controls on this page.
 int open ()
          Opens the message dialog to display the message.
 boolean openQuestion ()
          Open the dialog with Yes, No, Details button for an Inquiry/Question message.
 boolean openQuestionNoException ()
          Open the dialog with Yes/No, Details button for an Inquiry/Question message.
 boolean openQuestionNoException (boolean showYesNo)
          opens the dialog with an optional Yes/No or OK, Details button for an Inquiry/Question message.
 int openWithDetails ()
          Opens the message dialog with the details showing to display the message.
 int openWithDetails ( Exception exc)
          Opens the message dialog with the details showing to display an exception, if that is the root cause of the message.
 int openYesNoCancel ()
          opens the dialog with Yes, No, Cancel Details for an Inquiry/Question message
 void setButtonIndex (int buttonIndex)
          sets the default button for the message.
 void setButtons ( String[] buttonList)
          overrides the default button selection.
 void setException ( Throwable exc)
          When the message involves an exception for which we want to log the stack, set that exception here.
 void setNoShowAgainOption (boolean noShowAgainOption, IPreferenceStore prefStore, String prefId, boolean prefValAsSelected)
          Set option to not show this dialog again and specify the preference that should be set according to whether the user selects to show the dialog again or no.
static boolean show ( Shell shell, SystemMessage msg)
          Show this message in the message dialog.
static void showExceptionMessage ( Shell shell, String msg, Exception exc)
          Put up an error message when the error message framework itself doesn't work, and also log the error.
 
Methods inherited from class org.eclipse.jface.dialogs. ErrorDialog
close, configureShell, createDetailsButton, createDialogAndButtonArea, createDropDownList, getImage, isResizable, openError, openError, setStatus, shouldDisplay, shouldShowDetailsButton, showDetailsArea
 
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, 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
 

Field Detail

BUTTON_ID

public static final int BUTTON_ID
button id number for the first button in the button bar.

The second button, would have an id of buttonId+1 etc.

See Also:
Constant Field Values

noShowAgainOption

protected boolean noShowAgainOption

noShowAgainButton

protected 
Button noShowAgainButton

prefStore

protected 
IPreferenceStore prefStore

prefId

protected 
String prefId

prefValAsSelected

protected boolean prefValAsSelected
Constructor Detail

SystemMessageDialog

public SystemMessageDialog(
Shell parentShell,
                           
SystemMessage message)
Creates an error dialog. Note that the dialog will have no visual representation (no widgets) until it is told to open.

Parameters:
parentShell - the shell under which to create this dialog
message - the message to display in the dialog
Method Detail

buttonPressed

protected void buttonPressed(int id)
Overrides:
buttonPressed in class ErrorDialog

createButtonsForButtonBar

protected void createButtonsForButtonBar(
Composite parent)
Overrides:
createButtonsForButtonBar in class ErrorDialog

createDialogArea

protected 
Control createDialogArea(
Composite parent)
Overrides:
createDialogArea in class ErrorDialog

createDropDownList2

protected 
Text createDropDownList2(
Composite parent)
Create this dialog's drop-down list component.

Parameters:
parent - the parent composite
Returns:
the drop-down list component

setException

public void setException(
Throwable exc)
When the message involves an exception for which we want to log the stack, set that exception here.


open

public int open()
Opens the message dialog to display the message.

Overrides:
open in class ErrorDialog

openWithDetails

public int openWithDetails()
Opens the message dialog with the details showing to display the message.


openWithDetails

public int openWithDetails(
Exception exc)
Opens the message dialog with the details showing to display an exception, if that is the root cause of the message.

Also logs the first level text plus exception.


openQuestion

public boolean openQuestion()
Open the dialog with Yes, No, Details button for an Inquiry/Question message.

Returns:
true if Yes was pressed, false if No was pressed.

openQuestionNoException

public boolean openQuestionNoException()
Open the dialog with Yes/No, Details button for an Inquiry/Question message.

Returns:
true if Yes was pressed, false if No was pressed.

openQuestionNoException

public boolean openQuestionNoException(boolean showYesNo)
opens the dialog with an optional Yes/No or OK, Details button for an Inquiry/Question message. Before RSE 3.0, this method had no arguments. Since RSE 3.0, it is taking a boolean argument.

Since:
org.eclipse.rse.ui 3.0

openYesNoCancel

public int openYesNoCancel()
opens the dialog with Yes, No, Cancel Details for an Inquiry/Question message

Returns:
IDialogConstants.YES_ID or NO_ID

getButtonPressedId

public int getButtonPressedId()
returns the id of the button pressed


setButtons

public void setButtons(
String[] buttonList)
overrides the default button selection.

Parameters:
buttonList - an array of buttons for the button bar

setButtonIndex

public void setButtonIndex(int buttonIndex)
sets the default button for the message. Use this method if you wan to override the default button (the first one)

Parameters:
buttonIndex - the 0-based index of the button

getDefaultShell

public static 
Shell getDefaultShell()
Keeping for posterity. Phil.


displayErrorMessage

public static void displayErrorMessage(
Shell shell,
                                       
SystemMessage msg)
For ease of use for simple messages with no response from user.


displayErrorMessage

public static void displayErrorMessage(
Shell shell,
                                       
SystemMessage msg,
                                       
Throwable exc)
For ease of use for simple messages which are the result of an exception


displayErrorMessage

public static void displayErrorMessage(
Shell shell,
                                       
String msgText)
For ease of use for simple error message text with no response from user.


displayMessage

public static void displayMessage(
Shell shell,
                                  
String msgText)
For ease of use for simple message text with no response from user.


displayMessage

public static void displayMessage(
Shell shell,
                                  
SystemMessageException msgEx)
Display this wrapped system message to the user


displayMessage

public static void displayMessage(
SystemMessageException msgEx)
Display this wrapped system message to the user


displayHostErrorMessage

public static void displayHostErrorMessage(
Shell shell,
                                           
String hostMsg)
For ease of use for simple host error messages that are xlated already.


displayHostErrorMessage

public static void displayHostErrorMessage(
Shell shell,
                                           
String hostMsg,
                                           
String levelTwo)
For ease of use for simple host error messages that are xlated already, and which have 2nd level text.


displayHostWarningMessage

public static void displayHostWarningMessage(
Shell shell,
                                             
String hostMsg)
For ease of use for simple host warning messages that are xlated already.


displayHostWarningMessage

public static void displayHostWarningMessage(
Shell shell,
                                             
String hostMsg,
                                             
String levelTwo)
For ease of use for simple host warning messages that are xlated already, and which have 2nd level text.


displayExceptionMessage

public static void displayExceptionMessage(
Shell shell,
                                           
Throwable exc)
For displaying a generic error message when an unexpected exception happens.


getExceptionMessage

public static 
SystemMessage getExceptionMessage(
Shell shell,
                                                
Throwable exc)
When an exception occurs and you want to turn it into a SystemMessage, call this...


showExceptionMessage

public static void showExceptionMessage(
Shell shell,
                                        
String msg,
                                        
Exception exc)
Put up an error message when the error message framework itself doesn't work, and also log the error.


show

public static boolean show(
Shell shell,
                           
SystemMessage msg)
Show this message in the message dialog. We polymorphically show the right message dialog, by querying the message type.

Returns:
true if this is a question message, and user presses Yes.

setNoShowAgainOption

public void setNoShowAgainOption(boolean noShowAgainOption,
                                 
IPreferenceStore prefStore,
                                 
String prefId,
                                 boolean prefValAsSelected)
Set option to not show this dialog again and specify the preference that should be set according to whether the user selects to show the dialog again or no. The caller can query this preference to find out what the user selection is.

Parameters:
noShowAgainOption - true to show the option in the dialog, false to not show it.
prefStore - the preference store.
prefId - the preference id for which a boolean value will be stored according to the user's selection.
prefValAsSelected - whether to mirror the user selection in the preference. If this is set to true, then the value stored in the preference is true if the user selects the option, and false if the user does not select the option. If this is set to false, then the value stored in the preference will be false if the user selects the option, and true if the user does not select the option

createNoShowAgainButton

protected 
Button createNoShowAgainButton(
Composite c)
Creates a button to allow option to not show this dialog again.

Returns:
the button that allows option to not show this dialog again.

handleEvent

public void handleEvent(
Event e)
Handles events generated by controls on this page. Should be overridden by child. Only public because of interface requirement!

Specified by:
handleEvent in interface Listener

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire