Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dsdp-tm-dev] RE: Target Management Project - Undergraduate Level thesis to Politecnico di Milano

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

 


From: Francesco Crivelli [mailto:francescocriv@xxxxxxxxxxx]
Sent: Thursday, November 22, 2007 12:19 PM
To: Oberhuber, Martin
Subject: RE: Target Management Project - Undergraduate Level thesis to Politecnico di Milano

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
 


From: Francesco Crivelli [mailto:francescocriv@xxxxxxxxxxx]
Sent: Tuesday, November 20, 2007 12:41 PM
To: Oberhuber, Martin
Subject: RE: Target Management Project - Undergraduate Level thesis to Politecnico di Milano

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
 


From: Oberhuber, Martin
Sent: Monday, November 19, 2007 5:11 PM
To: 'Francesco Crivelli'
Cc: 'Target Management developer discussions'
Subject: RE: Target Management Project - Undergraduate Level thesis to Politecnico di Milano

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
 


From: Francesco Crivelli [mailto:francescocriv@xxxxxxxxxxx]
Sent: Thursday, November 15, 2007 1:02 AM
To: Oberhuber, Martin
Subject: RE: Target Management Project - Undergraduate Level thesis to Politecnico di Milano

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

Back to the top