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:
  • 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:
    • 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:
    • 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

      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:
    • 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:
    • 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:
    • 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:
    • create

      public ListSelectionDialog create(Shell parentShell)
      Creates and assembles the dialog.
      Parameters:
      parentShell - the parent shell
      Returns:
      the new assembled ListSelectionDialog