Class AbstractSelectionDialog<T>

  • Type Parameters:
    T - which declares the type of the elements in the AbstractSelectionDialog.
    All Implemented Interfaces:

    public abstract class AbstractSelectionDialog<T>
    extends TrayDialog
    The abstract implementation of a selection dialog. It can be primed with initial selections (setInitialSelection), and returns the final selection (via getResult) after completion.

    Clients may subclass this dialog to inherit its selection facilities.

    • Constructor Detail

      • AbstractSelectionDialog

        protected AbstractSelectionDialog​(Shell parentShell)
        Creates a dialog instance.
        parentShell - the parent shell
    • Method Detail

      • configureShell

        protected void configureShell​(Shell shell)
        Description copied from class: Window
        Configures the given shell in preparation for opening this window in it.

        The default implementation of this framework method sets the shell's image and gives it a grid layout. Subclasses may extend or reimplement.

        configureShell in class Window
        shell - the shell
      • createMessageArea

        protected Label createMessageArea​(Composite composite)
        Creates the message area for this dialog.

        This method is provided to allow subclasses to decide where the message will appear on the screen.

        composite - the parent composite
        the message label
      • getInitialSelection

        protected List<T> getInitialSelection()
        Returns the collection of initial element selections.
      • getMessage

        protected String getMessage()
        Returns the message for this dialog.
        the message for this dialog
      • getResult

        public Collection<T> getResult()
        Returns the collection of selections made by the user.
        the collection of selected elements, or null if no result was set
      • setInitialSelection

        public void setInitialSelection​(T... selectedElements)
        Sets the initial selection in this selection dialog to the given elements.
        selectedElements - the elements to select
      • setInitialSelection

        public void setInitialSelection​(Collection<T> selectedElements)
        Sets the initial selection in this selection dialog to the given elements.
        selectedElements - the List of elements to select
      • setMessage

        public void setMessage​(String message)
        Sets the message for this dialog.
        message - the message
      • setResult

        protected void setResult​(Collection<T> newUserSelection)
        Set the selections made by the user, or null if the selection was canceled.
        newUserSelection - collection of selected elements, or null if Cancel was pressed
      • setResult

        protected void setResult​(T... newUserSelection)
        Set the selections made by the user, or null if the selection was canceled.

        The selections may accessed using getResult.

        newUserSelection - - the new values
      • setTitle

        public void setTitle​(String title)
        Sets the title for this dialog.
        title - the title
      • getDialogBoundsSettings

        protected IDialogSettings getDialogBoundsSettings()
        Description copied from class: Dialog
        Gets the dialog settings that should be used for remembering the bounds of of the dialog, according to the dialog bounds strategy.
        getDialogBoundsSettings in class Dialog
        settings the dialog settings used to store the dialog's location and/or size, or null if the dialog's bounds should never be stored.
        See Also:
      • isResizable

        protected boolean isResizable()
        Description copied from class: Dialog
        Returns a boolean indicating whether the dialog should be considered resizable when the shell style is initially set. This method is used to ensure that all style bits appropriate for resizable dialogs are added to the shell style. Individual dialogs may always set the shell style to ensure that a dialog is resizable, but using this method ensures that resizable dialogs will be created with the same set of style bits. Style bits will never be removed based on the return value of this method. For example, if a dialog returns false, but also sets a style bit for a SWT.RESIZE border, the style bit will be honored.
        isResizable in class Dialog
        a boolean indicating whether the dialog is resizable and should have the default style bits for resizable dialogs