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 createListSelectionDialoginstances. It has a fluent API (every method returns the same builder instance).- Since:
- 3.123
- See Also:
ListSelectionDialog.of(Object)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListSelectionDialog.BuilderasSheet(boolean asSheet)Sets whether to show the dialog as sheet.ListSelectionDialog.BuildercanCancel(boolean canCancel)Sets whether the dialog can be canceled.ListSelectionDialog.BuildercheckboxText(String checkboxText)Sets the label of the optional check box.ListSelectionDialog.BuildercheckboxValue(boolean checkboxValue)Sets the selection state of the optional check box.ListSelectionDialog.BuildercontentProvider(IStructuredContentProvider contentProvider)Sets the content provider.ListSelectionDialogcreate(Shell parentShell)Creates and assembles the dialog.ListSelectionDialog.BuilderlabelProvider(ILabelProvider labelProvider)Sets the label provider.ListSelectionDialog.Buildermessage(String message)Sets the message.ListSelectionDialog.BuilderokButtonText(String text)Sets the OK button label.ListSelectionDialog.BuilderokButtonTextWhenNoSelection(String text)Sets the OK button label that will be displayed when no item is selected; otherwise the label ofokButtonText(String)will be displayed.ListSelectionDialog.Builderpreselect(Object... initialSelections)Sets the initial selection to the given elements.ListSelectionDialog.Buildertitle(String title)Sets the title for this dialog.
-
-
-
Method Detail
-
contentProvider
public ListSelectionDialog.Builder contentProvider(IStructuredContentProvider contentProvider)
Sets the content provider.When this method is not called or when set to
null,ArrayContentProviderwill 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,LabelProviderwill 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_titlewill 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, ornullto 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 ofokButtonText(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.
-
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
-
-