Class CheckedTreeSelectionDialog
- All Implemented Interfaces:
IShellProvider
- Since:
- 2.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
-
Field Summary
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, ELLIPSIS
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred
-
Constructor Summary
ConstructorDescriptionCheckedTreeSelectionDialog
(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) Constructs an instance ofElementTreeSelectionDialog
.CheckedTreeSelectionDialog
(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider, boolean allowEmptyTree) Constructs an instance ofElementTreeSelectionDialog
.CheckedTreeSelectionDialog
(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider, int style) Constructs an instance ofElementTreeSelectionDialog
.CheckedTreeSelectionDialog
(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider, int style, boolean allowEmptyTree) Constructs an instance ofElementTreeSelectionDialog
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFilter
(ViewerFilter filter) Adds a filter to the tree viewer.protected void
Handles cancel button pressed event.protected void
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 Composite
createSelectionButtons
(Composite composite) Adds the selection and deselection buttons to the dialog.protected CheckboxTreeViewer
createTreeViewer
(Composite parent) Creates the tree viewer.protected CheckboxTreeViewer
Returns the tree viewer.int
open()
Opens this window, creating it first if it has not yet been created.void
setComparator
(ViewerComparator comparator) Sets the comparator used by the tree viewer.void
setContainerMode
(boolean containerMode) If set, the checked /gray state of containers (inner nodes) is derived from the checked state of its leaf nodes.void
setEmptyListMessage
(String message) Sets the message to be displayed if the list is empty.void
setExpandedElements
(Object[] elements) Expands elements in the tree.void
setInitialSelection
(Object selection) Sets the initial selection.void
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.void
setStyle
(int style) Set the style used for the creation of the Tree.void
setValidator
(ISelectionStatusValidator validator) Sets an optional validator to check if the selection is valid.protected void
Validate the receiver and update the status with the result.Methods inherited from class org.eclipse.ui.dialogs.SelectionStatusDialog
configureShell, createButtonBar, getFirstResult, okPressed, setImage, setResult, setStatusLineAboveButtons, updateButtonsEnableState, updateStatus
Methods inherited from class org.eclipse.ui.dialogs.SelectionDialog
createButtonsForButtonBar, createMessageArea, getDialogBoundsSettings, getDialogBoundsStrategy, getInitialElementSelections, getInitialSelections, getMessage, getOkButton, getResult, isResizable, setDialogBoundsSettings, setInitialElementSelections, setInitialSelections, setMessage, setResult, setSelectionResult, setTitle
Methods inherited from class org.eclipse.jface.dialogs.TrayDialog
closeTray, createHelpControl, getLayout, getTray, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
Methods inherited from class org.eclipse.jface.dialogs.Dialog
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
Methods 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
-
Constructor Details
-
CheckedTreeSelectionDialog
public CheckedTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) Constructs an instance ofElementTreeSelectionDialog
.- Parameters:
parent
- The shell to parent from.labelProvider
- the label provider to render the entriescontentProvider
- the content provider to evaluate the tree structure
-
CheckedTreeSelectionDialog
public CheckedTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider, boolean allowEmptyTree) Constructs an instance ofElementTreeSelectionDialog
.- Parameters:
parent
- The shell to parent from.labelProvider
- the label provider to render the entriescontentProvider
- the content provider to evaluate the tree structureallowEmptyTree
-true
if an empty tree can be input,false
if an empty tree must be treated as an error- Since:
- 3.131
-
CheckedTreeSelectionDialog
public CheckedTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider, int style) Constructs an instance ofElementTreeSelectionDialog
.- Parameters:
parent
- The shell to parent from.labelProvider
- the label provider to render the entriescontentProvider
- the content provider to evaluate the tree structurestyle
- the style of the tree- Since:
- 3.105
-
CheckedTreeSelectionDialog
public CheckedTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider, int style, boolean allowEmptyTree) Constructs an instance ofElementTreeSelectionDialog
.- Parameters:
parent
- The shell to parent from.labelProvider
- the label provider to render the entriescontentProvider
- the content provider to evaluate the tree structurestyle
- the style of the treeallowEmptyTree
-true
if an empty tree can be input,false
if an empty tree must be treated as an error- Since:
- 3.131
-
-
Method Details
-
setContainerMode
public void setContainerMode(boolean containerMode) If set, the checked /gray state of containers (inner nodes) is derived from the checked state of its leaf nodes.- Parameters:
containerMode
- The containerMode to set
-
setInitialSelection
Sets the initial selection. Convenience method.- Parameters:
selection
- the initial selection.
-
setEmptyListMessage
Sets the message to be displayed if the list is empty.- Parameters:
message
- the message to be displayed.
-
setSorter
Deprecated.since 3.3, usesetComparator(ViewerComparator)
insteadSets the sorter used by the tree viewer.- Parameters:
sorter
- the sorter
-
setStyle
public void setStyle(int style) Set the style used for the creation of the Tree. Changing this will only have an effect up to the time the Tree is created.- Parameters:
style
- the style of the tree- Since:
- 3.105
-
setComparator
Sets the comparator used by the tree viewer.- Parameters:
comparator
- theViewerComparator
- Since:
- 3.3
-
addFilter
Adds a filter to the tree viewer.- Parameters:
filter
- a filter.
-
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.
-
setInput
Sets the tree input.- Parameters:
input
- the tree input.
-
setExpandedElements
Expands elements in the tree.- Parameters:
elements
- The elements that will be expanded.
-
setSize
public void setSize(int width, int height) Sets the size of the tree in unit of characters.- Parameters:
width
- the width of the tree.height
- the height of the tree.
-
updateOKStatus
protected void updateOKStatus()Validate the receiver and update the status with the result. -
open
public int open()Description copied from class:Window
Opens 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:OK
andCANCEL
. -
cancelPressed
protected void cancelPressed()Handles cancel button pressed event.- Overrides:
cancelPressed
in classDialog
-
computeResult
protected void computeResult()Description copied from class:SelectionStatusDialog
Compute the result and return it.- Specified by:
computeResult
in classSelectionStatusDialog
-
create
public void create()Description copied from class:Window
Creates 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:
create
in classSelectionStatusDialog
-
createDialogArea
Description copied from class:Dialog
Creates and returns the contents of the upper part of this dialog (above the button bar).The
Dialog
implementation of this framework method creates and returns a newComposite
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;
- Overrides:
createDialogArea
in classDialog
- Parameters:
parent
- the parent composite to contain the dialog area- Returns:
- the dialog area control
-
createTreeViewer
Creates the tree viewer.- Parameters:
parent
- the parent composite- Returns:
- the tree viewer
-
getTreeViewer
Returns the tree viewer.- Returns:
- the tree viewer
-
createSelectionButtons
Adds the selection and deselection buttons to the dialog.- Parameters:
composite
- the parent composite- Returns:
- Composite the composite the buttons were created in.
-
setComparator(ViewerComparator)
instead