|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jface.window.Window org.eclipse.jface.dialogs.Dialog org.eclipse.jface.dialogs.IconAndMessageDialog org.eclipse.jface.dialogs.MessageDialog org.eclipse.jface.dialogs.MessageDialogWithToggle
A message dialog which also allows the user to adjust a toggle setting. If a preference store is provided and the user selects the toggle, then the user's answer (yes/ok or no) will be persisted in the store. If no store is provided, then this information can be queried after the dialog closes.
This type of dialog should be used whenever you want to user to be able to avoid being prompted in the future. It is strongly recommended that a cancel option be provided, so that the user has the option of making the decision at a later point in time. The semantic for a cancel button should be to cancel the operation (if it has not yet started), or stop the operation (if it has already started).
It is the responsibility of the developer to provide a mechanism for the user to change this preference at some later point in time (e.g., through a preference page).
Nested Class Summary |
Nested classes inherited from class org.eclipse.jface.window.Window |
Window.IExceptionHandler |
Field Summary | |
static String | ALWAYS
The value of the preference when the user has asked that the answer to the question always be "okay" or "yes". |
static String | NEVER
The value of the preference when the user has asked that the answer to the question always be "no". |
static String | PROMPT
The value of the preference when the user wishes to prompted for an answer every time the question is to be asked. |
Fields inherited from class org.eclipse.jface.dialogs.MessageDialog |
ERROR, INFORMATION, NONE, QUESTION, WARNING |
Fields inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog |
imageLabel, message, messageLabel |
Fields inherited from class org.eclipse.jface.dialogs.Dialog |
blockedHandler, 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, ELLIPSIS |
Fields inherited from class org.eclipse.jface.window.Window |
CANCEL, OK |
Constructor Summary | |
MessageDialogWithToggle(Shell parentShell,
String dialogTitle,
Image image,
String message,
int dialogImageType,
String[] dialogButtonLabels,
int defaultIndex,
String toggleMessage,
boolean toggleState)
Creates a message dialog with a toggle. |
Method Summary | |
protected void | buttonPressed(int buttonId)
Notifies that this dialog's button with the given id has been pressed. |
protected void | createButtonsForButtonBar(Composite parent)
Adds buttons to this dialog's button bar. |
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 Button | createToggleButton(Composite parent)
Creates a toggle button without any text or state. |
String | getPrefKey()
An accessor for the current key of the toggle preference. |
IPreferenceStore | getPrefStore()
An accessor for the current preference store for this dialog. |
protected Button | getToggleButton()
Returns the toggle button. |
boolean | getToggleState()
Returns the toggle state. |
static MessageDialogWithToggle | openError(Shell parent,
String title,
String message,
String toggleMessage,
boolean toggleState,
IPreferenceStore store,
String key)
Convenience method to open a standard error dialog. |
static MessageDialogWithToggle | openInformation(Shell parent,
String title,
String message,
String toggleMessage,
boolean toggleState,
IPreferenceStore store,
String key)
Convenience method to open a standard information dialog. |
static MessageDialogWithToggle | openOkCancelConfirm(Shell parent,
String title,
String message,
String toggleMessage,
boolean toggleState,
IPreferenceStore store,
String key)
Convenience method to open a simple confirm (OK/Cancel) dialog. |
static MessageDialogWithToggle | openWarning(Shell parent,
String title,
String message,
String toggleMessage,
boolean toggleState,
IPreferenceStore store,
String key)
Convenience method to open a standard warning dialog. |
static MessageDialogWithToggle | openYesNoCancelQuestion(Shell parent,
String title,
String message,
String toggleMessage,
boolean toggleState,
IPreferenceStore store,
String key)
Convenience method to open a simple question Yes/No/Cancel dialog. |
static MessageDialogWithToggle | openYesNoQuestion(Shell parent,
String title,
String message,
String toggleMessage,
boolean toggleState,
IPreferenceStore store,
String key)
Convenience method to open a simple Yes/No question dialog. |
void | setPrefKey(String prefKey)
A mutator for the key of the preference to be modified by the toggle button. |
void | setPrefStore(IPreferenceStore prefStore)
A mutator for the preference store to be modified by the toggle button. |
protected void | setToggleButton(Button button)
A mutator for the button providing the toggle option. |
protected void | setToggleMessage(String message)
A mutator for the text on the toggle button. |
void | setToggleState(boolean toggleState)
A mutator for the state of the toggle button. |
Methods inherited from class org.eclipse.jface.dialogs.MessageDialog |
configureShell, createButton, createCustomArea, customShouldTakeFocus, getButton, getButtonLabels, getDefaultButtonIndex, getImage, getMinimumMessageWidth, handleShellCloseEvent, openConfirm, openError, openInformation, openQuestion, openWarning, setButtonLabels, setButtons |
Methods inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog |
createButtonBar, createContents, createDialogAndButtonArea, createMessageArea, getErrorImage, getInfoImage, getMessageLabelStyle, getQuestionImage, getWarningImage |
Methods inherited from class org.eclipse.jface.window.Window |
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getInitialLocation, getInitialSize, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setExceptionHandler, setReturnCode, setShellStyle, setWindowManager |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String ALWAYS
public static final String NEVER
public static final String PROMPT
Constructor Detail |
public MessageDialogWithToggle(Shell parentShell, String dialogTitle, Image image, String message, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, String toggleMessage, boolean toggleState)
Method Detail |
public static MessageDialogWithToggle openError(Shell parent, String title, String message, String toggleMessage, boolean toggleState, IPreferenceStore store, String key)
public static MessageDialogWithToggle openInformation(Shell parent, String title, String message, String toggleMessage, boolean toggleState, IPreferenceStore store, String key)
public static MessageDialogWithToggle openOkCancelConfirm(Shell parent, String title, String message, String toggleMessage, boolean toggleState, IPreferenceStore store, String key)
public static MessageDialogWithToggle openWarning(Shell parent, String title, String message, String toggleMessage, boolean toggleState, IPreferenceStore store, String key)
public static MessageDialogWithToggle openYesNoCancelQuestion(Shell parent, String title, String message, String toggleMessage, boolean toggleState, IPreferenceStore store, String key)
public static MessageDialogWithToggle openYesNoQuestion(Shell parent, String title, String message, String toggleMessage, boolean toggleState, IPreferenceStore store, String key)
protected void buttonPressed(int buttonId)
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.
protected void createButtonsForButtonBar(Composite parent)
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.
protected Control createDialogArea(Composite parent)
protected Button createToggleButton(Composite parent)
protected Button getToggleButton()
public IPreferenceStore getPrefStore()
public String getPrefKey()
public boolean getToggleState()
public void setPrefKey(String prefKey)
public void setPrefStore(IPreferenceStore prefStore)
protected void setToggleButton(Button button)
protected void setToggleMessage(String message)
public void setToggleState(boolean toggleState)
|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.