Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ice-dev] Remote File Browsing with PTP

Everyone,

It turns out that remote file browsers are super easy through Eclipse PTP. The following 5 line code snippet will display the remote browser and return the absolute path of the selected file.

IRemoteServices services = RemoteServices.getRemoteServices("org.eclipse.remote.JSch");
IRemoteUIServices uiServices = RemoteUIServices.getRemoteUIServices(services);
IRemoteUIFileManager manager = uiServices.getUIFileManager();
manager.showConnections(true);
String file = manager.browseFile(shell, "Select the remote files you would like to view in VisIt", ".", SWT.MULTI);

The API wraps a set of services that you can query through the RemoteServices class. The default (basic) remote interface realization is based on JSch. From those services you can create an IRemoteUIServices object which gives you an IRemoteUIFileManager, which provides browse file(s) and directory methods.

The remote UI services also provide a remote connection manager object that gives detailed information about the connection such as host, port, username, and password, as well as a ‘Create New Connection Wizard’.

IRemoteUIConnectionManager connMan = uiServices.getUIConnectionManager();
IRemoteUIConnectionWizard wizard = connMan.getConnectionWizard(shell);
IRemoteConnectionWorkingCopy workingCopy = wizard.open();
IRemoteConnection connection = workingCopy.save();

Plus, these IRemoteConnections are cached for future use, and can be viewed in Window > Preferences > Remote Development > Connections.

This stuff will be big for use going forward, specifically in our org.eclipse.ice.viz plugin and in the job launch action. So I just wanted to get these code snippets archived.

Best,

Alex


Back to the top