Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Target Management » How to show only remote files in RSE's remote file selection dialog?
How to show only remote files in RSE's remote file selection dialog? [message #684007] Tue, 14 June 2011 20:54 Go to next message
Samuel Lampa is currently offline Samuel LampaFriend
Messages: 9
Registered: June 2011
Junior Member
I'm using the following code to fire up a Remote File Selection Dizard in RSE, and receive the full path of the selected file:

SystemRemoteFileDialog dialog = new SystemRemoteFileDialog(SystemBasePlugin.getActiveWorkbenchShell());
dialog.open();
Object o = dialog.getSelectedObject();
if (o instanceof IRemoteFile) {
    IRemoteFile file = (IRemoteFile)  
    System.out.println("Selected file's abs path: " + file.getAbsolutePath());
} else {
    System.out.println("No valid file selected!");
}


But, the file selection dialog shows both the local files and the remote ones, as well as a drop-down menu at the top, to select connection; local, or one of the remote hosts. (See image at i.stack.imgur.com/jHQkC.png ).

How can I programmatically hide this drop-down menu, and show only the files for a specific remote connection?

Also, I'd like to have the file tree show only files under a specific directory (e.g. the user's home dir). How can I do that? In the main RSE view, it is possible to do this manually by right-clicking a folder, and selecting "Go Into", but I want to do it programmatically.

Best Regards
// Samuel

[Updated on: Tue, 14 June 2011 21:24]

Report message to a moderator

(no subject) [message #684050 is a reply to message #684007] Tue, 14 June 2011 22:47 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
I sent this on the mailing list too:

You can restrict the connection types available by calling the
setSystemTypes(IRSESystemType[]) API.

If you want to use a specific connection, then you can call this:
setDefaultSystemConnection(<host>, true)

As for showing only files under a specific directory, you'll probably have
to provide your own class that extends SystemRemoteResourceDialog and with
that provide your own input provider (i.e.
ISystemResourceSelectionInputProvider) returns the appropriate system view
roots.

Dave

"Samuel Lampa" <forums-noreply@eclipse.org> wrote in message
news:it8h87$hrt$1@news.eclipse.org...
> I'm using the following code to fire up a RemoteFileSelectionWizard in
> RSE, and receive the full path of the selected file:
>
>
> SystemRemoteFileDialog dialog = new
> SystemRemoteFileDialog(SystemBasePlugin.getActiveWorkbenchShell());
> dialog.open();
> Object o = dialog.getSelectedObject();
> if (o instanceof IRemoteFile) {
> IRemoteFile file = (IRemoteFile) System.out.println("Selected file's
> abs path: " + file.getAbsolutePath());
> } else {
> System.out.println("No valid file selected!");
> }
>
>
> But, the file selection dialog shows both the local files and the remote
> ones (There's a drop-down menu at the top, to select connection; local, or
> one of the remote hosts.).
> How can I programmatically hide this drop-down menu, and show only the
> files for a specific remote connection?
> Also, I'd like to have the file tree show only files under a specific
> directory (e.g. the user's home dir). How can I do that? In the main RSE
> view, it is possible to do this manually by right-clicking a folder, and
> selecting "Go Into", but I want to do it programmatically.
>
> Best Regards
> // Samuel
Re: (no subject) [message #684210 is a reply to message #684050] Wed, 15 June 2011 08:28 Go to previous message
Samuel Lampa is currently offline Samuel LampaFriend
Messages: 9
Registered: June 2011
Junior Member
David McKnight wrote on Tue, 14 June 2011 18:47

If you want to use a specific connection, then you can call this:
setDefaultSystemConnection(<host>, true)


Indeed, thanks a lot!
(Strange how I missed that, while scanning the methods ...).

Just for the reference, the complete "snippet" of how I do (except for some additional exception handling):

IHost myHost = null;
ISystemRegistry reg = SystemStartHere.getSystemRegistry();
IHost[] hosts = reg.getHosts();
for (IHost host : hosts) {
    if (host.getAliasName().equals("[host-name-of-my-connection]")) {
        myHost = host;
        break;
    }
}

SystemRemoteFileDialog dialog = new SystemRemoteFileDialog(SystemBasePlugin.getActiveWorkbenchShell());
dialog.setDefaultSystemConnection(myHost, true);

dialog.open();
Object o = dialog.getSelectedObject();
if (o instanceof IRemoteFile) {
    IRemoteFile file = (IRemoteFile) o; 
    System.out.println("Selected file's abs path: " + file.getAbsolutePath());
} else {
    System.out.println("No valid file selected!");
}


Best
// Samuel
Previous Topic:RSE (and also Aptana) uploads are forced to sub-folder
Next Topic:RSE vs local project with linked remote files
Goto Forum:
  


Current Time: Mon Dec 22 01:29:14 GMT 2014

Powered by FUDForum. Page generated in 0.03980 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software