RSE
Release 1.0

org.eclipse.rse.files.ui.actions
Class SystemSelectRemoteFileAction

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.jface.action.AbstractAction
          extended byorg.eclipse.jface.action.Action
              extended byorg.eclipse.rse.ui.actions.SystemBaseAction
                  extended byorg.eclipse.rse.ui.actions.SystemBaseDialogAction
                      extended byorg.eclipse.rse.files.ui.actions.SystemSelectRemoteFileAction
All Implemented Interfaces:
IAction, ISelectionChangedListener, ISystemAction, ISystemDialogAction

public class SystemSelectRemoteFileAction
extends SystemBaseDialogAction

The action for allowing the user to select a remote file.

To configure, call these methods:

Call these methods to configure the text on the dialog

After running, call these methods to get the output:


Field Summary
 
Fields inherited from class org.eclipse.rse.ui.actions.SystemBaseDialogAction
cancelled, dlgHelpId, needsProgressMonitor, needsProgressMonitorSet, processAll, value
 
Fields inherited from class org.eclipse.rse.ui.actions.SystemBaseAction
allowOnMultipleSelection, arrowCursor, helpId, selectionSensitive, shell, sSelection, traceSelections, traceTarget, viewer, waitCursor
 
Fields inherited from interface org.eclipse.jface.action.IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
 
Constructor Summary
SystemSelectRemoteFileAction(Shell shell)
          Constructor that uses default action label and tooltip
SystemSelectRemoteFileAction(Shell shell, String label, String tooltip)
          Constructor when you have your own action label and tooltip
 
Method Summary
 void addViewerFilter(ViewerFilter filter)
          Add viewer filter.
protected  Dialog createDialog(Shell shell)
          Called by eclipse when user selects this action
 void enableAddMode(ISystemAddFileListener caller)
          Enable Add mode.
 void enableAddMode(ISystemAddFileListener caller, String addLabel, String addToolTipText)
          Overloaded method that allows setting the label and tooltip text of the Add button.
protected  Object getDialogValue(Dialog dlg)
          Required by parent.
 IHost getSelectedConnection()
          Return selected connection
 IRemoteFile getSelectedFile()
          Retrieve selected file object.
 IRemoteFile[] getSelectedFiles()
          Retrieve selected file objects.
 Object[] getSelectedObjects()
          Return all selected objects.
 void setAllowFolderSelection(boolean allow)
          Sets whether to allow folder selection.
 void setAutoExpandDepth(int depth)
          Specify the zero-based auto-expand level for the tree.
 void setDefaultConnection(IHost conn)
          Set the connection to default the selection to
 void setDialogTitle(String title)
          Set the title for the dialog.
 void setFileTypes(String fileTypes)
          For files mode, restrict the files list by a comman-delimited array of file types.
 void setFileTypes(String[] fileTypes)
          For files mode, restrict the files list by an array of file types
 void setHost(IHost conn)
          Set the system connection to restrict the user to seeing in the tree.
 void setMessage(String message)
          Set the message shown at the top of the form
 void setMultipleSelectionMode(boolean multiple)
          Set multiple selection mode.
 void setPreSelection(IRemoteFile selection)
          Set a file or folder to preselect.
 void setRestrictFolders(boolean restrict)
          Specify whether setRootFolder should prevent the user from being able to see or select any other folder.
 void setRootFolder(IHost connection, String folderAbsolutePath)
          Set the root folder from which to start listing files.
 void setRootFolder(IRemoteFile rootFolder)
          Set the root folder from which to start listing files.
 void setSelectionTreeToolTipText(String tip)
          Set the tooltip text for the remote systems tree from which an item is selected.
 void setSelectionValidator(IValidatorRemoteSelection selectionValidator)
          Specify a validator to use when the user selects a remote file or folder.
 void setShowNewConnectionPrompt(boolean show)
          Set to true if a "New Connection..." special connection is to be shown for creating new connections
 void setShowPropertySheet(boolean show)
          Show the property sheet on the right hand side, to show the properties of the selected object.
 void setShowPropertySheet(boolean show, boolean initialState)
          Show the property sheet on the right hand side, to show the properties of the selected object.
 void setSystemType(String systemType)
          Convenience method to restrict to a single system type.
 void setSystemTypes(String[] systemTypes)
          Set the system types to restrict what connections the user sees, and what types of connections they can create.
 
Methods inherited from class org.eclipse.rse.ui.actions.SystemBaseDialogAction
getDialogHelpContextId, getNeedsProgressMonitor, getProcessAllSelections, getValue, run, setDialogHelp, setNeedsProgressMonitor, setProcessAllSelections, setValue, wasCancelled, wasNeedsProgressMonitorSet
 
Methods inherited from class org.eclipse.rse.ui.actions.SystemBaseAction
allowOnMultipleSelection, checkObjectType, getAdapter, getContextMenuGroup, getCurrentTreeView, getFirstSelection, getHelpContextId, getNextSelection, getRemoteAdapter, getSelection, getSelectionProvider, getShell, getShell, getSystemConnection, getViewer, isDummy, isEnabled, isSelectionSensitive, issueTraceMessage, selectionChanged, setAvailableOffline, setBusyCursor, setContextMenuGroup, setDisplayCursor, setDisplayCursor, setHelp, setInputs, setSelection, setSelectionProvider, setSelectionSensitive, setShell, setTracing, setTracing, setViewer, updateSelection
 
Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.rse.ui.actions.ISystemAction
allowOnMultipleSelection, getContextMenuGroup, getHelpContextId, getSelection, getShell, getViewer, isDummy, isSelectionSensitive, setContextMenuGroup, setHelp, setInputs, setSelection, setSelectionSensitive, setShell, setViewer
 
Methods inherited from interface org.eclipse.jface.action.IAction
addPropertyChangeListener, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, removePropertyChangeListener, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from interface org.eclipse.jface.viewers.ISelectionChangedListener
selectionChanged
 

Constructor Detail

SystemSelectRemoteFileAction

public SystemSelectRemoteFileAction(Shell shell)
Constructor that uses default action label and tooltip

Parameters:
shell - The shell to hang the dialog off of

SystemSelectRemoteFileAction

public SystemSelectRemoteFileAction(Shell shell,
                                    String label,
                                    String tooltip)
Constructor when you have your own action label and tooltip

Parameters:
shell - The shell to hang the dialog off of
label -
tooltip -
Method Detail

setHost

public void setHost(IHost conn)
Set the system connection to restrict the user to seeing in the tree.

Overrides:
setHost in class SystemBaseAction
See Also:
setRootFolder(IHost, String)

setDefaultConnection

public void setDefaultConnection(IHost conn)
Set the connection to default the selection to


setSystemTypes

public void setSystemTypes(String[] systemTypes)
Set the system types to restrict what connections the user sees, and what types of connections they can create.

Parameters:
systemTypes - An array of system type names
See Also:
IRSESystemType

setSystemType

public void setSystemType(String systemType)
Convenience method to restrict to a single system type. Same as setSystemTypes(new String[] {systemType})

Parameters:
systemType - The name of the system type to restrict to
See Also:
IRSESystemType

setShowNewConnectionPrompt

public void setShowNewConnectionPrompt(boolean show)
Set to true if a "New Connection..." special connection is to be shown for creating new connections


setAutoExpandDepth

public void setAutoExpandDepth(int depth)
Specify the zero-based auto-expand level for the tree. The default is zero, meaning only show the connections.


setRootFolder

public void setRootFolder(IHost connection,
                          String folderAbsolutePath)
Set the root folder from which to start listing files. This version identifies the folder via a connection object and absolute path. There is another overload that identifies the folder via a single IRemoteFile object.

Parameters:
connection - The connection to the remote system containing the root folder
folderAbsolutePath - The fully qualified folder to start listing from (eg: "\folder1\folder2")

setRootFolder

public void setRootFolder(IRemoteFile rootFolder)
Set the root folder from which to start listing files. This version identifies the folder via an IRemoteFile object. There is another overload that identifies the folder via a connection and folder path.

Parameters:
rootFolder - The IRemoteFile object representing the remote folder to start the list from

setPreSelection

public void setPreSelection(IRemoteFile selection)
Set a file or folder to preselect. This will: If there is no parent, then we were given a root. In which case we will


setFileTypes

public void setFileTypes(String[] fileTypes)
For files mode, restrict the files list by an array of file types


setFileTypes

public void setFileTypes(String fileTypes)
For files mode, restrict the files list by a comman-delimited array of file types. The last type must also end in a comma. Eg "java, class," or "class,".


setRestrictFolders

public void setRestrictFolders(boolean restrict)
Specify whether setRootFolder should prevent the user from being able to see or select any other folder. This causes two effects:
  1. The special filter for root/drives is not shown
  2. No subfolders are listed in the root folder


enableAddMode

public void enableAddMode(ISystemAddFileListener caller)
Enable Add mode. This means the OK button is replaced with an Add button, and the Cancel with a Close button. When Add is pressed, the caller is called back. The dialog is not exited until Close is pressed.

When a library is selected, the caller is called back to decide to enable the Add button or not.


enableAddMode

public void enableAddMode(ISystemAddFileListener caller,
                          String addLabel,
                          String addToolTipText)
Overloaded method that allows setting the label and tooltip text of the Add button. If you pass null for the label, the default is used ("Add").


setShowPropertySheet

public void setShowPropertySheet(boolean show)
Show the property sheet on the right hand side, to show the properties of the selected object.

Default is false


setShowPropertySheet

public void setShowPropertySheet(boolean show,
                                 boolean initialState)
Show the property sheet on the right hand side, to show the properties of the selected object.

This overload shows a Details>>> button so the user can decide if they want to see the property sheet.

Parameters:
show - True if to show the property sheet within the dialog
initialState - True if the property is to be initially displayed, false if it is not to be displayed until the user presses the Details button.

setMultipleSelectionMode

public void setMultipleSelectionMode(boolean multiple)
Set multiple selection mode. Default is single selection mode

If you turn on multiple selection mode, you must use the getSelectedObjects() method to retrieve the list of selected objects.

Further, if you turn this on, it has the side effect of allowing the user to select any remote object. The assumption being if you are prompting for files, you also want to allow the user to select a folder, with the meaning being that all files within the folder are implicitly selected.

See Also:
getSelectedObjects()

setSelectionValidator

public void setSelectionValidator(IValidatorRemoteSelection selectionValidator)
Specify a validator to use when the user selects a remote file or folder. This allows you to decide if OK should be enabled or not for that remote file or folder.


setDialogTitle

public void setDialogTitle(String title)
Set the title for the dialog. The default is "Browse for Folder"


setMessage

public void setMessage(String message)
Set the message shown at the top of the form


setSelectionTreeToolTipText

public void setSelectionTreeToolTipText(String tip)
Set the tooltip text for the remote systems tree from which an item is selected.


getSelectedFile

public IRemoteFile getSelectedFile()
Retrieve selected file object. If multiple files selected, returns the first.


getSelectedFiles

public IRemoteFile[] getSelectedFiles()
Retrieve selected file objects. If no files selected, returns an array of zero. If one file selected returns an array of one.


getSelectedObjects

public Object[] getSelectedObjects()
Return all selected objects. This method will return an array of one unless you have called setMultipleSelectionMode(true)!

See Also:
setMultipleSelectionMode(boolean)

getSelectedConnection

public IHost getSelectedConnection()
Return selected connection


createDialog

protected Dialog createDialog(Shell shell)
Called by eclipse when user selects this action

Specified by:
createDialog in class SystemBaseDialogAction
See Also:
SystemBaseDialogAction.run()

getDialogValue

protected Object getDialogValue(Dialog dlg)
Required by parent. We return the selected object

Specified by:
getDialogValue in class SystemBaseDialogAction
Parameters:
dlg - The dialog object, after it has returned from open.

addViewerFilter

public void addViewerFilter(ViewerFilter filter)
Add viewer filter.

Parameters:
filter - a viewer filter.

setAllowFolderSelection

public void setAllowFolderSelection(boolean allow)
Sets whether to allow folder selection. The default selection validator will use this to determine whether the OK button will be enabled when a folder is selected. The default is true.

Parameters:
allow - true to allow folder selection, false otherwise.

RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.