Class SelectionDialog

    • Constructor Detail

      • SelectionDialog

        protected SelectionDialog​(Shell parentShell)
        Creates a dialog instance. Note that the dialog will have no visual representation (no widgets) until it is told to open.
        Parameters:
        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.

        Overrides:
        configureShell in class Window
        Parameters:
        shell - the shell
      • createButtonsForButtonBar

        protected void createButtonsForButtonBar​(Composite parent)
        Description copied from class: Dialog
        Adds buttons to this dialog's button bar.

        The Dialog implementation of this framework method adds standard ok and cancel buttons using the createButton framework method. These standard buttons will be accessible from getCancelButton, and getOKButton. Subclasses may override.

        Note: The common button order is: {other buttons}, OK, Cancel. On some platforms, Dialog.initializeBounds() will move the default button to the right.

        Overrides:
        createButtonsForButtonBar in class Dialog
        Parameters:
        parent - the button bar composite
      • 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.

        Parameters:
        composite - the parent composite
        Returns:
        the message label
      • getInitialSelections

        @Deprecated
        protected List getInitialSelections()
        Deprecated.
        use getInitialElementSelections() instead
        Returns the initial selection in this selection dialog.
        Returns:
        the list of initial selected elements or null
      • getInitialElementSelections

        protected List getInitialElementSelections()
        Returns the list of initial element selections.
        Returns:
        List
      • getMessage

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

        public Button getOkButton()
        Returns the ok button.
        Returns:
        the ok button or null if the button is not created yet.
      • getResult

        public Object[] getResult()
        Returns the list of selections made by the user, or null if the selection was canceled.
        Returns:
        the array of selected elements, or null if Cancel was pressed
      • setInitialSelections

        public void setInitialSelections​(Object... selectedElements)
        Sets the initial selection in this selection dialog to the given elements.
        Parameters:
        selectedElements - the array of elements to select
      • setInitialElementSelections

        public void setInitialElementSelections​(List selectedElements)
        Sets the initial selection in this selection dialog to the given elements.
        Parameters:
        selectedElements - the List of elements to select
      • setMessage

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

        protected void setResult​(List newResult)
        Set the selections made by the user, or null if the selection was canceled.
        Parameters:
        newResult - list of selected elements, or null if Cancel was pressed
      • setSelectionResult

        protected void setSelectionResult​(Object[] newResult)
        Set the selections made by the user, or null if the selection was canceled.

        The selections may accessed using getResult.

        Parameters:
        newResult - - the new values
        Since:
        2.0
      • setTitle

        public void setTitle​(String title)
        Sets the title for this dialog.
        Parameters:
        title - the title
      • 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.
        Overrides:
        isResizable in class Dialog
        Returns:
        a boolean indicating whether the dialog is resizable and should have the default style bits for resizable dialogs
        Since:
        3.4