|
 |
|
|
org.eclipse.rse.files.ui.widgets
Class SystemQualifiedRemoteFolderCombo
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.rse.files.ui.widgets.SystemQualifiedRemoteFolderCombo
-
All Implemented Interfaces:
-
ISystemCombo,
Drawable
-
public class SystemQualifiedRemoteFolderCombo
- extends
Composite
- implements
ISystemCombo
This re-usable widget is for selecting a new or previously specified
folder path within a given connection.
The dropdown is historical and contains a folder path qualified by a connection name.
It is readonly ... the user must use the browse button.
The composite is layed as follows:
Folder: conn\dir1_____v Browse...
The browse button lists only connections that are of the specified subsystem factory.
It also by default has a New Connection... prompting object for creating new connections, but this can be
turned off.
To get the current folder object selected, use getFolder().
To listen for changes, use addSelectionListener().
Fields inherited from class org.eclipse.swt.widgets.
Widget
|
handle
|
Methods inherited from class org.eclipse.swt.widgets.
Composite
|
changed,
checkSubclass,
computeSize,
getBackgroundMode,
getChildren,
getClientArea,
getLayout,
getLayoutDeferred,
getTabList,
isLayoutDeferred,
layout,
layout,
layout,
layout,
setBackgroundMode,
setLayout,
setLayoutDeferred,
setTabList
|
Methods inherited from class org.eclipse.swt.widgets.
Control
|
addControlListener,
addDragDetectListener,
addFocusListener,
addHelpListener,
addKeyListener,
addMenuDetectListener,
addMouseListener,
addMouseMoveListener,
addMouseTrackListener,
addMouseWheelListener,
addPaintListener,
addTraverseListener,
computeSize,
dragDetect,
dragDetect,
forceFocus,
getAccessible,
getBackground,
getBackgroundImage,
getBounds,
getCursor,
getData,
getDragDetect,
getEnabled,
getFont,
getForeground,
getLayoutData,
getLocation,
getMenu,
getMonitor,
getParent,
getRegion,
getShell,
getSize,
getToolTipText,
getVisible,
internal_dispose_GC,
internal_new_GC,
isEnabled,
isFocusControl,
isReparentable,
isVisible,
moveAbove,
moveBelow,
pack,
pack,
print,
redraw,
redraw,
removeControlListener,
removeDragDetectListener,
removeFocusListener,
removeHelpListener,
removeKeyListener,
removeMenuDetectListener,
removeMouseListener,
removeMouseMoveListener,
removeMouseTrackListener,
removeMouseWheelListener,
removePaintListener,
removeTraverseListener,
setBackground,
setBackgroundImage,
setBounds,
setBounds,
setCapture,
setCursor,
setDragDetect,
setFont,
setForeground,
setLayoutData,
setLocation,
setLocation,
setMenu,
setParent,
setRedraw,
setRegion,
setSize,
setSize,
setVisible,
toControl,
toControl,
toDisplay,
toDisplay,
traverse,
update
|
Methods inherited from class org.eclipse.swt.widgets.
Widget
|
addDisposeListener,
addListener,
checkWidget,
dispose,
getData,
getDisplay,
getListeners,
getStyle,
isDisposed,
isListening,
notifyListeners,
removeDisposeListener,
removeListener,
removeListener,
setData,
setData,
toString
|
CONNECTION_DELIMITER
public static final char CONNECTION_DELIMITER
-
See Also:
-
Constant Field Values
SystemQualifiedRemoteFolderCombo
public SystemQualifiedRemoteFolderCombo(
Composite parent,
int style,
String historyKey)
- Constructor.
Requires a history key used to store/restore the dropdown history for this. Pass null to use
the overall default (ISystemPreferencesConstants.HISTORY_FOLDER).
By default, this allows users to select with any connection that has subsystems that implement
RemoteFileSubSystem. To restrict it to connections of a particular system type, say, call
setSystemType.
-
Parameters:
-
parent - Parent composite -
style - SWT style flags for overall composite widget -
historyKey - A string identifying the key into the user preferences where this combo's history will be stored. -
See Also:
-
setSystemType(IRSESystemType)
setAutoUpperCase
public void setAutoUpperCase(boolean enable)
- Set auto-uppercase. When enabled, all non-quoted values are uppercases when appropriate.
This has no effect in readonly mode, which this combo is, so in fact this is ineffective!
We include it in case we allow editing in the future, and because it is in the ISystemCombo
interface we implement.
-
-
Specified by:
-
setAutoUpperCase
in interface
ISystemCombo
-
setSystemTypes
public void setSystemTypes(
IRSESystemType[] 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 types, or
null to allow all registered valid system types.
A system type is valid if at least one subsystem configuration
is registered against it.
setSystemType
public void setSystemType(
IRSESystemType systemType)
- Convenience method to restrict to a single system type.
Same as setSystemTypes(new IRSESystemType[] {systemType})
-
-
-
Parameters:
-
systemType - The system type to restrict to, or
null to allow all registered valid system types.
A system type is valid if at least one subsystem configuration
is registered against it.
setShowNewConnectionPrompt
public void setShowNewConnectionPrompt(boolean show)
- Specify if the "New Connection..." object for creating connections should be shown when the user selects
the Browse... button to select a remote folder. The default is true.
-
-
getFolderCombo
public
SystemHistoryCombo getFolderCombo()
- Return the combo box history widget
-
-
getHistoryCombo
public
SystemHistoryCombo getHistoryCombo()
- Return the combo box widget
-
-
getCombo
public
Combo getCombo()
- Return the raw combo box widget
-
-
Specified by:
-
getCombo
in interface
ISystemCombo
-
setWidthHint
public void setWidthHint(int widthHint)
- Set the width hint for this whole composite
Default is computed from the child widgets
-
-
Specified by:
-
setWidthHint
in interface
ISystemCombo
-
getBrowseButton
public
Button getBrowseButton()
- Return the browse button widget
-
-
setFolders
public void setFolders(
IRemoteFile[] folders)
- Set the folders in the combo field.
History is updated.
-
-
-
Parameters:
-
folders - Array of IRemoteFile objects ... each is a remote folder
addFolder
public int addFolder(
IRemoteFile folder)
- Append a folder to the list. It is not selected so call
setFolder(IRemoteFile)
or
setSelectionIndex(int) to select it if desired.
History is updated.
-
-
-
Parameters:
-
folder - The folder to add. Caller's responsibility to precheck for existence
by calling
getFolderIndex(IRemoteFile) .
-
Returns:
- int zero-based index position of new entry in list.
removeFolder
public void removeFolder(
IRemoteFile folder)
- Remove a folder from the list. History is updated
-
-
-
Parameters:
-
folder - The folder to remove.
getItems
public
String[] getItems()
- Get the items in the combo field as an array of strings.
-
-
-
Returns:
- Array of String objects
getFolderIndex
public int getFolderIndex(
IRemoteFile folder)
- Get the index of a given folder in the current list for this combo.
Returns -1 if it is not in the list.
-
-
setFolder
public void setFolder(
IRemoteFile folder)
- Set the folder combo field's current contents given an IRemoteFile object.
If this folder is in the list, it is selected.
If it is not in the list, it is added and selected.
-
-
setSelectionIndex
public void setSelectionIndex(int selIdx)
- Set the value by selecting the item in the list at the given position.
Same as
select(int)
-
-
Specified by:
-
setSelectionIndex
in interface
ISystemCombo
-
select
public void select(int selIdx)
- Select the combo dropdown list entry at the given index
Same as
setSelectionIndex(int)
-
-
Specified by:
-
select
in interface
ISystemCombo
-
clearSelection
public void clearSelection()
- Clear the selection of the text in the entry field part of the combo, and the list selection
-
-
Specified by:
-
clearSelection
in interface
ISystemCombo
-
clearTextSelection
public void clearTextSelection()
- Clear the selection of the text in the entry field part of the combo
-
-
Specified by:
-
clearTextSelection
in interface
ISystemCombo
-
getSelectionIndex
public int getSelectionIndex()
- Get the index number of the currently selected item.
-
-
Specified by:
-
getSelectionIndex
in interface
ISystemCombo
-
getText
public
String getText()
- Query the folder combo field's current contents
-
-
Specified by:
-
getText
in interface
ISystemCombo
-
getFolder
public
IRemoteFile getFolder()
throws
Exception
- Query the folder combo field's current contents as an IRemoteFile object.
It is at this time that the currently selected string is converted into an
IRemoteFile object. This can be a bit computationally intensive, as it requires
accessing the remote system, and prompting for a connection if the user is not
not yet connected to that system.
Since it is possible the selected item is no longer valid, this will throw an
exception if the profile or connection does not exist or the user cancels the
connecting action. The message in the exception is translated and displayable.
-
-
-
Throws:
-
Exception
getSystemConnection
public
IHost getSystemConnection()
- Query the folder combo field's current contents and return the connection part of
it as a SystemConnection object.
Will return null if either there is no contents currently or there is no such system!
-
-
setEnabled
public void setEnabled(boolean enabled)
- Disable/Enable all the child controls.
-
-
Specified by:
-
setEnabled
in interface
ISystemCombo
-
Overrides:
-
setEnabled
in class
Control
-
setToolTipText
public void setToolTipText(
String tip)
- Set the tooltip text for the folder combo field
-
-
Specified by:
-
setToolTipText
in interface
ISystemCombo
-
Overrides:
-
setToolTipText
in class
Control
-
setBrowseButtonToolTipText
public void setBrowseButtonToolTipText(
String tip)
- Set the tooltip text for the browse button
-
-
setButtonToolTipText
public void setButtonToolTipText(
String tip)
- Same as
setBrowseButtonToolTipText(String)
-
-
Specified by:
-
setButtonToolTipText
in interface
ISystemCombo
-
setTextLimit
public void setTextLimit(int limit)
- Set the folder combo field's text limit
-
-
setFocus
public boolean setFocus()
- Set the focus to the folder combo field
-
-
Specified by:
-
setFocus
in interface
ISystemCombo
-
Overrides:
-
setFocus
in class
Composite
-
setBrowseButtonFocus
public void setBrowseButtonFocus()
- Set the focus to the browse button
-
-
addSelectionListener
public void addSelectionListener(
SelectionListener listener)
- Register a listener interested in an item is selected in the combo box
-
-
Specified by:
-
addSelectionListener
in interface
ISystemCombo
-
-
See Also:
-
removeSelectionListener(SelectionListener)
removeSelectionListener
public void removeSelectionListener(
SelectionListener listener)
- Remove a previously set combo box selection listener.
-
-
Specified by:
-
removeSelectionListener
in interface
ISystemCombo
-
-
See Also:
-
addSelectionListener(SelectionListener)
addBrowseButtonSelectionListener
public void addBrowseButtonSelectionListener(
SelectionListener listener)
- Register a listener interested in when the browse button is selected
-
-
-
See Also:
-
removeBrowseButtonSelectionListener(SelectionListener)
removeBrowseButtonSelectionListener
public void removeBrowseButtonSelectionListener(
SelectionListener listener)
- Remove a previously set browse button selection listener.
-
-
-
See Also:
-
addBrowseButtonSelectionListener(SelectionListener)
addModifyListener
public void addModifyListener(
ModifyListener listener)
- Register a listener interested in entry field modify events
-
-
-
See Also:
-
removeModifyListener(ModifyListener)
removeModifyListener
public void removeModifyListener(
ModifyListener listener)
- Remove a previously set entry field listener.
-
-
-
See Also:
-
addModifyListener(ModifyListener)
getHistory
public static
String[] getHistory()
- Return the current history for the folder combo box
-
-
updateHistory
public void updateHistory()
- Update the history with current entry field setting.
This is called automatically for you whenever this list is changed.
-
-
convertToRemoteFile
public
IRemoteFile convertToRemoteFile(
String qualifiedFolder)
throws
Exception
- Given a qualified folder name, return an IRemoteFile object representing it.
Will return null if there is no connection of the given name, or that connection
does not have a subsystem that implements RemoteFileSubSystem.
Note that if the connection contains multiple subsystems that implement RemoteFileSubSystem,
or that come from a subsystem factory of the given subsystem factory ID,
the first such subsystem is chosen.
-
-
-
Throws:
-
Exception
extractQualifiedConnectionName
public static
String extractQualifiedConnectionName(
String qualifiedFolder)
- Get the profile.connection name part of a qualified folder string.
-
-
extractProfileName
public static
String extractProfileName(
String qualifiedConnectionName)
- Get the profile name part of a profile.connection string
-
-
extractConnectionName
public static
String extractConnectionName(
String qualifiedConnectionName)
- Get the connection name part of a profile.connection string.
Will work if given profile.connection or profile.connection\folder
-
-
extractFolder
public static
String extractFolder(
String qualifiedFolder)
- Get the folder name part of a qualified folder string.
-
-
prepareComposite
protected
Composite prepareComposite(int numColumns)
- Prepares this composite control and sets the default layout data.
-
-
-
Parameters:
-
numColumns - Number of columns the new group will contain.
addOurButtonSelectionListener
protected void addOurButtonSelectionListener()
-
-
getBrowseAction
protected
SystemSelectRemoteFolderAction getBrowseAction(
Shell shell,
IHost defaultConnection)
- Returns action to be called when Browse... pressed.
-
-
createPushButton
public static
Button createPushButton(
Composite group,
String label)
-
-
createPushButton
protected static
Button createPushButton(
Composite group,
ResourceBundle bundle,
String key)
-
-
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.
|
|
|