org.csstudio.ui.util.composites
Class ResourceSelectionGroup

java.lang.Object
  extended by Composite
      extended by org.csstudio.ui.util.composites.ResourceSelectionGroup

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.

Version:
$Revision$
Author:
Alexander Will, Joerg Rathlev

Constructor Summary
ResourceSelectionGroup(Composite parent, Listener listener, java.lang.String[] fileExtensions, boolean showNewContainerActions)
          Creates a new instance of the widget.
ResourceSelectionGroup(Composite parent, Listener listener, java.lang.String[] fileExtensions, java.lang.String message, boolean showNewContainerActions)
          Creates a new instance of the widget.
ResourceSelectionGroup(Composite parent, Listener listener, java.lang.String[] fileExtensions, java.lang.String message, boolean showClosedProjects, boolean showNewContainerActions)
          Creates a new instance of the widget.
ResourceSelectionGroup(Composite parent, Listener listener, java.lang.String[] fileExtensions, java.lang.String message, boolean showClosedProjects, boolean showNewContainerActions, int heightHint, int widthHint)
          Creates a new instance of the widget.
 
Method Summary
 void containerSelectionChanged(IResource resource)
          The container selection has changed in the tree view.
 void createContents(java.lang.String message, java.lang.String[] fileExtensions, int heightHint, int widthHint)
          Creates the contents of the composite.
protected  void createTreeViewer(java.lang.String[] fileExtensions, int heightHint)
          Returns a new drill down viewer for this dialog.
 IPath getFullPath()
          Returns the currently entered container name.
 void itemDoubleClicked(IResource resource)
           
 void setInitialFocus()
          Gives focus to one of the widgets in the group, as determined by the group.
 void setSelectedResource(IPath path)
          Selects the resource with the given path.
 void setSelectedResource(IResource resource)
          Selects the given resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceSelectionGroup

public ResourceSelectionGroup(Composite parent,
                              Listener listener,
                              java.lang.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,
                              java.lang.String[] fileExtensions,
                              java.lang.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,
                              java.lang.String[] fileExtensions,
                              java.lang.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,
                              java.lang.String[] fileExtensions,
                              java.lang.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 Detail

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(java.lang.String message,
                           java.lang.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(java.lang.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.