Hello Francesco,
for your "ls" problem: in a normal terminal, you should not wait
for the user to press ENTER but send
any characters you receive to the remote side immediately. Remote
side will be responsible for
sending terminal control sequences back that move the cursor /
delete characters etc.
That's where I think you'll need to modify the existing
SshHostSHell implementation: Because it currently
waits for a CR to be sent from the remote. You must not wait for
CR on a real terminal, but get the Stream from remote and hook it up with
your terminal Stream instead.
Regarding Q2: Yes, the type of connection (SSH or Telnet or
DStore) is not under your control. RSE will choose it.
Regarding Q3: What kind of settings would you want to change? I'd
recommend first finishing the
basic terminal integration,then thinking about settings that one
might want to change
Cheers, -- Martin Oberhuber Wind River Systems, Inc. Target
Management Project Lead, DSDP PMC Member http://www.eclipse.org/dsdp/tm
Hi Martin,
thanks for your previous answers to email about
my problems. Well, I have created a pipes system that connected the
Terminal output and input stream with the RSE IHostShell. Now if I type
anything in a TerminalView the relative outputstream is received from my
"pipes manage" and the relative string is put as parameter to my method
runCommand() that execute a comand in the remote shell. Its result is gived to
"pipes manage" (directly connected with Terminal inputstream) and the terminal
show it. All work correctly!
The problem is:
if I type in
the terminal for example the command string "ls" and I press up
arrrow button , down arrow button, delete button and so on and finally enter,
the relative string command is interpretated like "ls+x+y+..." instead "ls"
(x+y+... is the combination of the special buttons). How do I do to resolve
it? Should I filter any special button in the final command string
?
The managing of the "SSH-Shells and
Telnet-Shells" is automatically done by RSE, I mean that when user create a
new connection the final IRemoteCmdSubSystem I use, will be
transparent from the setting that user have chose, therefore I shouldn't
manage no setting about SSH and Telnet or other,
isnt' true?
Other question is, should I insert
into terminal any icon like settings or other?
Thanks and
greetings,
Crivelli Francesco
Subject: RE: Target Management Project - Undergraduate Level thesis to
Politecnico di Milano Date: Thu, 22 Nov 2007 17:07:21 +0100 From:
Martin.Oberhuber@xxxxxxxxxxxxx To: francescocriv@xxxxxxxxxxx CC:
dsdp-tm-dev@xxxxxxxxxxx
Hello Francesco,
it's not the terminal that shows the
prompt.
It's the remote computer that the terminal is hooked up
to.
The terminal expects the remote computer's output through its
InputStream,
and displays it (for instance, displaying a
prompt).
In your case, the remote computer is connected through RSE
IHostShell.
And sends its output through
IHostSHellCHangeEvent.
What you need to do is write an InputStream class that the
terminal can read from,
and the IHostShell writes to with its HostShellCHangeEvent. It
will need a buffer
such that it can receive events and hold them in memory until
the terminal
cares to read. Similar to class
org.eclipse.tm.internal.terminal.textcanvas.PipedInputStream
In fact, the VT100TerminalControl will then hook up the
InputStream that you set
(your new class HostShellInputStream) with its I/O through the
PipedInputStream.
Hope
that helps,
Cheers, -- Martin
Oberhuber Wind River Systems, Inc. Target Management Project Lead,
DSDP PMC Member http://www.eclipse.org/dsdp/tm
Hi Martin,
don't worry for previous problems, I have
resolved them. Now I would understand how do to manage outputStream and
InputStream of the terminal. Then, in my class
ExTerminalConnector, that implements ITerminalConnector, I have the
following method:
connect(ITerminalControl control)
so in
it, I set two object
InputStream in;if
OutputStream out;
that represent the
outputStream and InputStream of the terminal. Well, but in the
VT100terminal must I control when user press carriage return (\n) button?
I wold mean, when I press enter button is there in the VT100terminal any
methods that tell me that?
I have done an example setting
this:
InputStream in=null;
OutputStream out=System.out;
in this way, when I write anything in
the terminal, SystemOut console show it. Then, which is the function
of the InputStream (in) if I set it "null" ?
Another thing,
this is how a classic VT100Terminal work:
1- it shows actual
prompt 2- expected user type a command 3- send it to
"manager" 4-return a new prompt 5-and so on...
well, in
according with it, VT100terminal have to show a prompt, and user can write
a command. Now, until terminal doesn't return a new prompt, user cannot
type a new command. How do I do to simulate this mechanism? Must I manage
"the enter button" pressed in the terminal and forbidden user to type new
command like I have described above (set variable echo= FALSE in
method isEcho() in the ExTerminalConnector implements ITerminalConnector)
?
Thanks and greetings,
Crivelli Francesco
Subject: RE: Target Management Project - Undergraduate Level thesis to
Politecnico di Milano Date: Tue, 20 Nov 2007 16:18:55 +0100 From:
Martin.Oberhuber@xxxxxxxxxxxxx To: francescocriv@xxxxxxxxxxx CC:
dsdp-tm-dev@xxxxxxxxxxx
Hello Francesco,
look at what TerminalView.setupControls()
does.
That's the class filling the current view.
You'll see how the SWT Widget is
created, and hooked up with a particular
connector:
ITerminalConnectorInfo[]
connectors=TerminalConnectorExtension.getTerminalConnectors(); fCtlTerminal =
TerminalViewControlFactory.makeControl(this, wndParent, connectors); fCtlTerminal.setConnector(myFavoriteConnector);
The view then sets up the various actions. When an action
is triggered, it runs
an on... method. For instance
onTerminalConnect():
CtlTerminal.connectTerminal();
That's basically it. The connector handles all the I/O. So
if you want to connect a
particular host, you need to configure the connector
first. We don't quite have API
for this yet, but people found a way to work around the
limitations, see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=185348
I think that for the RSE <-> Terminal Integration
project, you'll most probably want
to write your own instance of ITerminalConnector, which
hooks up the streams
expected by the Terminal with the RSE's IHostSHell /
IHostShellOutputListener.
If you want to get some training before actually doing
RSE, you could try to fix
this bug which asks for a connector to the "Local
host":
https://bugs.eclipse.org/bugs/show_bug.cgi?id=196337
Thinking again, you'll probably want your view to always
be fixed on the RSE connector only and not able to switch, so this
might be proper code:
ITerminalConnector rseConnector = new
RSETerminalConnector(rseShellSubsystem); ITerminalViewControl
ctlTerminal = TerminalViewControlFactory.makeControl(this, wndParent, { rseConnector
});
ctlTerminal.setConnector(rseConnector);
CtlTerminal.connectTerminal();
Hope that helps,
Cheers, -- Martin
Oberhuber Wind River Systems, Inc. Target Management Project Lead,
DSDP PMC Member http://www.eclipse.org/dsdp/tm
Hi Martin
in general how do I do to create a org.eclipse.tm.terminal widget? Is
there any documentation about it? Can you show me an example to create
a new Terminal (VT100 simulator) and send it a string (command)?
I have seen the org.eclipse.tm.terminal
but without documentations is not clear.
For
example:
VT100Emulator(ITerminalTextData
data,ITerminalControlForText terminal,InputStream input)
I
suppose "input" is the channel to receive commands (for example
SystemIn), but I dont't understand other two fields. Can you explain
me?
Thanks and greetings.
Crivelli Francesco
Subject: RE: Target Management Project - Undergraduate Level thesis
to Politecnico di Milan Date: Mon, 19 Nov 2007 17:40:47
+0100 From: Martin.Oberhuber@xxxxxxxxxxxxx To:
francescocriv@xxxxxxxxxxx
Especially, look at
SystemCommandAction.showInView()
Cheers, -- Martin Oberhuber Wind River
Systems, Inc. Target Management Project Lead, DSDP PMC
Member http://www.eclipse.org/dsdp/tm
Hello Francesco,
It's good to hear that you've mastered the RSE
Tutorial, and created some sample
actions.
WIth respect to the SWT Shell It looks like there is
a misunderstanding. In the
context of SWT, a "Shell" is just any root window.
This has nothing to do with
the contents of that window, or with what we
understand when talking about a
"remote shell" in the sense of a terminal. Read the
Javadocs of SWT Shell for
more insight.
Look at what the RSE code does for the action
"Launch Shell", see
SystemCommandAction.RunShellJob
to understand how to
programmatically open a View like the Remote
Commands
View.
Don't try to write into / read
from an SWT TextArea. Instead of that
TextArea,
you'll want to use the
org.eclipse.tm.terminal widget instead. It's similar to a
TextArea, but it will interpret
VT100 terminal commands for you. That's the
whole goal of this project --
getting an SWT View hooked up to RSE, that
interprets Terminal control
sequences.
For managing "SSH-Shells
and Telnet-Shells", RSE will do it
automatically
for you when you work on an
IRemoteCmdSubSystem as you've
done.
Depending on how the user
configured his connection, the
IRemoteCmdSubSystem
will actually run on the
IShelLService configured by the
user.
If you have any more
questions, just let me know.
Cheers, -- Martin
Oberhuber Wind River Systems, Inc. Target Management Project
Lead, DSDP PMC Member http://www.eclipse.org/dsdp/tm
Hello Martin,
after have perused the online
documentation "RSE developer Guide", these are the things that I
have done until now:
1) I have implemented a new plugin
(with relatives classes) with the extensions for subsystem,
popmenu and property page.
Some
classes are:
Activator.java that extends "SystemBasePlugin" with methods to
manage the file .properties
PropertyPage.java that extends
SystemBasePropertyPage with methods to create buttons, textarea
or many other components that I'll include
it.
PopupMenu class, that
show Terminal in the "IRemoteFile" connections
Now
a new subsystem doesn't appear yet in the connections for a
generic "Remote Systems View" but my "Raw Terminal" (for
now) starts from the choice in the "IRemoteFile" popupmenu
(method run(IAction action) in the PopupMenu
class).
2)I have used the "packages
org.eclipse.rse.services.shell" and "org.eclipse.rse.subsystems.shells.core" to manage
the commands that the user insert into Terminal and I have
created some useful classes about it. In particular to execute a
generic command I have used the followed code:
.....
IRemoteCmdSubSystem cmdss =
getRemoteCmdSubSystem();
if (cmdss instanceof IShellServiceSubSystem)
{
IShellService shellService
= ((IShellServiceSubSystem)
cmdss).getShellService();
String[]
env=shellService.getHostEnvironment();
String workDir =
selectedFile.getAbsolutePath();
IHostShell hostShell =
shellService.launchShell(workDir, env, new
NullProgressMonitor());
hostShell.addOutputListener(new
StdOutOutputListener()); // to get the output
command
hostShell.writeToShell("mem"); // a command for
example
}
.....
public class StdOutOutputListener implements
IHostShellOutputListener {
public void
shellOutputChanged(IHostShellChangeEvent event) {
IHostOutput[] lines =
event.getLines();
for (int i = 0; i <
lines.length; i++) {
System.out.println(lines[i].getString());
shellOut=lines[i].getString();
display.asyncExec (new Runnable () {
public void run ()
{
shell.setTextArea(shellOut+"\n"); // shell is my
"SWT Terminal View" with a Text to show the output command
and allow insert command
}
});
}
}
} .....
I have tried to execute a
command in a local shell and he works! At this point my question
is:
In this way can I execute a generic command in a
"generic Remote System View"?
3) After that, in this
moment I'm creating the new User Interface Terminal View with
SWT libraries. I have created a new SWT shell that extends
Shell. For example:
... Display display =
Display.getDefault();
ExampleShell shell = new
ExampleShell(display, SWT.SHELL_TRIM);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if
(!display.readAndDispatch())
display.sleep();
} ...
this shell-window
appears when I click "My Terminal Shell" in the IremoteFile
popupmenu. But this window isn't in a "tabbed pane" like old
classic "Remote Shell". How do i do to show as tabbed windows my
Terminal View?
I allow user to insert command and show
its output using the same "textArea". I have thought to place
the cursor in the "text Area lenght +1" position and forbidden
user to edit character before the (textArea lenght +1)
position. When I read the character with
keycode=13 it menas that enter button is pressed than I send the
new command to the methods see above and I show relative
output.
Furthermore, how I manage "SSH-Shells
and Telnet-Shells" services?
For other questions I'll
write you.
Thanks and greetings,
Crivelli
Francesco
Subject: RE: Target Management Project - Undergraduate Level
thesis to Politecnico di Milano Date: Wed, 14 Nov 2007
23:48:24 +0100 From: Martin.Oberhuber@xxxxxxxxxxxxx To:
francescocriv@xxxxxxxxxxx
Hello Francesco,
how is it going? Are you actively working on
this project?
Any questions that I could help
with?
Cheers, -- Martin
Oberhuber Wind River Systems, Inc. Target Management
Project Lead, DSDP PMC Member http://www.eclipse.org/dsdp/tm
Con Windows Live Messenger condividi file senza limiti di peso!
Windows Live Messenger
5 GB di spazio, filtro anti spam e interfaccia personalizzabile GRATIS
per te! Windows Live Hotmail
Concerti trailer e video divertenti! MSN Video
Tutti i tuoi account di posta sul desktop..con Windows Live Mail! Windows Live Mail
|