Package org.eclipse.ui.dialogs
Class AbstractElementListSelectionDialog
java.lang.Object
org.eclipse.jface.window.Window
org.eclipse.jface.dialogs.Dialog
org.eclipse.jface.dialogs.TrayDialog
org.eclipse.ui.dialogs.SelectionDialog
org.eclipse.ui.dialogs.SelectionStatusDialog
org.eclipse.ui.dialogs.AbstractElementListSelectionDialog
- All Implemented Interfaces:
IShellProvider
- Direct Known Subclasses:
ElementListSelectionDialog,TwoPaneElementSelector
An abstract class to select elements out of a list of elements.
- Since:
- 2.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FilteredListAllows direct access to the filtered list.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, ELLIPSISFields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractElementListSelectionDialog(Shell parent, ILabelProvider renderer) Constructs a list selection dialog. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidNotifies that the cancel button of this dialog has been pressed.voidcreate()Creates this window's widgetry in a new top-level shell.protected FilteredListcreateFilteredList(Composite parent) Creates a filtered list.protected TextcreateFilterText(Composite parent) Creates the filter text.protected LabelcreateMessageArea(Composite composite) Creates the message text widget and sets layout data.Returns the current filter pattern.Object[]getFoldedElements(int index) Returns all elements which are folded together to one entry in the list.protected Object[]Returns an array of the currently selected elements.protected intReturns an index referring the first current selection.protected int[]Returns the indices referring the current selection.protected ISelectionStatusValidatorGets the optional validator used to check if the selection is valid.protected voidHandles default selection (double click).protected voidThis method is called when the elements of the backing list are changed to refresh the standard dialog widgets.protected voidHandles empty list by disabling widgets.protected voidHandles a selection changed event.booleanReturns if sorting, filtering and folding is case sensitive.intopen()Opens this window, creating it first if it has not yet been created.voidsetAllowDuplicates(boolean allowDuplicates) Specifies whether duplicate entries are displayed or not.voidsetEmptyListMessage(String message) Sets the message to be displayed if the list is empty.voidsetEmptySelectionMessage(String message) Sets the message to be displayed if the selection is empty.voidSets the filter pattern.voidsetIgnoreCase(boolean ignoreCase) Specifies if sorting, filtering and folding is case sensitive.protected voidsetListElements(Object[] elements) Sets the elements of the list (widget).voidsetMatchEmptyString(boolean matchEmptyString) Specifies whether everything or nothing should be filtered on empty filter string.voidsetMultipleSelection(boolean multipleSelection) Specifies if multiple selection is allowed.protected voidsetSelection(Object[] selection) Sets the selection referenced by an array of elements.voidsetSize(int width, int height) Sets the list size in unit of characters.voidsetValidator(ISelectionStatusValidator validator) Sets an optional validator to check if the selection is valid.protected voidUpdate the enablement of the OK button based on whether or not there is a selection.protected booleanValidates the current selection and updates the status line accordingly.Methods inherited from class org.eclipse.ui.dialogs.SelectionStatusDialog
computeResult, configureShell, createButtonBar, getFirstResult, okPressed, setImage, setResult, setStatusLineAboveButtons, updateButtonsEnableState, updateStatusMethods inherited from class org.eclipse.ui.dialogs.SelectionDialog
createButtonsForButtonBar, getDialogBoundsSettings, getDialogBoundsStrategy, getInitialElementSelections, getInitialSelections, getMessage, getOkButton, getResult, isResizable, setDialogBoundsSettings, setInitialElementSelections, setInitialSelections, setMessage, setResult, setSelectionResult, setTitleMethods inherited from class org.eclipse.jface.dialogs.TrayDialog
closeTray, createHelpControl, getLayout, getTray, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailableMethods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, createButton, createContents, createDialogArea, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenTextMethods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
-
Field Details
-
fFilteredList
Allows direct access to the filtered list.
-
-
Constructor Details
-
AbstractElementListSelectionDialog
Constructs a list selection dialog.- Parameters:
parent- The parent for the list.renderer- ILabelProvider for the list
-
-
Method Details
-
handleDefaultSelected
protected void handleDefaultSelected()Handles default selection (double click). By default, the OK button is pressed. -
setIgnoreCase
public void setIgnoreCase(boolean ignoreCase) Specifies if sorting, filtering and folding is case sensitive.- Parameters:
ignoreCase- true if case insensitive, false otherwise.
-
isCaseIgnored
public boolean isCaseIgnored()Returns if sorting, filtering and folding is case sensitive.- Returns:
- boolean
-
setMatchEmptyString
public void setMatchEmptyString(boolean matchEmptyString) Specifies whether everything or nothing should be filtered on empty filter string.- Parameters:
matchEmptyString- boolean
-
setMultipleSelection
public void setMultipleSelection(boolean multipleSelection) Specifies if multiple selection is allowed.- Parameters:
multipleSelection- true if multiple selections are allowed.
-
setAllowDuplicates
public void setAllowDuplicates(boolean allowDuplicates) Specifies whether duplicate entries are displayed or not.- Parameters:
allowDuplicates- true if duplicate entries must be displayed.
-
setSize
public void setSize(int width, int height) Sets the list size in unit of characters.- Parameters:
width- the width of the list.height- the height of the list.
-
setEmptyListMessage
Sets the message to be displayed if the list is empty.- Parameters:
message- the message to be displayed.
-
setEmptySelectionMessage
Sets the message to be displayed if the selection is empty.- Parameters:
message- the message to be displayed.
-
setValidator
Sets an optional validator to check if the selection is valid. The validator is invoked whenever the selection changes.- Parameters:
validator- the validator to validate the selection.
-
setListElements
Sets the elements of the list (widget).- Parameters:
elements- the elements of the list.
-
handleElementsChanged
protected void handleElementsChanged()This method is called when the elements of the backing list are changed to refresh the standard dialog widgets.- Since:
- 3.8
-
setFilter
Sets the filter pattern.- Parameters:
filter- the filter pattern.
-
getFilter
Returns the current filter pattern.- Returns:
- returns the current filter pattern or
nullif filter was not set.
-
getSelectionIndices
protected int[] getSelectionIndices()Returns the indices referring the current selection. To be called within open().- Returns:
- returns the indices of the current selection.
-
getSelectionIndex
protected int getSelectionIndex()Returns an index referring the first current selection. To be called within open().- Returns:
- returns the indices of the current selection.
-
setSelection
Sets the selection referenced by an array of elements. Empty or null array removes selection. To be called within open().- Parameters:
selection- the indices of the selection.
-
getSelectedElements
Returns an array of the currently selected elements. To be called within or after open().- Returns:
- returns an array of the currently selected elements.
-
getFoldedElements
Returns all elements which are folded together to one entry in the list.- Parameters:
index- the index selecting the entry in the list.- Returns:
- returns an array of elements folded together.
-
createMessageArea
Creates the message text widget and sets layout data.- Overrides:
createMessageAreain classSelectionDialog- Parameters:
composite- the parent composite of the message area.- Returns:
- the message label
-
handleSelectionChanged
protected void handleSelectionChanged()Handles a selection changed event. By default, the current selection is validated. -
validateCurrentSelection
protected boolean validateCurrentSelection()Validates the current selection and updates the status line accordingly.- Returns:
- boolean
trueif the current selection is valid.
-
cancelPressed
protected void cancelPressed()Description copied from class:DialogNotifies that the cancel button of this dialog has been pressed.The
Dialogimplementation of this framework method sets this dialog's return code toWindow.CANCELand closes the dialog. Subclasses may override if desired.- Overrides:
cancelPressedin classDialog
-
createFilteredList
Creates a filtered list.- Parameters:
parent- the parent composite.- Returns:
- returns the filtered list widget.
-
createFilterText
Creates the filter text. Subclasses are allowed to override if they want the text to be created differently and must not call super in this case.- Parameters:
parent- the parent to create the widget on- Returns:
- the created filter text widget.
-
open
public int open()Description copied from class:WindowOpens this window, creating it first if it has not yet been created.If this window has been configured to block on open (
setBlockOnOpen), this method waits until the window is closed by the end user, and then it returns the window's return code; otherwise, this method returns immediately. A window's return codes are window-specific, although two standard return codes are predefined:OKandCANCEL. -
create
public void create()Description copied from class:WindowCreates this window's widgetry in a new top-level shell.The default implementation of this framework method creates this window's shell (by calling
createShell), and its controls (by callingcreateContents), then initializes this window's shell bounds (by callinginitializeBounds).- Overrides:
createin classSelectionStatusDialog
-
handleEmptyList
protected void handleEmptyList()Handles empty list by disabling widgets. -
updateOkState
protected void updateOkState()Update the enablement of the OK button based on whether or not there is a selection. -
getValidator
Gets the optional validator used to check if the selection is valid. The validator is invoked whenever the selection changes.- Returns:
- the validator to validate the selection, or
nullif no validator has been set. - Since:
- 3.5
-