There are two ways the Remote System Explorer API set can help you when it comes to dialogs:
Dialogs are secondary windows that prompt the user for information or display information to the user. They are typically modal, meaning the rest of the application (in this case eclipse) is disabled while the dialog is showing. Eclipse supplies a raw dialog class in SWT, as well as more robust dialog class in JFace. The RSE supplies its own class, SystemPromptDialog in package org.eclipse.rse.ui.dialogs , that extends the JFace dialog class and adds to it the following capabilities inherited by all classes which extend it:
To create your own dialog:
One of the more difficult efforts in building a dialog with multiple entry fields, is the code to do the validation of those entry fields. A common strategy is to add modify listeners to the entry fields, and for each one validate the data as it typed. If the validation fails, a message is issued. If the validation succeeds, then the other fields on the dialog are validated. At the end of the validation, the OK button is enabled or disabled depending on the error message status, and whether the required information has been supplied. The RSE can help with this effort, somewhat, through the use of re-usable validators for various types of input.
Follow this link for an example of a fully-formed dialog class written on top of this RSE base class, complete with
error checking.
Typically, after creating your dialog, you will create an action to invoke it. The RSE can help with this too, via the supplied SystemBaseDialogAction base class.
You may find some of the dialogs supplied by the RSE to be immediately re-usable in your own code, saving some development and test effort. All these dialogs are in package org.eclipse.rse.ui.dialogs:
Class | Description | Sample | Action |
---|---|---|---|
SystemRenameDialog | Rename multiple items. Provides a table listing the old names and new names, which are editable. If your input objects do not adapt to ISystemViewElementAdapter or ISystemRemoteElementAdapter, you should call setNameValidator to specify a validator that ensures the new name is correct, and your input objects should also either be IResource objects or implement ISystemTypedObject. | Sample image | SystemCommonRenameAction |
SystemRenameSingleDialog | Rename a single item. Provides a simple entry field for the new name. If your input object does not adapt to ISystemViewElementAdapter or ISystemRemoteElementAdapter, you should call setNameValidator to specify a validator that ensures the new name is correct, and your input object should also either be an IResource object or implement ISystemTypedObject. | Sample image | SystemCommonRenameAction |
SystemDeleteDialog | Confirm delete of one or more items. Provides a table listing the names of input objects. If your input objects do not adapt to ISystemViewElementAdapter or ISystemRemoteElementAdapter, your input objects should either be IResource objects or implement ISystemTypedObject. | Sample image | SystemCommonDeleteAction |
SystemSelectFileTypesDialog | Presents a dialog listing all the file types defined in the eclipse File Associations preferences page, and allows the user to select one or more of these types, or enter additional types not defined in eclipse. | Sample image | |
SystemSimpleSelectDialog | Eclipse has a CheckboxTreeViewer that is designed to allow the user to select multiple items from a hierarchical model. This is a nice viewer, but very difficult to program to, as you have to handle reflecting the state of the selected children for each parent node yourself. This dialog makes that trivial. The trick is to create wrappers of your model objects using SystemSimpleContentElement, maintaining the parent/child hierarchy, and pass the root element to the dialog. The rest is done for you, and the result is the selected state set for those elements selected by the user. Note this can also be used as a simple flat list checkbox selection dialog, just by passing a non-visible root with a flat list of children. | Sample image | None |
While the dialogs can be instantiated directly, it is perhaps best to use them by instantiating their action class, and calling the run method on it.
The action classes are all in org.eclipse.rse.ui.actions package.
In addition to these universal dialogs, there are dialogs specific to the predefined Files subsystem. These enable selection of remote files or folders. They can be found in the org.eclipse.rse.files.ui.dialogs package.
Class | Description | Sample | Action |
---|---|---|---|
SystemSelectRemoteFileOrFolderDialog | Allows users to select a remote file, or folder (configurable) using a dialog similar to what is used in Eclipse for local file or folder selection. Can be configured to allow user to select from any existing connection, or to be scoped to a particular connection, or even a particular folder in a particular connection. | Sample image | SystemSelectRemoteFileAction or SystemSelectRemoteFolderAction |