As hinted about in this blog post, I'm working on a cluster batch job configuration wizard for Bioclipse, making heavy use of the TM / RSE components for Eclipse.
In the wizard, I of course wanted to be able to fire up a file selection dialog for filling in fields for file paths on the cluster. Only problem was that the RSE API is (as usual to Java projects) not of the simplest kind, and for a newcomer like me I found it a bit challenging to find where to start.
As pointed out in this short blog post, I finally found the (simple) solution, and here we go (the final code needed some additions though, but in principle it was simple):
Some more info and can be found at the project's wiki page.
IHost uppmaxHost = (new UppmaxManager()).getUppmaxHost(); ISystemRegistry sysReg = RSECorePlugin.getTheSystemRegistry(); ISubSystem[] subSystems = sysReg.getSubsystems(uppmaxHost, IFileServiceSubSystem.class); if (subSystems.length == 0 || !(subSystems[0] instanceof FileServiceSubSystem)) { System.out.println("Warning ..."); return; } FileServiceSubSystem fsss = (FileServiceSubSystem) subSystems[0]; try { IRemoteFile[] rootRemoteFolders = fsss.listRoots(null); for (IRemoteFile folder : rootRemoteFolders) { System.out.println("Remote root folder: " + folder.
This was easier than expected. Helped by the RSE File UI API Docs and this forum post, I figured out how to do:
SystemRemoteFileDialog dialog = new SystemRemoteFileDialog(SystemBasePlugin.getActiveWorkbenchShell()); dialog.open(); IRemoteFile file = (IRemoteFile) dialog.getSelectedObject(); System.out.println("Selected file's absolute path: " + file.getAbsolutePath());
Now also committed!
Update: Using proper interface for dealing with remote files (commit).
As indicated by this page:
RSECorePlugin.getTheSystemRegistry()