Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Target Management » Open a remote shell programmatically
Open a remote shell programmatically [message #17746] Mon, 14 January 2008 12:42 Go to next message
Harald Krapfenbauer is currently offline Harald Krapfenbauer
Messages: 16
Registered: July 2009
Junior Member
Hello,

I have the following question:

I want to execute a command remotely in the default shell of a
connection programmatically, hence I wrote:

IRemoteCmdSubSystem cmdSS =
RemoteCommandHelpers.getCmdSubSystem(connection);
IRemoteCommandShell shell = cmdSS.getDefaultShell();
cmdSS.sendCommandToShell("ls", shell, null);

If the default shell was not open, it is opened, but only shown in the
"Remote Systems" view. I now want to do programmatically exactly what
happens when I choose "Show in Remote Shell View" from the default
shell's context menu, i.e. the "Remote Shell" view shall pop up, and the
default shell shall be visible (i.e. newly opened, or brought to
foreground).

How can I accomplish this?

Thank you + best regards,
Harald Krapfenbauer
Re: Open a remote shell programmatically [message #17751 is a reply to message #17746] Tue, 15 January 2008 10:13 Go to previous messageGo to next message
Harald Krapfenbauer is currently offline Harald Krapfenbauer
Messages: 16
Registered: July 2009
Junior Member
Okay, the best I achieved up to now is the following code:

SystemCommandsViewPart cmdsPart =
SystemCommandsUI.getInstance().activateCommandsView();
if (cmdsPart != null) {
cmdsPart.updateOutput(finalShell); cmdsPart.showPageFor(finalShell);
}

(where finalShell is an IRemoteCommandShell)

This uses RSE-internal classes, and this is not a good way of course.
Bringing the "Remote shells" view to foreground is possible without
activateCommandsView(), but for showing the IRemoteShell in this view I
found nothing in the public API.

Any better solutions welcome!
Harald


Harald Krapfenbauer wrote:
> Hello,
>
> I have the following question:
>
> I want to execute a command remotely in the default shell of a
> connection programmatically, hence I wrote:
>
> IRemoteCmdSubSystem cmdSS =
> RemoteCommandHelpers.getCmdSubSystem(connection);
> IRemoteCommandShell shell = cmdSS.getDefaultShell();
> cmdSS.sendCommandToShell("ls", shell, null);
>
> If the default shell was not open, it is opened, but only shown in the
> "Remote Systems" view. I now want to do programmatically exactly what
> happens when I choose "Show in Remote Shell View" from the default
> shell's context menu, i.e. the "Remote Shell" view shall pop up, and the
> default shell shall be visible (i.e. newly opened, or brought to
> foreground).
>
> How can I accomplish this?
>
> Thank you + best regards,
> Harald Krapfenbauer
Re: Open a remote shell programmatically [message #18441 is a reply to message #17751] Fri, 18 January 2008 18:21 Go to previous message
David McKnight is currently offline David McKnight
Messages: 244
Registered: July 2009
Senior Member
Hi Harld,

Could you open a defect for this? Right now I don't know of a way for you
to avoid using the internal classes since SystemCommandsViewPart is
internal. Perhaps we can make SystemCommandsUI public and provide an
updateOutput() method in there.

Dave

"Harald Krapfenbauer" <krapfenbauer@ict.tuwien.ac.at> wrote in message
news:fmi0vj$in$1@build.eclipse.org...
> Okay, the best I achieved up to now is the following code:
>
> SystemCommandsViewPart cmdsPart =
> SystemCommandsUI.getInstance().activateCommandsView();
> if (cmdsPart != null) {
> cmdsPart.updateOutput(finalShell); cmdsPart.showPageFor(finalShell);
> }
>
> (where finalShell is an IRemoteCommandShell)
>
> This uses RSE-internal classes, and this is not a good way of course.
> Bringing the "Remote shells" view to foreground is possible without
> activateCommandsView(), but for showing the IRemoteShell in this view I
> found nothing in the public API.
>
> Any better solutions welcome!
> Harald
>
>
> Harald Krapfenbauer wrote:
>> Hello,
>>
>> I have the following question:
>>
>> I want to execute a command remotely in the default shell of a connection
>> programmatically, hence I wrote:
>>
>> IRemoteCmdSubSystem cmdSS =
>> RemoteCommandHelpers.getCmdSubSystem(connection);
>> IRemoteCommandShell shell = cmdSS.getDefaultShell();
>> cmdSS.sendCommandToShell("ls", shell, null);
>>
>> If the default shell was not open, it is opened, but only shown in the
>> "Remote Systems" view. I now want to do programmatically exactly what
>> happens when I choose "Show in Remote Shell View" from the default
>> shell's context menu, i.e. the "Remote Shell" view shall pop up, and the
>> default shell shall be visible (i.e. newly opened, or brought to
>> foreground).
>>
>> How can I accomplish this?
>>
>> Thank you + best regards,
>> Harald Krapfenbauer
Re: Open a remote shell programmatically [message #572017 is a reply to message #17746] Tue, 15 January 2008 10:13 Go to previous message
Harald Krapfenbauer is currently offline Harald Krapfenbauer
Messages: 16
Registered: July 2009
Junior Member
Okay, the best I achieved up to now is the following code:

SystemCommandsViewPart cmdsPart =
SystemCommandsUI.getInstance().activateCommandsView();
if (cmdsPart != null) {
cmdsPart.updateOutput(finalShell); cmdsPart.showPageFor(finalShell);
}

(where finalShell is an IRemoteCommandShell)

This uses RSE-internal classes, and this is not a good way of course.
Bringing the "Remote shells" view to foreground is possible without
activateCommandsView(), but for showing the IRemoteShell in this view I
found nothing in the public API.

Any better solutions welcome!
Harald


Harald Krapfenbauer wrote:
> Hello,
>
> I have the following question:
>
> I want to execute a command remotely in the default shell of a
> connection programmatically, hence I wrote:
>
> IRemoteCmdSubSystem cmdSS =
> RemoteCommandHelpers.getCmdSubSystem(connection);
> IRemoteCommandShell shell = cmdSS.getDefaultShell();
> cmdSS.sendCommandToShell("ls", shell, null);
>
> If the default shell was not open, it is opened, but only shown in the
> "Remote Systems" view. I now want to do programmatically exactly what
> happens when I choose "Show in Remote Shell View" from the default
> shell's context menu, i.e. the "Remote Shell" view shall pop up, and the
> default shell shall be visible (i.e. newly opened, or brought to
> foreground).
>
> How can I accomplish this?
>
> Thank you + best regards,
> Harald Krapfenbauer
Re: Open a remote shell programmatically [message #572040 is a reply to message #17751] Fri, 18 January 2008 18:21 Go to previous message
David McKnight is currently offline David McKnight
Messages: 244
Registered: July 2009
Senior Member
Hi Harld,

Could you open a defect for this? Right now I don't know of a way for you
to avoid using the internal classes since SystemCommandsViewPart is
internal. Perhaps we can make SystemCommandsUI public and provide an
updateOutput() method in there.

Dave

"Harald Krapfenbauer" <krapfenbauer@ict.tuwien.ac.at> wrote in message
news:fmi0vj$in$1@build.eclipse.org...
> Okay, the best I achieved up to now is the following code:
>
> SystemCommandsViewPart cmdsPart =
> SystemCommandsUI.getInstance().activateCommandsView();
> if (cmdsPart != null) {
> cmdsPart.updateOutput(finalShell); cmdsPart.showPageFor(finalShell);
> }
>
> (where finalShell is an IRemoteCommandShell)
>
> This uses RSE-internal classes, and this is not a good way of course.
> Bringing the "Remote shells" view to foreground is possible without
> activateCommandsView(), but for showing the IRemoteShell in this view I
> found nothing in the public API.
>
> Any better solutions welcome!
> Harald
>
>
> Harald Krapfenbauer wrote:
>> Hello,
>>
>> I have the following question:
>>
>> I want to execute a command remotely in the default shell of a connection
>> programmatically, hence I wrote:
>>
>> IRemoteCmdSubSystem cmdSS =
>> RemoteCommandHelpers.getCmdSubSystem(connection);
>> IRemoteCommandShell shell = cmdSS.getDefaultShell();
>> cmdSS.sendCommandToShell("ls", shell, null);
>>
>> If the default shell was not open, it is opened, but only shown in the
>> "Remote Systems" view. I now want to do programmatically exactly what
>> happens when I choose "Show in Remote Shell View" from the default
>> shell's context menu, i.e. the "Remote Shell" view shall pop up, and the
>> default shell shall be visible (i.e. newly opened, or brought to
>> foreground).
>>
>> How can I accomplish this?
>>
>> Thank you + best regards,
>> Harald Krapfenbauer
Previous Topic:Open a remote shell programmatically
Next Topic:ssh-only configuration with Plink
Goto Forum:
  


Current Time: Sun Sep 21 02:09:59 GMT 2014

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

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