public class ElementTreeSelectionDialog extends SelectionStatusDialog
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
Constructor and Description |
---|
ElementTreeSelectionDialog(Shell parent,
IBaseLabelProvider labelProvider,
ITreeContentProvider contentProvider)
Constructs an instance of
ElementTreeSelectionDialog . |
ElementTreeSelectionDialog(Shell parent,
ILabelProvider labelProvider,
ITreeContentProvider contentProvider)
Constructs an instance of
ElementTreeSelectionDialog . |
Modifier and Type | Method and Description |
---|---|
protected void |
access$setResult(List result)
Set the result using the super class implementation of
setResult.
|
protected void |
access$superButtonPressed(int id)
Set the result using the super class implementation of
buttonPressed.
|
void |
addFilter(ViewerFilter filter)
Adds a filter to the tree viewer.
|
protected void |
cancelPressed()
Handles cancel button pressed event.
|
protected void |
computeResult()
Compute the result and return it.
|
void |
create()
Creates this window's widgetry in a new top-level shell.
|
protected Control |
createDialogArea(Composite parent)
Creates and returns the contents of the upper part of this dialog (above
the button bar).
|
protected TreeViewer |
createTreeViewer(Composite parent)
Creates and initializes the tree viewer.
|
protected TreeViewer |
doCreateTreeViewer(Composite parent,
int style)
Creates the tree viewer.
|
protected TreeViewer |
getTreeViewer()
Returns the tree viewer.
|
protected void |
handleShellCloseEvent()
Notifies that the window's close button was pressed, the close menu was
selected, or the ESCAPE key pressed.
|
int |
open()
Opens this window, creating it first if it has not yet been created.
|
void |
setAllowMultiple(boolean allowMultiple)
Specifies if multiple selection is allowed.
|
void |
setComparator(ViewerComparator comparator)
Sets the comparator used by the tree viewer.
|
void |
setDoubleClickSelects(boolean doubleClickSelects)
Specifies if default selected events (double click) are created.
|
void |
setEmptyListMessage(String message)
Sets the message to be displayed if the list is empty.
|
void |
setInitialSelection(Object selection)
Sets the initial selection.
|
void |
setInput(Object input)
Sets the tree input.
|
void |
setSize(int width,
int height)
Sets the size of the tree in unit of characters.
|
void |
setSorter(ViewerSorter sorter)
Deprecated.
as of 3.3, use
setComparator(ViewerComparator) instead |
void |
setValidator(ISelectionStatusValidator validator)
Sets an optional validator to check if the selection is valid.
|
protected void |
updateOKStatus()
Validate the receiver and update the ok status.
|
configureShell, createButtonBar, getFirstResult, okPressed, setImage, setResult, setStatusLineAboveButtons, updateButtonsEnableState, updateStatus
createButtonsForButtonBar, createMessageArea, getDialogBoundsSettings, getDialogBoundsStrategy, getInitialElementSelections, getInitialSelections, getMessage, getOkButton, getResult, isResizable, setDialogBoundsSettings, setInitialElementSelections, setInitialSelections, setMessage, setResult, setSelectionResult, setTitle
closeTray, createHelpControl, getLayout, getTray, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
applyDialogFont, buttonPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, createButton, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
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
public ElementTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider)
ElementTreeSelectionDialog
.parent
- The parent shell for the dialoglabelProvider
- the label provider to render the entriescontentProvider
- the content provider to evaluate the tree structurepublic ElementTreeSelectionDialog(Shell parent, IBaseLabelProvider labelProvider, ITreeContentProvider contentProvider)
ElementTreeSelectionDialog
.parent
- The parent shell for the dialoglabelProvider
- the label provider to render the entries. It must be
compatible with the Viewerreturned from
doCreateTreeViewer(Composite, int)
contentProvider
- the content provider to evaluate the tree structurepublic void setInitialSelection(Object selection)
selection
- the initial selection.public void setEmptyListMessage(String message)
message
- the message to be displayed.public void setAllowMultiple(boolean allowMultiple)
allowMultiple
- public void setDoubleClickSelects(boolean doubleClickSelects)
doubleClickSelects
- @Deprecated public void setSorter(ViewerSorter sorter)
setComparator(ViewerComparator)
insteadsorter
- public void setComparator(ViewerComparator comparator)
comparator
- public void addFilter(ViewerFilter filter)
filter
- a filter.public void setValidator(ISelectionStatusValidator validator)
validator
- the validator to validate the selection.public void setInput(Object input)
input
- the tree input.public void setSize(int width, int height)
width
- the width of the tree.height
- the height of the tree.protected void updateOKStatus()
public int open()
Window
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:
OK
and CANCEL
.
open
in class Window
Window.create()
protected void cancelPressed()
cancelPressed
in class Dialog
protected void computeResult()
SelectionStatusDialog
computeResult
in class SelectionStatusDialog
public void create()
Window
The default implementation of this framework method creates this window's
shell (by calling createShell
), and its controls (by
calling createContents
), then initializes this window's
shell bounds (by calling initializeBounds
).
create
in class SelectionStatusDialog
protected Control createDialogArea(Composite parent)
Dialog
The Dialog
implementation of this framework method creates
and returns a new Composite
with standard margins and
spacing.
The returned control's layout data must be an instance of
GridData
. This method must not modify the parent's
layout.
Subclasses must override this method but may call super
as
in the following example:
Composite composite = (Composite) super.createDialogArea(parent); //add controls to composite as necessary return composite;
createDialogArea
in class Dialog
parent
- the parent composite to contain the dialog areaprotected TreeViewer createTreeViewer(Composite parent)
parent
- the parent compositedoCreateTreeViewer(Composite, int)
protected TreeViewer doCreateTreeViewer(Composite parent, int style)
parent
- the parent compositestyle
- the SWT
style bitsprotected TreeViewer getTreeViewer()
protected void access$superButtonPressed(int id)
id
- Dialog.buttonPressed(int)
protected void access$setResult(List result)
result
- SelectionStatusDialog.setResult(int, Object)
protected void handleShellCloseEvent()
Window
The default implementation of this framework method sets the window's
return code to CANCEL
and closes the window using
close
. Subclasses may extend or reimplement.
handleShellCloseEvent
in class TrayDialog
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.