Add connections from code [message #1746015] |
Thu, 20 October 2016 13:28 |
Andrei Anghel Messages: 3 Registered: October 2016 |
Junior Member |
|
|
Hi guys,
I have this eclipse RCP project on which i'm working and it has a view with several remote targets (the view content is constructed from a table that has the hostname, username and password).
Currently i have contextual menu on each target with some actions (run script, open a terminal) and i would like to add a action like "explore file system - ftp" - show the files on that target, exactly like i would make a new connection in RSE (remote system explorer) view, but provide the credentials in the background, so as the result would be a new entry in the RSE view.
So, i want to create connections (+authenticate them).
I want to use as little custom code and as much as possible from the framework, in order to keep easy compatibility with future releases.
Tried so far:
-dissect the source code of the TM/RSE project; found no extension point that would managed what i need (this was a long shot anyway); found no way to simulate the calling of the wizards involved in creating anew connection;
-tried to add the credentials (by code) in the (PreferencesStore) preference->rse->passwords, but this does not create an entry in the rse view;
I'm asking for some guide points, this seems like a problem others might encountered. At least some direction in which to look at.
Using Eclipse Mars 4.5.2.
Thanks,
Andrei.
|
|
|
Re: Add connections from code [message #1746028 is a reply to message #1746015] |
Thu, 20 October 2016 16:10 |
Martin Oberhuber Messages: 1007 Registered: July 2009 |
Senior Member |
|
|
Hello Andrei,
I first thought I'd find an example code somewhere from an old presentation, but now I think I actually have something better:
the Eclipse PTP project has implemented an org.eclipse.remote adapter that satisfies the o.e.remote APIs by using an RSE-based implementation. I think this is the closest you can get to what you want -- working production code to programmatically create and use RSE connections. See org.eclipse.ptp.remote.rse.* here for the PTP code:
http://git.eclipse.org/c/ptp/org.eclipse.ptp.git/tree/core?h=ptp_8_1
This goes with the org.eclipse.remote infrastructure from here:
http://git.eclipse.org/c/ptp/org.eclipse.remote.git/tree/bundles?h=R_2_1_maintenance
Note that you'll need old version branches from last year, since IIRC the PTP project has abandoned RSE (in favor of a plain JSch implementation only). The ptp_8_1 and remote_2_1 branches should be what you need, though I'm not 100% sure. I think you can try out what it "feels like", if you download the Eclipse Parallel package from Mars, though the Linuxtools and C/C++ packages might also have the functionality:
https://www.eclipse.org/downloads/packages/release/Mars/2
Choose Window > Preferences > Remote, from this Preference Page you can create RSE connections (but using the RSE API programmatically). If you have further questios on this approach, I recommend writing to the PTP mailing list or forum.
PS: RSE itself is quite unlikely to see any further releases. It's in maintenance mode now, more energy is being put on the org.eclipse.remote APIs -- but these only have an SSH and TCF protocol implementation right now, not yet FTP. So keeping to use FTP via RSE, but through the o.e.remote API, seems like a reasonable approach for you.
HTH,
Martin
|
|
|
Powered by
FUDForum. Page generated in 0.03177 seconds