Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Target Management » Custom RSE view - observations & help needed
Custom RSE view - observations & help needed [message #14195] Wed, 22 August 2007 16:15 Go to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 346
Registered: July 2009
Senior Member
I'm trying to create a custom remote file explorer on top of RSE. I've
managed to create an sftp connection to a remote host, but now I'm lost
in the UI code. I'm having problems figuring out how to display a list
of remote files for a specified directory from the subsystem. I'm
pretty sure I need to create a filter for each directory I want the
user to navigate, but I'm a bit confused on the API in this area.
Here's what I've done so far:


RSEUIPlugin.getDefault().isSystemRegistryActive();
ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
IRSECoreRegistry coreRegistry = RSECorePlugin.getTheCoreRegistry();
IRSESystemType systemType =
coreRegistry.getSystemTypeById(IRSESystemType.SYSTEMTYPE_SSH _ONLY_ID);

try
{
ISystemProfile profile =
systemRegistry.createSystemProfile("fexplorer", true);
IHost host = profile.createHost(systemType, "explorer", hostName,
"Directory explorer");
ISubSystem[] subsystems = hosts.getSubSystems();

System.out.println("Sybsystems:");

for(ISubSystem subsystem : subsystems)
{
System.out.println("Connecting to: " + subsystem.getName());
subsystem.connect(new NullProgressMonitor(), false);
System.out.println("Has children: " + subsystem.hasChildren());
}
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}

A couple of observations here:

I wasn't expecting to have to load the RSEUIPlugin since I'm not using
any of the RSE UI code, but if you don't load that plugin,
RSECorePlugin.getTheSystemRegistry() returns null.

I wasn't expecting to have to create a profile since the docs seemed to
indicate that a default private profile will be created. If I didn't
create a profile, my code ran fine as long as I was running under the
debugger, but as soon as I ran without the debugger, I got an
ArrayIndexOutOfBoundsException inside RSE.

I'm going to keep looking at the code, but if anyone can offer some
help in getting from a sftp subsystem to my own TreeViewer, it would
certainly save me some time.

Bryan
Re: Custom RSE view - observations & help needed [message #15248 is a reply to message #14195] Thu, 27 September 2007 08:37 Go to previous message
Martin Oberhuber is currently offline Martin OberhuberFriend
Messages: 985
Registered: July 2009
Senior Member
Hello Bryan,

I just stumbled over your posting, not sure how this could remain
unanswered for so long.

Having to load RSEUIPlugin even if you don't want Rse UI is a known
issue and will be addressed in the 3.0 cycle - it's a plan item to
imrove UI/Non-UI splitting.

Not getting the default profile auto-created might be because you
didn't wait long enough for the initialization. That's another
known bug, https://bugs.eclipse.org/bugs/show_bug.cgi?id=197167
That bug has a workaround code you can use for now.

That would also explain why it works in the debugger (you simply
waited long enough).

Why do you want your own TreeViewer after all? You can embed the
SystemView in your apps / dialogs, it's done for things like the
SystemSelectFolderDialog. If you think we should improve the
SystemView so that it's useable for you, please file an enhancement
request so we can track your ideas.

Thanks!
Martin

Bryan Hunt schrieb:
> I'm trying to create a custom remote file explorer on top of RSE. I've
> managed to create an sftp connection to a remote host, but now I'm lost
> in the UI code. I'm having problems figuring out how to display a list
> of remote files for a specified directory from the subsystem. I'm
> pretty sure I need to create a filter for each directory I want the user
> to navigate, but I'm a bit confused on the API in this area. Here's
> what I've done so far:
>
>
> RSEUIPlugin.getDefault().isSystemRegistryActive();
> ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
> IRSECoreRegistry coreRegistry = RSECorePlugin.getTheCoreRegistry();
> IRSESystemType systemType =
> coreRegistry.getSystemTypeById(IRSESystemType.SYSTEMTYPE_SSH _ONLY_ID);
>
> try
> {
> ISystemProfile profile =
> systemRegistry.createSystemProfile("fexplorer", true);
> IHost host = profile.createHost(systemType, "explorer", hostName,
> "Directory explorer");
> ISubSystem[] subsystems = hosts.getSubSystems();
>
> System.out.println("Sybsystems:");
>
> for(ISubSystem subsystem : subsystems)
> {
> System.out.println("Connecting to: " + subsystem.getName());
> subsystem.connect(new NullProgressMonitor(), false);
> System.out.println("Has children: " + subsystem.hasChildren());
> }
> }
> catch (Exception e)
> {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> A couple of observations here:
>
> I wasn't expecting to have to load the RSEUIPlugin since I'm not using
> any of the RSE UI code, but if you don't load that plugin,
> RSECorePlugin.getTheSystemRegistry() returns null.
>
> I wasn't expecting to have to create a profile since the docs seemed to
> indicate that a default private profile will be created. If I didn't
> create a profile, my code ran fine as long as I was running under the
> debugger, but as soon as I ran without the debugger, I got an
> ArrayIndexOutOfBoundsException inside RSE.
>
> I'm going to keep looking at the code, but if anyone can offer some help
> in getting from a sftp subsystem to my own TreeViewer, it would
> certainly save me some time.
>
> Bryan
>


--
Martin Oberhuber
Wind River Systems, Inc.
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm
Re: Custom RSE view - observations & help needed [message #570250 is a reply to message #14195] Thu, 27 September 2007 08:37 Go to previous message
Martin Oberhuber is currently offline Martin OberhuberFriend
Messages: 985
Registered: July 2009
Senior Member
Hello Bryan,

I just stumbled over your posting, not sure how this could remain
unanswered for so long.

Having to load RSEUIPlugin even if you don't want Rse UI is a known
issue and will be addressed in the 3.0 cycle - it's a plan item to
imrove UI/Non-UI splitting.

Not getting the default profile auto-created might be because you
didn't wait long enough for the initialization. That's another
known bug, https://bugs.eclipse.org/bugs/show_bug.cgi?id=197167
That bug has a workaround code you can use for now.

That would also explain why it works in the debugger (you simply
waited long enough).

Why do you want your own TreeViewer after all? You can embed the
SystemView in your apps / dialogs, it's done for things like the
SystemSelectFolderDialog. If you think we should improve the
SystemView so that it's useable for you, please file an enhancement
request so we can track your ideas.

Thanks!
Martin

Bryan Hunt schrieb:
> I'm trying to create a custom remote file explorer on top of RSE. I've
> managed to create an sftp connection to a remote host, but now I'm lost
> in the UI code. I'm having problems figuring out how to display a list
> of remote files for a specified directory from the subsystem. I'm
> pretty sure I need to create a filter for each directory I want the user
> to navigate, but I'm a bit confused on the API in this area. Here's
> what I've done so far:
>
>
> RSEUIPlugin.getDefault().isSystemRegistryActive();
> ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
> IRSECoreRegistry coreRegistry = RSECorePlugin.getTheCoreRegistry();
> IRSESystemType systemType =
> coreRegistry.getSystemTypeById(IRSESystemType.SYSTEMTYPE_SSH _ONLY_ID);
>
> try
> {
> ISystemProfile profile =
> systemRegistry.createSystemProfile("fexplorer", true);
> IHost host = profile.createHost(systemType, "explorer", hostName,
> "Directory explorer");
> ISubSystem[] subsystems = hosts.getSubSystems();
>
> System.out.println("Sybsystems:");
>
> for(ISubSystem subsystem : subsystems)
> {
> System.out.println("Connecting to: " + subsystem.getName());
> subsystem.connect(new NullProgressMonitor(), false);
> System.out.println("Has children: " + subsystem.hasChildren());
> }
> }
> catch (Exception e)
> {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> A couple of observations here:
>
> I wasn't expecting to have to load the RSEUIPlugin since I'm not using
> any of the RSE UI code, but if you don't load that plugin,
> RSECorePlugin.getTheSystemRegistry() returns null.
>
> I wasn't expecting to have to create a profile since the docs seemed to
> indicate that a default private profile will be created. If I didn't
> create a profile, my code ran fine as long as I was running under the
> debugger, but as soon as I ran without the debugger, I got an
> ArrayIndexOutOfBoundsException inside RSE.
>
> I'm going to keep looking at the code, but if anyone can offer some help
> in getting from a sftp subsystem to my own TreeViewer, it would
> certainly save me some time.
>
> Bryan
>


--
Martin Oberhuber
Wind River Systems, Inc.
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm
Previous Topic:RSE Process View on Solaris
Next Topic:creating a custom Connection
Goto Forum:
  


Current Time: Sun Dec 21 02:09:45 GMT 2014

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

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