T
- which declares the type of the elements in the
AbstractSelectionDialog
.public abstract class AbstractSelectionDialog<T> extends TrayDialog
setInitialSelection
), and returns the final
selection (via getResult
) after completion.
Clients may subclass this dialog to inherit its selection facilities.
Window.IExceptionHandler
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
CANCEL, OK, resizeHasOccurred
Modifier | Constructor and Description |
---|---|
protected |
AbstractSelectionDialog(Shell parentShell)
Creates a dialog instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
configureShell(Shell shell)
Configures the given shell in preparation for opening this window in it.
|
protected Label |
createMessageArea(Composite composite)
Creates the message area for this dialog.
|
protected IDialogSettings |
getDialogBoundsSettings()
Gets the dialog settings that should be used for remembering the bounds of
of the dialog, according to the dialog bounds strategy.
|
protected int |
getDialogBoundsStrategy()
Get the integer constant that describes the strategy for persisting the
dialog bounds.
|
protected List<T> |
getInitialSelection()
Returns the collection of initial element selections.
|
protected String |
getMessage()
Returns the message for this dialog.
|
Collection<T> |
getResult()
Returns the collection of selections made by the user.
|
protected boolean |
isResizable()
Returns a boolean indicating whether the dialog should be
considered resizable when the shell style is initially
set.
|
void |
setDialogBoundsSettings(IDialogSettings settings,
int strategy)
Set the dialog settings that should be used to save the bounds of this
dialog.
|
void |
setInitialSelection(Collection<T> selectedElements)
Sets the initial selection in this selection dialog to the given
elements.
|
void |
setInitialSelection(T... selectedElements)
Sets the initial selection in this selection dialog to the given
elements.
|
void |
setMessage(String message)
Sets the message for this dialog.
|
protected void |
setResult(Collection<T> newUserSelection)
Set the selections made by the user, or
null if the
selection was canceled. |
protected void |
setResult(T... newUserSelection)
Set the selections made by the user, or
null if the
selection was canceled. |
void |
setTitle(String title)
Sets the title for this dialog.
|
closeTray, createButtonBar, createHelpControl, getLayout, getTray, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
applyDialogFont, buttonPressed, cancelPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonsForButtonBar, createContents, createDialogArea, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
protected AbstractSelectionDialog(Shell parentShell)
parentShell
- the parent shellprotected void configureShell(Shell shell)
Window
The default implementation of this framework method sets the shell's image and gives it a grid layout. Subclasses may extend or reimplement.
configureShell
in class Window
shell
- the shellprotected Label createMessageArea(Composite composite)
This method is provided to allow subclasses to decide where the message will appear on the screen.
composite
- the parent compositeprotected List<T> getInitialSelection()
protected String getMessage()
public Collection<T> getResult()
null
if no
result was setpublic void setInitialSelection(T... selectedElements)
selectedElements
- the elements to selectpublic void setInitialSelection(Collection<T> selectedElements)
selectedElements
- the List of elements to selectpublic void setMessage(String message)
message
- the messageprotected void setResult(Collection<T> newUserSelection)
null
if the
selection was canceled.newUserSelection
- collection of selected elements, or null
if
Cancel was pressedprotected void setResult(T... newUserSelection)
null
if the
selection was canceled.
The selections may accessed using getResult
.
newUserSelection
- - the new valuespublic void setTitle(String title)
title
- the titlepublic void setDialogBoundsSettings(IDialogSettings settings, int strategy)
settings
- the IDialogSettings
that should be used to store the
bounds of the dialogstrategy
- the integer constant specifying how the bounds are saved.
Specified using Dialog.DIALOG_PERSISTLOCATION
and
Dialog.DIALOG_PERSISTSIZE
.Dialog.getDialogBoundsStrategy()
,
Dialog.getDialogBoundsSettings()
protected IDialogSettings getDialogBoundsSettings()
Dialog
getDialogBoundsSettings
in class Dialog
null
if the dialog's bounds should
never be stored.Dialog.getDialogBoundsStrategy()
protected int getDialogBoundsStrategy()
Dialog
getDialogBoundsStrategy
in class Dialog
Dialog.DIALOG_PERSISTLOCATION
,
Dialog.DIALOG_PERSISTSIZE
,
Dialog.getDialogBoundsSettings()
protected boolean isResizable()
Dialog
false
, but also sets a style bit for a
SWT.RESIZE border, the style bit will be honored.isResizable
in class Dialog
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.