Class ResourceListSelectionDialog

All Implemented Interfaces:
IShellProvider

public class ResourceListSelectionDialog extends SelectionDialog
Shows a list of resources to the user with a text entry field for a string pattern used to filter the list of resources.
Since:
2.1
  • Constructor Details

    • ResourceListSelectionDialog

      public ResourceListSelectionDialog(Shell parentShell, IResource[] resources)
      Creates a new instance of the class.
      Parameters:
      parentShell - shell to parent the dialog on
      resources - resources to display in the dialog
    • ResourceListSelectionDialog

      public ResourceListSelectionDialog(Shell parentShell, IContainer container, int typeMask)
      Creates a new instance of the class. When this constructor is used to create the dialog, resources will be gathered dynamically as the pattern string is specified. Only resources of the given types that match the pattern string will be listed. To further filter the matching resources,
      Parameters:
      parentShell - shell to parent the dialog on
      container - container to get resources from
      typeMask - mask containing IResource types to be considered
      See Also:
  • Method Details

    • adjustPattern

      protected String adjustPattern()
      Adjust the pattern string for matching.
    • 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.

      Overrides:
      cancelPressed in class Dialog
      See Also:
    • close

      public boolean close()
      Description copied from class: Window
      Closes this window, disposes its shell, and removes this window from its window manager (if it has one).

      This framework method may be extended (super.close must be called).

      Note that in order to prevent recursive calls to this method it does not call Shell#close(). As a result ShellListeners will not receive a shellClosed event.

      Overrides:
      close in class Dialog
      Returns:
      true if the window is (or was already) closed, and false if it is still open
      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).

      Overrides:
      create in class Dialog
      See Also:
    • createDialogArea

      protected Control createDialogArea(Composite parent)
      Creates the contents of this dialog, initializes the listener and the update thread.
      Overrides:
      createDialogArea in class Dialog
      Parameters:
      parent - parent to create the dialog widgets in
      Returns:
      the dialog area control
    • getAllowUserToToggleDerived

      public boolean getAllowUserToToggleDerived()
      Returns whether to include a "Show derived resources" checkbox in the dialog. The default is false.
      Returns:
      true to include the checkbox, false to omit
      Since:
      3.1
    • setAllowUserToToggleDerived

      public void setAllowUserToToggleDerived(boolean allow)
      Sets whether to include a "Show derived resources" checkbox in the dialog.
      Parameters:
      allow - true to include the checkbox, false to omit
      Since:
      3.1
    • getShowDerived

      protected boolean getShowDerived()
      Returns whether derived resources should be shown in the list. The default is false.
      Returns:
      true to show derived resources, false to hide them
      Since:
      3.1
    • setShowDerived

      protected void setShowDerived(boolean show)
      Sets whether derived resources should be shown in the list.
      Parameters:
      show - true to show derived resources, false to hide them
      Since:
      3.1
    • okPressed

      protected void okPressed()
      The user has selected a resource and the dialog is closing. Set the selected resource as the dialog result.
      Overrides:
      okPressed in class Dialog
    • select

      protected boolean select(IResource resource)
      Use this method to further filter resources. As resources are gathered, if a resource matches the current pattern string, this method will be called. If this method answers false, the resource will not be included in the list of matches and the resource's children will NOT be considered for matching.
      Parameters:
      resource - to be used by overrides
    • refresh

      protected void refresh(boolean force)
      Refreshes the filtered list of resources. Called when the text in the pattern text entry has changed.
      Parameters:
      force - if true a refresh is forced, if false a refresh only occurs if the pattern has changed
      Since:
      3.1
    • updateOKState

      protected void updateOKState(boolean state)
      Update the enabled state of the OK button. To be called when the resource list is updated.
      Parameters:
      state - the new enabled state of the button
    • getDialogBoundsSettings

      protected IDialogSettings getDialogBoundsSettings()
      Description copied from class: SelectionDialog
      Gets the dialog settings that should be used for remembering the bounds of the dialog, according to the dialog bounds strategy. Overridden to provide the dialog settings that were set using SelectionDialog.setDialogBoundsSettings(IDialogSettings, int).
      Overrides:
      getDialogBoundsSettings in class SelectionDialog
      Returns:
      the dialog settings used to store the dialog's location and/or size, or null if the dialog's bounds should not be stored.
      See Also: