public class TreeSelectionDialogProvider
extends java.lang.Object
To set up a dialog, instantiate a provider. You must override the following methods as would normally be done for a JFace content or label provider:
You may now open the dialog by calling
openDialog(Shell, Object, boolean)
.
To get the results of the selection after OK has been pressed, the provider has the following methods:
Constructor and Description |
---|
TreeSelectionDialogProvider() |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.Object> |
getAllSelectedLeafElements()
Gets all selected leaf nodes in the tree.
|
java.lang.Object[] |
getChildren(java.lang.Object parent)
Gets the children of the specified element.
|
java.util.List<java.lang.Object> |
getSelectedLeafElements()
Gets all newly selected leaf nodes in the tree.
|
java.lang.String |
getText(java.lang.Object element)
Gets the text label for the element.
|
java.util.List<java.lang.Object> |
getUnselectedLeafElements()
Gets all leaf nodes that were unselected from the tree.
|
boolean |
isSelected(java.lang.Object element)
Whether or not the element is selected.
|
int |
openDialog(org.eclipse.swt.widgets.Shell shell,
java.lang.Object input,
boolean allowMultipleSelections)
Creates and opens a dialog enabling the user to select one or more
elements from the specified input tree.
|
void |
setMessage(java.lang.String message)
Sets the message to display in the created dialog.
|
void |
setTitle(java.lang.String title)
Sets the title to display in the created dialog.
|
public java.util.List<java.lang.Object> getAllSelectedLeafElements()
public java.lang.Object[] getChildren(java.lang.Object parent)
Note: Cycles are prohibited and may cause unexpected results.
parent
- The element that may or may not have children that will also
be put in the tree.public java.util.List<java.lang.Object> getSelectedLeafElements()
public java.lang.String getText(java.lang.Object element)
element
- The element that will be put in the tree.public java.util.List<java.lang.Object> getUnselectedLeafElements()
public boolean isSelected(java.lang.Object element)
element
- The element that will be put in the tree.public int openDialog(org.eclipse.swt.widgets.Shell shell, java.lang.Object input, boolean allowMultipleSelections)
shell
- The parent shell for the dialog.input
- The input for the dialog's tree.allowMultipleSelections
- Whether or not to allow multiple items to be selected. If
false, then only one item may be selected from the tree,
otherwise the tree's selection will be determined by
checkboxes.Window.OK
or
Window.CANCEL
.public void setMessage(java.lang.String message)
message
- The new message.public void setTitle(java.lang.String title)
title
- The new title.