Class ResourceSelectionGroup

All Implemented Interfaces:
Drawable

public final class ResourceSelectionGroup extends Composite
Workbench-level composite for choosing a resource.

Code is based upon org.eclipse.ui.internal.ide.misc.ContainerSelectionGroup in plugin org.eclipse.ui.ide.

  • Constructor Details

    • ResourceSelectionGroup

      public ResourceSelectionGroup(Composite parent, Listener listener, String[] fileExtensions, boolean showNewContainerActions)
      Creates a new instance of the widget.
      Parameters:
      parent - The parent widget of the group.
      listener - A listener to forward events to. Can be null if no listener is required.
      fileExtensions - File extensions of files to include in the tree view. Pass an empty array or null to show only container resources.
      showNewContainerActions - Whether to show the New Folder and New Project actions.
    • ResourceSelectionGroup

      public ResourceSelectionGroup(Composite parent, Listener listener, String[] fileExtensions, String message, boolean showNewContainerActions)
      Creates a new instance of the widget.
      Parameters:
      parent - The parent widget of the group.
      listener - A listener to forward events to. Can be null if no listener is required.
      fileExtensions - File extensions of files to include in the tree view. Pass an empty array or null to show only container resources.
      message - The text to present to the user.
      showNewContainerActions - Whether to show the New Folder and New Project actions.
    • ResourceSelectionGroup

      public ResourceSelectionGroup(Composite parent, Listener listener, String[] fileExtensions, String message, boolean showClosedProjects, boolean showNewContainerActions)
      Creates a new instance of the widget.
      Parameters:
      parent - The parent widget of the group.
      listener - A listener to forward events to. Can be null if no listener is required.
      fileExtensions - File extensions of files to include in the tree view. Pass an empty array or null to show only container resources.
      message - The text to present to the user.
      showClosedProjects - Whether or not to show closed projects.
      showNewContainerActions - Whether to show the New Folder and New Project actions.
    • ResourceSelectionGroup

      public ResourceSelectionGroup(Composite parent, Listener listener, String[] fileExtensions, String message, boolean showClosedProjects, boolean showNewContainerActions, int heightHint, int widthHint)
      Creates a new instance of the widget.
      Parameters:
      parent - The parent widget of the group.
      listener - A listener to forward events to. Can be null if no listener is required.
      fileExtensions - File extensions of files to include in the tree view. Pass an empty array or null to show only container resources.
      message - The text to present to the user.
      showClosedProjects - Whether or not to show closed projects.
      showNewContainerActions - Whether to show the New Folder and New Project actions.
      heightHint - height hint for the drill down composite
      widthHint - width hint for the drill down composite
  • Method Details

    • containerSelectionChanged

      public void containerSelectionChanged(IResource resource)
      The container selection has changed in the tree view. Update the container name field value and notify all listeners.
      Parameters:
      resource - The container that changed
    • itemDoubleClicked

      public void itemDoubleClicked(IResource resource)
    • createContents

      public void createContents(String message, String[] fileExtensions, int heightHint, int widthHint)
      Creates the contents of the composite.
      Parameters:
      message - The text to present to the user.
      fileExtensions - The file extensions of files to include in the tree.
      heightHint - The height of the tree widget.
      widthHint - The width of the tree widget.
    • createTreeViewer

      protected void createTreeViewer(String[] fileExtensions, int heightHint)
      Returns a new drill down viewer for this dialog.
      Parameters:
      fileExtensions - The file extensions of files to include in the tree.
      heightHint - height hint for the drill down composite
    • getFullPath

      public IPath getFullPath()
      Returns the currently entered container name. Null if the field is empty. Note that the container may not exist yet if the user entered a new container name in the field.
      Returns:
      IPath
    • setInitialFocus

      public void setInitialFocus()
      Gives focus to one of the widgets in the group, as determined by the group.
    • setSelectedResource

      public void setSelectedResource(IResource resource)
      Selects the given resource.
      Parameters:
      resource - the resource to select.
    • setSelectedResource

      public void setSelectedResource(IPath path)
      Selects the resource with the given path.
      Parameters:
      path - The path to a specific resource.