public class ComboDialog
extends org.eclipse.jface.dialogs.Dialog
ComboViewer
.
The underlying combo or drop-down-list widget can be either read-only or
manually editable (meaning you can type a new value).
In normal use, the dialog's various properties should be set before opening.
The selected value can be retrieved via getValue()
.
If the widget is manually editable, sub-classes should override
validateSelection(String)
and call the super class method to
determine if the selected value is one of the allowed values before
attempting additional validation of the input.
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, 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
Constructor and Description |
---|
ComboDialog(org.eclipse.swt.widgets.Shell parentShell,
boolean readOnly)
Creates a new dialog centered around a combo widget.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getValue()
Gets the selected value from the dialog's combo widget.
|
boolean |
setAllowedValues(java.util.List<java.lang.String> allowedValues)
Sets the list of allowed values that will be put into the dialog's combo
widget.
|
boolean |
setErrorText(java.lang.String text)
Sets the text that is displayed in the combo widget's error decorator.
|
boolean |
setInfoText(java.lang.String text)
Sets the text that is displayed in the dialog above the combo widget.
|
boolean |
setInitialValue(java.lang.String value)
Sets the initial value that will be selected in the combo widget when the
dialog is opened.
|
boolean |
setTitle(java.lang.String text)
Sets the title text for the dialog.
|
applyDialogFont, close, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, create, getBlockedHandler, getImage, setBlockedHandler, shortenText
getDefaultImage, getDefaultImages, getDefaultOrientation, getReturnCode, getShell, getWindowManager, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setWindowManager
public ComboDialog(org.eclipse.swt.widgets.Shell parentShell, boolean readOnly)
parentShell
- The parent shell for the new dialog.readOnly
- If true, then the dialog will use a read-only combo.
Otherwise, it uses an editable combo widget (it has a
drop-down list, but can be manually edited).public java.lang.String getValue()
null
if a selection was not made or the dialog was
cancelled.public boolean setAllowedValues(java.util.List<java.lang.String> allowedValues)
allowedValues
- The list of allowed values. If this list is null
,
contains null
, or is not different, this list will be
ignored.public boolean setErrorText(java.lang.String text)
text
- The new text to display in the combo widget's error decorator.
Must not be null
.public boolean setInfoText(java.lang.String text)
text
- The new text to display in the dialog above the combo widget.
Must not be null
.public boolean setInitialValue(java.lang.String value)
value
- The initial value. This will be validated before being placed
in the combo widget.public boolean setTitle(java.lang.String text)
text
- The new text to display in the dialog's title bar.