Package org.eclipse.ui.dialogs

# Class ListSelectionDialog.Builder

java.lang.Object
org.eclipse.ui.dialogs.ListSelectionDialog.Builder

Enclosing class:
  ListSelectionDialog

public static final class ListSelectionDialog.Builder extends Object
The Builder to create `ListSelectionDialog` instances. It has a fluent API (every method returns the same builder instance).

Since:
  3.123
See Also:
  - `ListSelectionDialog.of(Object)`

## Method Summary

Modifier and Type
Method
Description
`ListSelectionDialog.Builder`
`asSheet(boolean asSheet)`
Sets whether to show the dialog as sheet.
`ListSelectionDialog.Builder`
`canCancel(boolean canCancel)`
Sets whether the dialog can be canceled.
`ListSelectionDialog.Builder`
`checkboxText(String checkboxText)`
Sets the label of the optional check box.
`ListSelectionDialog.Builder`
`checkboxValue(boolean checkboxValue)`
Sets the selection state of the optional check box.
`ListSelectionDialog.Builder`
`contentProvider(IStructuredContentProvider contentProvider)`
Sets the content provider.
`ListSelectionDialog`
`create(Shell parentShell)`
Creates and assembles the dialog.
`ListSelectionDialog.Builder`
`labelProvider(ILabelProvider labelProvider)`
Sets the label provider.
`ListSelectionDialog.Builder`
`message(String message)`
Sets the message.
`ListSelectionDialog.Builder`
`okButtonText(String text)`
Sets the OK button label.
`ListSelectionDialog.Builder`
`okButtonTextWhenNoSelection(String text)`
Sets the OK button label that will be displayed when no item is selected; otherwise the label of `okButtonText(String)` will be displayed.
`ListSelectionDialog.Builder`
`preselect(Object... initialSelections)`
Sets the initial selection to the given elements.
`ListSelectionDialog.Builder`
`title(String title)`
Sets the title for this dialog.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### contentProvider

public ListSelectionDialog.Builder contentProvider(IStructuredContentProvider contentProvider)
Sets the content provider.

When this method is not called or when set to `null`, `ArrayContentProvider` will be used.

Parameters:
  `contentProvider` - the content provider for navigating the model
Returns:
  this

### labelProvider

public ListSelectionDialog.Builder labelProvider(ILabelProvider labelProvider)
Sets the label provider.

When this method is not called or when set to `null`, `LabelProvider` will be used.

Parameters:
  `labelProvider` - the label provider for displaying model elements
Returns:
  this

### preselect

public ListSelectionDialog.Builder preselect(Object... initialSelections)
Sets the initial selection to the given elements.

When this method is not called, no element will be preselected.

Parameters:
  `initialSelections` - the array of elements to preselect
Returns:
  this
See Also:
  - `SelectionDialog.setInitialSelections(Object...)`

### title

public ListSelectionDialog.Builder title(String title)
Sets the title for this dialog.

When this method is not called or when set to `null`, `WorkbenchMessages.ListSelection_title` will be used as dialog title.

Parameters:
  `title` - the title
Returns:
  this
See Also:
  - `SelectionDialog.setTitle(String)`

### message

public ListSelectionDialog.Builder message(String message)
Sets the message.

When this method is not called or when set to `null`, a default message will shown.

Parameters:
  `message` - the message to be displayed at the top of this dialog, or `null` to display a default message
Returns:
  this

### okButtonText

public ListSelectionDialog.Builder okButtonText(String text)
Sets the OK button label.

Parameters:
  `text` - the label of the OK button; can contain the placeholder `{0}` for the number of currently selected elements and the placeholder `{1}` for the total number of elements
Returns:
  this
See Also:
  - `okButtonTextWhenNoSelection(String)`

### okButtonTextWhenNoSelection

public ListSelectionDialog.Builder okButtonTextWhenNoSelection(String text)
Sets the OK button label that will be displayed when no item is selected; otherwise the label of `okButtonText(String)` will be displayed.

Parameters:
  `text` - the label of the OK button when no item is selected which can contain the placeholder `{0}` for the number of currently selected elements and the placeholder `{1}` for the total number of elements
Returns:
  this
See Also:
  - `okButtonText(String)`

### canCancel

public ListSelectionDialog.Builder canCancel(boolean canCancel)
Sets whether the dialog can be canceled.

Parameters:
  `canCancel` - whether selecting can be canceled or not (via the Cancel button or by closing the dialog)
Returns:
  this

### asSheet

public ListSelectionDialog.Builder asSheet(boolean asSheet)
Sets whether to show the dialog as sheet.

Parameters:
  `asSheet` - whether to use `SWT.SHEET` (modal dialog that is attached to a parent window)
Returns:
  this
See Also:
  - `SWT.SHEET`

### checkboxText

public ListSelectionDialog.Builder checkboxText(String checkboxText)
Sets the label of the optional check box.

When this method is not called or when set to `null`, the optional check box will be hidden.

Parameters:
  `checkboxText` - the check box label
Returns:
  this
See Also:
  - `Button.setText(String)`
  - `checkboxValue(boolean)`

### checkboxValue

public ListSelectionDialog.Builder checkboxValue(boolean checkboxValue)
Sets the selection state of the optional check box.

Parameters:
  `checkboxValue` - the initial selection state
Returns:
  this
See Also:
  - `Button.setSelection(boolean)`
  - `checkboxText(String)`

### create

public ListSelectionDialog create(Shell parentShell)
Creates and assembles the dialog.

Parameters:
  `parentShell` - the parent shell
Returns:
  the new assembled `ListSelectionDialog`