### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.services.ssh Index: src/org/eclipse/rse/internal/services/ssh/SshServiceResources.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/SshServiceResources.java,v retrieving revision 1.2 diff -u -r1.2 SshServiceResources.java --- src/org/eclipse/rse/internal/services/ssh/SshServiceResources.java 15 Feb 2007 10:28:26 -0000 1.2 +++ src/org/eclipse/rse/internal/services/ssh/SshServiceResources.java 5 Apr 2008 14:46:21 -0000 @@ -7,6 +7,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - initial API and implementation + * Yu-Fen Kuo (MontaVista) - [170910] Integrate the TM Terminal View with RSE *******************************************************************************/ package org.eclipse.rse.internal.services.ssh; @@ -33,6 +34,11 @@ public static String SshShellService_Description; public static String SshShellService_Name; + + public static String SshTerminalService_Name; + + public static String SshTerminalService_Description; + static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, SshServiceResources.class); Index: src/org/eclipse/rse/internal/services/ssh/SshServiceResources.properties =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/SshServiceResources.properties,v retrieving revision 1.1 diff -u -r1.1 SshServiceResources.properties --- src/org/eclipse/rse/internal/services/ssh/SshServiceResources.properties 15 Feb 2007 09:35:31 -0000 1.1 +++ src/org/eclipse/rse/internal/services/ssh/SshServiceResources.properties 5 Apr 2008 14:46:22 -0000 @@ -7,6 +7,7 @@ # # Contributors: # Martin Oberhuber (Wind River) - initial API and implementation +# Yu-Fen Kuo (MontaVista) - [170910] Integrate the TM Terminal View with RSE ################################################################################ # NLS_MESSAGEFORMAT_VAR @@ -23,3 +24,6 @@ SshShellService_Name=SSH Shell Service SshShellService_Description=SSH Shell Service Description + +SshTerminalService_Name=SSH Terminal Service +SshTerminalService_Description=SSH Terminal Service Description Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.ssh/META-INF/MANIFEST.MF,v retrieving revision 1.15 diff -u -r1.15 MANIFEST.MF --- META-INF/MANIFEST.MF 26 Feb 2008 01:31:50 -0000 1.15 +++ META-INF/MANIFEST.MF 5 Apr 2008 14:46:21 -0000 @@ -13,5 +13,6 @@ Eclipse-LazyStart: true Export-Package: org.eclipse.rse.internal.services.ssh;x-friends:="org.eclipse.rse.connectorservice.ssh,org.eclipse.rse.subsystems.files.ssh,org.eclipse.rse.subsystems.shells.ssh", org.eclipse.rse.internal.services.ssh.files;x-friends:="org.eclipse.rse.connectorservice.ssh,org.eclipse.rse.subsystems.files.ssh,org.eclipse.rse.subsystems.shells.ssh", - org.eclipse.rse.internal.services.ssh.shell;x-friends:="org.eclipse.rse.connectorservice.ssh,org.eclipse.rse.subsystems.files.ssh,org.eclipse.rse.subsystems.shells.ssh" + org.eclipse.rse.internal.services.ssh.shell;x-friends:="org.eclipse.rse.connectorservice.ssh,org.eclipse.rse.subsystems.files.ssh,org.eclipse.rse.subsystems.shells.ssh", + org.eclipse.rse.internal.services.ssh.terminal Bundle-RequiredExecutionEnvironment: J2SE-1.4 Index: src/org/eclipse/rse/internal/services/ssh/shell/SshHostShell.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/shell/SshHostShell.java,v retrieving revision 1.7 diff -u -r1.7 SshHostShell.java --- src/org/eclipse/rse/internal/services/ssh/shell/SshHostShell.java 7 Nov 2007 15:42:00 -0000 1.7 +++ src/org/eclipse/rse/internal/services/ssh/shell/SshHostShell.java 5 Apr 2008 14:46:22 -0000 @@ -16,11 +16,14 @@ * David McKnight (IBM) - [191599] Use the remote encoding specified in the host property page * David McKnight (IBM) - [196301] Check that the remote encoding isn't null before using it * Martin Oberhuber (Wind River) - [204744] Honor encoding in SSH command input field + * Anna Dushistova (MontaVista) - [170910] Integrate the TM Terminal View with RSE *******************************************************************************/ package org.eclipse.rse.internal.services.ssh.shell; import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; @@ -53,12 +56,15 @@ private SshShellOutputReader fStdoutHandler; private SshShellOutputReader fStderrHandler; private SshShellWriterThread fShellWriter; + private int fWidth; + private int fHeight; public SshHostShell(ISshSessionProvider sessionProvider, String initialWorkingDirectory, String commandToRun, String encoding, String[] environment) { try { fSessionProvider = sessionProvider; fChannel = fSessionProvider.getSession().openChannel("shell"); //$NON-NLS-1$ - + ((ChannelShell) fChannel).setPtyType("ansi"); + ////disable pty mode. This works in jsch-0.1.25 and later only. ////By default, jsch always creates a vt100 connection sized ////80x24 / 640x480 (dimensions can be changed). @@ -198,5 +204,26 @@ fChannel.disconnect(); } } + + public InputStream getInputStream() throws IOException { + return fChannel.getInputStream(); + } + + public OutputStream getOutputStream() throws IOException { + return fChannel.getOutputStream(); + } + public void setTerminalSize(int newWidth, int newHeight) { + super.setTerminalSize(newWidth, newHeight); + if (fChannel != null && fChannel instanceof ChannelShell + && (newWidth != fWidth || newHeight != fHeight)) { + // avoid excessive communications due to change size requests by + // caching previous size + ChannelShell channelShell = (ChannelShell) fChannel; + channelShell.setPtySize(newWidth, newHeight, 8 * newWidth, + 8 * newHeight); + fWidth = newWidth; + fHeight = newHeight; + } + } } Index: src/org/eclipse/rse/internal/services/ssh/terminal/SshTerminalService.java =================================================================== RCS file: src/org/eclipse/rse/internal/services/ssh/terminal/SshTerminalService.java diff -N src/org/eclipse/rse/internal/services/ssh/terminal/SshTerminalService.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/rse/internal/services/ssh/terminal/SshTerminalService.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2006, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * Martin Oberhuber (Wind River) - Adapted from LocalShellService. + * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API + * Yu-Fen Kuo (MontaVista) - Adapted from SshShellService + *******************************************************************************/ + +package org.eclipse.rse.internal.services.ssh.terminal; + +import org.eclipse.core.runtime.IProgressMonitor; + +import org.eclipse.rse.internal.services.ssh.ISshService; +import org.eclipse.rse.internal.services.ssh.ISshSessionProvider; +import org.eclipse.rse.internal.services.ssh.SshServiceResources; +import org.eclipse.rse.internal.services.ssh.shell.SshHostShell; +import org.eclipse.rse.services.clientserver.messages.SystemMessage; +import org.eclipse.rse.services.shells.IHostShell; +import org.eclipse.rse.services.terminals.ITerminalService; + +/** + * A Terminal Services for ssh. + */ +public class SshTerminalService implements ISshService, ITerminalService { + + private ISshSessionProvider fSessionProvider; + + public SshTerminalService(ISshSessionProvider sessionProvider) { + fSessionProvider = sessionProvider; + } + + // TODO abstract base class should handle default encodings + public IHostShell launchTerminal(String initialWorkingDirectory, + String[] environment, IProgressMonitor monitor) { + String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ + return launchTerminal(initialWorkingDirectory, defaultEncoding, + environment, monitor); + } + + public IHostShell launchTerminal(String initialWorkingDirectory, + String encoding, String[] environment, IProgressMonitor monitor) { + SshHostShell hostShell = new SshHostShell(fSessionProvider, + initialWorkingDirectory, SshHostShell.SHELL_INVOCATION, + encoding, environment); + return hostShell; + } + + public String[] getHostEnvironment() { + return new String[0]; + } + + public String getName() { + return SshServiceResources.SshTerminalService_Name; + } + + public String getDescription() { + return SshServiceResources.SshTerminalService_Description; + } + + public void initService(IProgressMonitor monitor) { + // nothing to do + } + + public void uninitService(IProgressMonitor monitor) { + // nothing to do + } + + public SystemMessage getMessage(String messageID) { + return null; + } + +} #P org.eclipse.rse.files.ui Index: src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java,v retrieving revision 1.74 diff -u -r1.74 SystemViewRemoteFileAdapter.java --- src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java 28 Mar 2008 17:26:22 -0000 1.74 +++ src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java 5 Apr 2008 14:46:25 -0000 @@ -50,6 +50,7 @@ * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI * Rupen Mardirossian (IBM) - [210682] Copy collisions will use SystemCopyDialog now instead of renameDialog when there is a copy collision within the same connection * David McKnight (IBM) - [224377] "open with" menu does not have "other" option + * Anna Dushistova (MontaVista) - [170910] Integrate the TM Terminal View with RSE *******************************************************************************/ package org.eclipse.rse.internal.files.ui.view; @@ -3634,6 +3635,31 @@ return !test; } } + else if (inName.equals("isterminalsubsystemexists")) { //$NON-NLS-1$ + + boolean test = value.equals("true"); //$NON-NLS-1$ + + ISubSystem subsystem = getSubSystem(tgt); + + if (subsystem != null) { + IHost host = subsystem.getHost(); + ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); + + ISubSystem[] subsystems = registry.getSubSystems(host); + + for (int i = 0; i < subsystems.length; i++) { + ISubSystem temp = subsystems[i]; + if (temp.getConfigurationId().endsWith("terminals")){ + return test; + } + } + + return !test; + } + else { + return !test; + } + } } return super.testAttribute(target, name, value); #P org.eclipse.rse.services Index: src/org/eclipse/rse/services/shells/AbstractHostShell.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/AbstractHostShell.java,v retrieving revision 1.1 diff -u -r1.1 AbstractHostShell.java --- src/org/eclipse/rse/services/shells/AbstractHostShell.java 10 Apr 2006 20:39:10 -0000 1.1 +++ src/org/eclipse/rse/services/shells/AbstractHostShell.java 5 Apr 2008 14:46:26 -0000 @@ -12,10 +12,16 @@ * * Contributors: * {Name} (company) - description of contribution. + * Anna Dushistova (MontaVista) - [170910] Integrate the TM Terminal View with RSE + * Eugeniy Melekhov (MontaVista) - [170910] Integrate the TM Terminal View with RSE ********************************************************************************/ package org.eclipse.rse.services.shells; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + public abstract class AbstractHostShell implements IHostShell { @@ -34,4 +40,20 @@ } } + public InputStream getInputStream() throws IOException { + return null; + } + + public OutputStream getOutputStream() throws IOException { + return null; + } + + public boolean isLocalEcho() { + return false; + } + + public void setTerminalSize(int newWidth, int newHeight) { + + } + } \ No newline at end of file Index: src/org/eclipse/rse/services/shells/IHostShell.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/IHostShell.java,v retrieving revision 1.1 diff -u -r1.1 IHostShell.java --- src/org/eclipse/rse/services/shells/IHostShell.java 10 Apr 2006 20:39:10 -0000 1.1 +++ src/org/eclipse/rse/services/shells/IHostShell.java 5 Apr 2008 14:46:26 -0000 @@ -12,16 +12,38 @@ * * Contributors: * {Name} (company) - description of contribution. + * Anna Dushistova (MontaVista) - [170910] Integrate the TM Terminal View with RSE + * Eugeniy Melekhov (MontaVista) - [170910] Integrate the TM Terminal View with RSE ********************************************************************************/ package org.eclipse.rse.services.shells; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + public interface IHostShell { public boolean isActive(); public void writeToShell(String command); + /** + * @return remote-to-local stream for the current shell or + * null if streams are not supported. + * @throws IOException + * @since org.eclipse.rse.services 3.0 + */ + public InputStream getInputStream() throws IOException; + + /** + * @return local-to-remote stream for the current shell or + * null if streams are not supported. + * @throws IOException + * @since org.eclipse.rse.services 3.0 + */ + public OutputStream getOutputStream() throws IOException; + public void addOutputListener(IHostShellOutputListener listener); public IHostShellOutputReader getStandardOutputReader(); @@ -29,4 +51,17 @@ public void exit(); + /** + * @return true if a local echo is needed. + * @since org.eclipse.rse.services 3.0 + */ + boolean isLocalEcho(); + + /** + * Notify the remote site that the size of the terminal has changed. + * @param newWidth + * @param newHeight + * @since org.eclipse.rse.services 3.0 + */ + void setTerminalSize(int newWidth, int newHeight); } \ No newline at end of file Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/META-INF/MANIFEST.MF,v retrieving revision 1.14 diff -u -r1.14 MANIFEST.MF --- META-INF/MANIFEST.MF 26 Feb 2008 01:32:49 -0000 1.14 +++ META-INF/MANIFEST.MF 5 Apr 2008 14:46:26 -0000 @@ -24,5 +24,6 @@ org.eclipse.rse.services.files, org.eclipse.rse.services.processes, org.eclipse.rse.services.search, - org.eclipse.rse.services.shells + org.eclipse.rse.services.shells, + org.eclipse.rse.services.terminals Bundle-RequiredExecutionEnvironment: J2SE-1.4 Index: src/org/eclipse/rse/services/terminals/ITerminalService.java =================================================================== RCS file: src/org/eclipse/rse/services/terminals/ITerminalService.java diff -N src/org/eclipse/rse/services/terminals/ITerminalService.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/rse/services/terminals/ITerminalService.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,63 @@ +/******************************************************************************** + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API + * Yu-Fen Kuo (MontaVista) - Adapted from IShellService + ********************************************************************************/ + +package org.eclipse.rse.services.terminals; + +import org.eclipse.core.runtime.IProgressMonitor; + +import org.eclipse.rse.services.IService; +import org.eclipse.rse.services.shells.IHostShell; + +public interface ITerminalService extends IService { + + /** + * Launch a new terminal in the specified directory + * + * @param initialWorkingDirectory + * @param environment + * Array of environment variable Strings of the form + * "var=text" + * @param monitor + * @return the terminal object + */ + public IHostShell launchTerminal(String initialWorkingDirectory, + String[] environment, IProgressMonitor monitor); + + /** + * Launch a new terminal in the specified directory + * + * @param initialWorkingDirectory + * @param encoding + * @param environment + * Array of environment variable Strings of the form + * "var=text" + * @param monitor + * @return the shell object + */ + public IHostShell launchTerminal(String initialWorkingDirectory, + String encoding, String[] environment, IProgressMonitor monitor); + + /** + * Return an array of environment variables that describe the environment on + * the host. Each String returned is of the format "var=text": Everything up + * to the first equals sign is the name of the given environment variable, + * everything after the equals sign is its contents. + * + * @return Array of environment variable Strings of the form "var=text" + */ + public String[] getHostEnvironment(); +} #P org.eclipse.rse.services.telnet Index: src/org/eclipse/rse/internal/services/telnet/shell/TelnetHostShell.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.telnet/src/org/eclipse/rse/internal/services/telnet/shell/TelnetHostShell.java,v retrieving revision 1.6 diff -u -r1.6 TelnetHostShell.java --- src/org/eclipse/rse/internal/services/telnet/shell/TelnetHostShell.java 7 Nov 2007 15:43:55 -0000 1.6 +++ src/org/eclipse/rse/internal/services/telnet/shell/TelnetHostShell.java 5 Apr 2008 14:46:31 -0000 @@ -17,11 +17,14 @@ * Sheldon D'souza (Celunite) - [187301] support multiple telnet shells * David McKnight (IBM) - [191599] Use the remote encoding specified in the host property page * Martin Oberhuber (Wind River) - [194466] Fix shell terminated state when stream is closed + * Anna Dushistova (MontaVista) - [170910] Integrate the TM Terminal View with RSE + * Eugeniy Melekhov (MontaVista) - [170910] Integrate the TM Terminal View with RSE *******************************************************************************/ package org.eclipse.rse.internal.services.telnet.shell; import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; @@ -162,4 +165,18 @@ } + public InputStream getInputStream() throws IOException { + if(fTelnetClient != null){ + return fTelnetClient.getInputStream(); + } + return null; + } + + public OutputStream getOutputStream() throws IOException { + if(fTelnetClient != null){ + return fTelnetClient.getOutputStream(); + } + return null; + } + }