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
|