Class AbstractElementListSelectionDialog

All Implemented Interfaces:
Direct Known Subclasses:
ElementListSelectionDialog, TwoPaneElementSelector

public abstract class AbstractElementListSelectionDialog extends SelectionStatusDialog
An abstract class to select elements out of a list of elements.
  • Field Details

    • fFilteredList

      protected FilteredList fFilteredList
      Allows direct access to the filtered list.
  • Constructor Details

    • AbstractElementListSelectionDialog

      protected AbstractElementListSelectionDialog(Shell parent, ILabelProvider renderer)
      Constructs a list selection dialog.
      parent - The parent for the list.
      renderer - ILabelProvider for the list
  • Method Details

    • handleDefaultSelected

      protected void handleDefaultSelected()
      Handles default selection (double click). By default, the OK button is pressed.
    • setIgnoreCase

      public void setIgnoreCase(boolean ignoreCase)
      Specifies if sorting, filtering and folding is case sensitive.
      ignoreCase - true if case insensitive, false otherwise.
    • isCaseIgnored

      public boolean isCaseIgnored()
      Returns if sorting, filtering and folding is case sensitive.
    • setMatchEmptyString

      public void setMatchEmptyString(boolean matchEmptyString)
      Specifies whether everything or nothing should be filtered on empty filter string.
      matchEmptyString - boolean
    • setMultipleSelection

      public void setMultipleSelection(boolean multipleSelection)
      Specifies if multiple selection is allowed.
      multipleSelection - true if multiple selections are allowed.
    • setAllowDuplicates

      public void setAllowDuplicates(boolean allowDuplicates)
      Specifies whether duplicate entries are displayed or not.
      allowDuplicates - true if duplicate entries must be displayed.
    • setSize

      public void setSize(int width, int height)
      Sets the list size in unit of characters.
      width - the width of the list.
      height - the height of the list.
    • setEmptyListMessage

      public void setEmptyListMessage(String message)
      Sets the message to be displayed if the list is empty.
      message - the message to be displayed.
    • setEmptySelectionMessage

      public void setEmptySelectionMessage(String message)
      Sets the message to be displayed if the selection is empty.
      message - the message to be displayed.
    • setValidator

      public void setValidator(ISelectionStatusValidator validator)
      Sets an optional validator to check if the selection is valid. The validator is invoked whenever the selection changes.
      validator - the validator to validate the selection.
    • setListElements

      protected void setListElements(Object[] elements)
      Sets the elements of the list (widget).
      elements - the elements of the list.
    • handleElementsChanged

      protected void handleElementsChanged()
      This method is called when the elements of the backing list are changed to refresh the standard dialog widgets.
    • setFilter

      public void setFilter(String filter)
      Sets the filter pattern.
      filter - the filter pattern.
    • getFilter

      public String getFilter()
      Returns the current filter pattern.
      returns the current filter pattern or null if filter was not set.
    • getSelectionIndices

      protected int[] getSelectionIndices()
      Returns the indices referring the current selection. To be called within open().
      returns the indices of the current selection.
    • getSelectionIndex

      protected int getSelectionIndex()
      Returns an index referring the first current selection. To be called within open().
      returns the indices of the current selection.
    • setSelection

      protected void setSelection(Object[] selection)
      Sets the selection referenced by an array of elements. Empty or null array removes selection. To be called within open().
      selection - the indices of the selection.
    • getSelectedElements

      protected Object[] getSelectedElements()
      Returns an array of the currently selected elements. To be called within or after open().
      returns an array of the currently selected elements.
    • getFoldedElements

      public Object[] getFoldedElements(int index)
      Returns all elements which are folded together to one entry in the list.
      index - the index selecting the entry in the list.
      returns an array of elements folded together.
    • createMessageArea

      protected Label createMessageArea(Composite composite)
      Creates the message text widget and sets layout data.
      createMessageArea in class SelectionDialog
      composite - the parent composite of the message area.
      the message label
    • handleSelectionChanged

      protected void handleSelectionChanged()
      Handles a selection changed event. By default, the current selection is validated.
    • validateCurrentSelection

      protected boolean validateCurrentSelection()
      Validates the current selection and updates the status line accordingly.
      boolean true if the current selection is valid.
    • cancelPressed

      protected void cancelPressed()
      Description copied from class: Dialog
      Notifies that the cancel button of this dialog has been pressed.

      The Dialog implementation of this framework method sets this dialog's return code to Window.CANCEL and closes the dialog. Subclasses may override if desired.

      cancelPressed in class Dialog
    • createFilteredList

      protected FilteredList createFilteredList(Composite parent)
      Creates a filtered list.
      parent - the parent composite.
      returns the filtered list widget.
    • createFilterText

      protected Text createFilterText(Composite parent)
      Creates the filter text. Subclasses are allowed to override if they want the text to be created differently and must not call super in this case.
      parent - the parent to create the widget on
      the created filter text widget.
    • open

      public int open()
      Description copied from class: Window
      Opens this window, creating it first if it has not yet been created.

      If this window has been configured to block on open ( setBlockOnOpen), this method waits until the window is closed by the end user, and then it returns the window's return code; otherwise, this method returns immediately. A window's return codes are window-specific, although two standard return codes are predefined: OK and CANCEL.

      open in class Window
      the return code
      See Also:
    • create

      public void create()
      Description copied from class: Window
      Creates this window's widgetry in a new top-level shell.

      The default implementation of this framework method creates this window's shell (by calling createShell), and its controls (by calling createContents), then initializes this window's shell bounds (by calling initializeBounds).

      create in class SelectionStatusDialog
    • handleEmptyList

      protected void handleEmptyList()
      Handles empty list by disabling widgets.
    • updateOkState

      protected void updateOkState()
      Update the enablement of the OK button based on whether or not there is a selection.
    • getValidator

      protected ISelectionStatusValidator getValidator()
      Gets the optional validator used to check if the selection is valid. The validator is invoked whenever the selection changes.
      the validator to validate the selection, or null if no validator has been set.