1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 463976 - Implement a Console View based Terminal

Adds a terminal console which can be opened by selecting Open Console >
Terminal Console and selecting a remote connection which supports the
command shell service.  If a console is already open for that remote
connection it will be shown and if one doesn't exist then a new one will
be created.  Buttons for connecting, disconnecting, scroll lock, and
closing the console are also available.

Also adds a local command shell with PTY support. Also added some
syncronization around the connections in the connection type.

Moved the Open Terminal to console plug-in and renamed it Open
Command Shell.

Also fixed missing serial port feature from the remote repo.

Change-Id: I84282b04813471bb01385a328ebc144bdf0e6a28
Signed-off-by: Doug Schaefer <dschaefer@qnx.com>
This commit is contained in:
Doug Schaefer 2015-04-20 12:11:48 -04:00
parent efeb6fc7bb
commit 9825f0f0cb
73 changed files with 2187 additions and 101 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1 @@
/bin/

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.remote.console</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

View file

@ -0,0 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Console
Bundle-SymbolicName: org.eclipse.remote.console;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.remote.internal.console.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.remote.core;bundle-version="2.0.0",
org.eclipse.remote.ui;bundle-version="2.0.0",
org.eclipse.ui.console;bundle-version="3.6.0",
org.eclipse.tm.terminal.control;bundle-version="4.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy

View file

@ -0,0 +1,22 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>About</title>
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
</head>
<body lang="EN-US">
<h2>About This Content</h2>
<p>May 2, 2006</p>
<h3>License</h3>
<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source code in the Content and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org.</p>
</body>
</html>

View file

@ -0,0 +1,27 @@
# about.ini
# contains information about a feature
# java.io.Properties file (ISO 8859-1 with "\" escapes)
# "%key" are externalized strings defined in about.properties
# This file does not need to be translated.
# Property "aboutText" contains blurb for "About" dialog (translated)
aboutText=%blurb
# Property "windowImage" contains path to window icon (16x16)
# needed for primary features only
# Property "featureImage" contains path to feature image (32x32)
featureImage=ptp_logo_icon32.png
# Property "aboutImage" contains path to product image (500x330 or 115x164)
# needed for primary features only
# Property "appName" contains name of the application (not translated)
# needed for primary features only
# Property "welcomePage" contains path to welcome page (special XML-based format)
# optional
# Property "welcomePerspective" contains the id of the perspective in which the
# welcome page is to be opened.
# optional

View file

@ -0,0 +1,6 @@
# about.mappings
# contains fill-ins for about.properties
# java.io.Properties file (ISO 8859-1 with "\" escapes)
# This file does not need to be translated.
0=@build@

View file

@ -0,0 +1,22 @@
###############################################################################
# Copyright (c) 2005, 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
#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
# NLS_MESSAGEFORMAT_NONE
# NLS_ENCODING=UTF-8
blurb=Remote Services\n\
\n\
Version: {featureVersion}\n\
Build id: {0}\n\
\n\
Copyright (c) 2008 IBM Corporation, and others. All rights reserved.\n\
Visit http://www.eclipse.org/ptp\n

View file

@ -0,0 +1,12 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
plugin.properties,\
icons/,\
about.html,\
about.ini,\
about.mappings,\
about.properties,\
ptp_logo_icon32.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

View file

@ -0,0 +1,9 @@
##########################################################################
# Copyright (c) 2015 QNX Software Systems, Inc. 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
##########################################################################
terminal.console.name=Command Shell Console
OpenTerminalCommand.name=Open Command Shell

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.console.consoleFactories">
<consoleFactory
class="org.eclipse.remote.internal.console.TerminalConsoleFactory"
icon="icons/cview16/terminal_view.gif"
label="%terminal.console.name">
</consoleFactory>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
defaultHandler="org.eclipse.remote.internal.console.actions.OpenCommandShellHandler"
id="org.eclipse.remote.ui.command.openTerminal"
name="%OpenTerminalCommand.name">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="popup:org.eclipse.remote.ui.view.connections">
<command
commandId="org.eclipse.remote.ui.command.openTerminal"
label="%OpenTerminalCommand.name"
style="push">
<visibleWhen
checkEnabled="false">
<with
variable="selection">
<iterate>
<test
args="org.eclipse.remote.core.IRemoteCommandShellService"
property="org.eclipse.remote.ui.hasConnectionService">
</test>
</iterate>
</with>
</visibleWhen>
</command>
</menuContribution>
</extension>
</plugin>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.remote</groupId>
<artifactId>remote-parent</artifactId>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../releng/org.eclipse.remote.build/pom.xml</relativePath>
</parent>
<artifactId>org.eclipse.remote.console</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View file

@ -0,0 +1,148 @@
package org.eclipse.remote.internal.console;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map.Entry;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.remote.console"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
public static Activator getDefault() {
return plugin;
}
@Override
protected void initializeImageRegistry(ImageRegistry imageRegistry) {
HashMap<String, String> map = new HashMap<>();
try {
// Local toolbars
map.put(ImageConsts.IMAGE_NEW_TERMINAL, "newterminal.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_CLCL_CONNECT, "connect_co.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_CLCL_DISCONNECT, "disconnect_co.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_CLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_CLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_CLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map);
map.clear();
// Enabled local toolbars
map.put(ImageConsts.IMAGE_NEW_TERMINAL, "newterminal.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_ELCL_CONNECT, "connect_co.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_ELCL_DISCONNECT, "disconnect_co.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_ELCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_ELCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_ELCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_ELCL_REMOVE, "rem_co.gif"); //$NON-NLS-1$
loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map);
map.clear();
// Disabled local toolbars
map.put(ImageConsts.IMAGE_NEW_TERMINAL, "newterminal.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_DLCL_CONNECT, "connect_co.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_DLCL_DISCONNECT, "disconnect_co.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_DLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_DLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_DLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_DLCL_REMOVE, "rem_co.gif"); //$NON-NLS-1$
loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map);
map.clear();
map.put(ImageConsts.IMAGE_TERMINAL_VIEW, "terminal_view.gif"); //$NON-NLS-1$
loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_EVIEW, map);
map.clear();
} catch (MalformedURLException malformedURLException) {
malformedURLException.printStackTrace();
}
}
protected void loadImageRegistry(ImageRegistry imageRegistry, String strDir, HashMap<String, String> map)
throws MalformedURLException {
ImageDescriptor imageDescriptor;
for (Entry<String, String> entry : map.entrySet()) {
URL url = plugin.getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + strDir + entry.getValue());
imageDescriptor = ImageDescriptor.createFromURL(url);
imageRegistry.put(entry.getKey(), imageDescriptor);
}
}
/**
* Create log entry from an IStatus
*
* @param status
* status to log
*/
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
/**
* Create log entry from a string
*
* @param msg
* message to log
*/
public static void log(String msg) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, msg, null));
}
/**
* Create log entry from a Throwable
*
* @param e
* throwable to log
*/
public static void log(Throwable e) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
}
/**
* Return the OSGi service with the given service interface.
*
* @param service
* service interface
* @return the specified service or null if it's not registered
*/
public static <T> T getService(Class<T> service) {
final BundleContext context = plugin.getBundle().getBundleContext();
final ServiceReference<T> ref = context.getServiceReference(service);
return ref != null ? context.getService(ref) : null;
}
}

View file

@ -0,0 +1,34 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console;
import org.eclipse.osgi.util.NLS;
public class ConsoleMessages extends NLS {
static {
NLS.initializeMessages(ConsoleMessages.class.getName(), ConsoleMessages.class);
}
public static String SELECT_CONNECTION;
public static String ENCODING_UNAVAILABLE_0;
public static String ENCODING_UNAVAILABLE_1;
public static String ENCODING;
public static String OPEN_CONSOLE_ERROR;
public static String STATUS;
public static String STATUS_CONNECTED;
public static String STATUS_CONNECTING;
public static String STATUS_CLOSED;
public static String CONNECTING_TO_TERMINAL;
public static String OPENNING_TERMINAL;
public static String MAKING_CONNECTION;
public static String DISCONNECTING;
}

View file

@ -0,0 +1,24 @@
################################################################################
# Copyright (c) 2015 QNX Software Systems 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
#
# Contributors:
# QNX Software Systems - Initial API and implementation
################################################################################
SELECT_CONNECTION = Select Remote Connection
ENCODING_UNAVAILABLE_0 = Unable to set Encoding
ENCODING_UNAVAILABLE_1 = Encoding {0} is unavailable!
ENCODING = Encoding:
OPEN_CONSOLE_ERROR = Error Opening Command Shell Console
STATUS = Status:
STATUS_CONNECTED = CONNECTED
STATUS_CONNECTING = CONNECTING...
STATUS_CLOSED = CLOSED
CONNECTING_TO_TERMINAL = Connecting to Command Shell
OPENNING_TERMINAL = Openning Command Shell
MAKING_CONNECTION = Making Connection
DISCONNECTING = Disconnecting

View file

@ -0,0 +1,52 @@
/*******************************************************************************
* Copyright (c) 2003, 2015 Wind River Systems, Inc. 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 Wind River employees contributed to the Terminal component
* that contains this file: Chris Thew, Fran Litterio, Stephen Lamb,
* Helmut Haigermoser and Ted Williams.
*
* Contributors:
* Michael Scharf (Wind River) - extracted from TerminalConsts
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
* Michael Scharf (Wind River) - [172483] added some more icons
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
*******************************************************************************/
package org.eclipse.remote.internal.console;
public interface ImageConsts
{
public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$
public final static String IMAGE_DIR_LOCALTOOL = "clcl16/"; // basic colors - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_DLCL = "dlcl16/"; // disabled - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_ELCL = "elcl16/"; // enabled - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_VIEW = "cview16/"; // views //$NON-NLS-1$
public final static String IMAGE_DIR_EVIEW = "eview16/"; // views //$NON-NLS-1$
public static final String IMAGE_NEW_TERMINAL = "TerminalViewNewTerminal"; //$NON-NLS-1$
public static final String IMAGE_TERMINAL_VIEW = "TerminalView"; //$NON-NLS-1$
public static final String IMAGE_CLCL_CONNECT = "ImageClclConnect"; //$NON-NLS-1$
public static final String IMAGE_CLCL_DISCONNECT = "ImageClclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_CLCL_SETTINGS = "ImageClclSettings"; //$NON-NLS-1$
public static final String IMAGE_CLCL_SCROLL_LOCK = "ImageClclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_DLCL_CONNECT = "ImageDlclConnect"; //$NON-NLS-1$
public static final String IMAGE_DLCL_DISCONNECT = "ImageDlclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_DLCL_SETTINGS = "ImageDlclSettings"; //$NON-NLS-1$
public static final String IMAGE_DLCL_SCROLL_LOCK = "ImageDlclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_DLCL_REMOVE = "ImageDlclRemove"; //$NON-NLS-1$
public static final String IMAGE_ELCL_CONNECT = "ImageElclConnect"; //$NON-NLS-1$
public static final String IMAGE_ELCL_DISCONNECT = "ImageElclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_ELCL_SETTINGS = "ImageElclSettings"; //$NON-NLS-1$
public static final String IMAGE_ELCL_SCROLL_LOCK = "ImageElclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_ELCL_REMOVE = "ImageElclRemove"; //$NON-NLS-1$
public static final String IMAGE_CLCL_COMMAND_INPUT_FIELD = "ImageClclCommandInputField";//$NON-NLS-1$
public static final String IMAGE_ELCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$
public static final String IMAGE_DLCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$
}

View file

@ -0,0 +1,81 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
import org.eclipse.ui.console.AbstractConsole;
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.part.IPageBookViewPage;
import org.eclipse.ui.progress.UIJob;
@SuppressWarnings("restriction")
public class TerminalConsole extends AbstractConsole {
private final String encoding;
private final TerminalConsoleConnector terminalConnector;
private final int index;
public TerminalConsole(IRemoteConnection connection, int index, String encoding) {
super(connection.getName(), Activator.getDefault().getImageRegistry().getDescriptor(ImageConsts.IMAGE_TERMINAL_VIEW));
this.encoding = encoding;
this.terminalConnector = new TerminalConsoleConnector(connection);
this.index = index;
}
public TerminalConsoleConnector getTerminalConnector() {
return terminalConnector;
}
public IRemoteConnection getConnection() {
return terminalConnector.getConnection();
}
public int getIndex() {
return index;
}
public synchronized void setState(TerminalState terminalState) {
StringBuffer nameBuff = new StringBuffer(getConnection().getName());
if (index > 0) {
nameBuff.append(' ');
nameBuff.append(String.valueOf(index));
}
nameBuff.append(" ("); //$NON-NLS-1$
if (terminalState == TerminalState.CLOSED) {
nameBuff.append(ConsoleMessages.STATUS_CLOSED);
} else if (terminalState == TerminalState.CONNECTED) {
nameBuff.append(ConsoleMessages.STATUS_CONNECTED);
} else if (terminalState == TerminalState.CONNECTING) {
nameBuff.append(ConsoleMessages.STATUS_CONNECTING);
}
nameBuff.append(")"); //$NON-NLS-1$
final String name = nameBuff.toString();
if (!name.equals(getName())) {
UIJob job = new UIJob("updating name") { //$NON-NLS-1$
public IStatus runInUIThread(IProgressMonitor monitor) {
TerminalConsole.this.setName(name);
return Status.OK_STATUS;
}
};
job.setSystem(true);
job.schedule();
}
}
public IPageBookViewPage createPage(IConsoleView view) {
view.setFocus();
return new TerminalConsolePage(this, encoding);
}
}

View file

@ -0,0 +1,285 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.remote.core.IRemoteCommandShellService;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteProcess;
import org.eclipse.remote.core.IRemoteProcessBuilder;
import org.eclipse.remote.core.IRemoteProcessTerminalService;
import org.eclipse.remote.core.exception.RemoteConnectionException;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
@SuppressWarnings("restriction")
public class TerminalConsoleConnector {
private final IRemoteConnection connection;
private IRemoteProcess remoteProcess;
private PageConnector[] pageConnectors = new PageConnector[0];
private int width, height;
private TerminalState state = TerminalState.CLOSED;
private class OutThread extends Thread {
public OutThread() {
super("Terminal Output"); //$NON-NLS-1$
}
public void run() {
try {
byte[] buff = new byte[1024];
InputStream in = remoteProcess.getInputStream();
for (int n = in.read(buff); n >= 0; n = in.read(buff)) {
for (PageConnector connector : pageConnectors) {
ITerminalControl control = connector.control;
if (control != null) {
control.getRemoteToTerminalOutputStream().write(buff, 0, n);
}
}
}
setState(TerminalState.CLOSED);
synchronized (TerminalConsoleConnector.this) {
outThread = null;
}
} catch (IOException e) {
Activator.log(e);
}
}
}
private OutThread outThread;
public TerminalConsoleConnector(IRemoteConnection connection) {
this.connection = connection;
}
public IRemoteConnection getConnection() {
return connection;
}
public ITerminalConnector newPageConnector() {
PageConnector connector = new PageConnector();
List<PageConnector> list = new ArrayList<>(Arrays.asList(pageConnectors));
list.add(connector);
pageConnectors = list.toArray(new PageConnector[list.size()]);
return connector;
}
private void disposePageConnector(PageConnector connector) {
List<PageConnector> list = new ArrayList<>(Arrays.asList(pageConnectors));
list.remove(connector);
pageConnectors = list.toArray(new PageConnector[list.size()]);
if (list.isEmpty()) {
// All gone, disconnect
disconnect();
}
}
private synchronized void setState(TerminalState state) {
this.state = state;
for (PageConnector connector : pageConnectors) {
ITerminalControl control = connector.control;
if (control != null) {
connector.control.setState(state);
}
}
}
public synchronized void connect() {
if (state != TerminalState.CLOSED) {
return;
}
new Job(ConsoleMessages.MAKING_CONNECTION) {
@Override
protected IStatus run(IProgressMonitor monitor) {
// make sure we're only doing this one at a time
// second and further controls will inherit much of this
synchronized (TerminalConsoleConnector.this) {
setState(TerminalState.CONNECTING);
if (remoteProcess == null || remoteProcess.isCompleted()) {
try {
// We'll need a new one
if (!connection.isOpen()) {
try {
connection.open(monitor);
} catch (RemoteConnectionException e) {
return e.getStatus();
}
}
remoteProcess = connection.getService(IRemoteCommandShellService.class)
.getCommandShell(IRemoteProcessBuilder.ALLOCATE_PTY);
} catch (IOException e) {
Activator.log(e);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e);
}
}
if (outThread == null) {
outThread = new OutThread();
outThread.start();
}
if (width > 0 || height > 0) {
TerminalConsoleConnector.this.setTerminalSize();
}
setState(TerminalState.CONNECTED);
return Status.OK_STATUS;
}
}
}.schedule();
}
public void disconnect() {
if (!remoteProcess.isCompleted()) {
new Job(ConsoleMessages.DISCONNECTING) {
@Override
protected IStatus run(IProgressMonitor monitor) {
remoteProcess.destroy();
return Status.OK_STATUS;
}
}.schedule();
}
}
private void setTerminalSize() {
int minWidth = Integer.MAX_VALUE;
int minHeight = Integer.MAX_VALUE;
for (PageConnector connector : pageConnectors) {
if (connector.myWidth < minWidth) {
minWidth = connector.myWidth;
}
if (connector.myHeight < minHeight) {
minHeight = connector.myHeight;
}
}
// Weird but the terminal has wrapping issues at this width, need to reduce it by 4.
minWidth -= 4;
if (minWidth != width || minHeight != height) {
width = minWidth;
height = minHeight;
synchronized (this) {
if (remoteProcess != null) {
IRemoteProcessTerminalService termService = remoteProcess.getService(IRemoteProcessTerminalService.class);
if (termService != null) {
termService.setTerminalSize(width, height, 8 * width, 8 * height);
}
}
}
}
}
private class PageConnector extends PlatformObject implements ITerminalConnector {
private int myWidth, myHeight;
private ITerminalControl control;
@Override
public OutputStream getTerminalToRemoteStream() {
return remoteProcess.getOutputStream();
}
@Override
public void connect(final ITerminalControl control) {
this.control = control;
control.setVT100LineWrapping(true);
TerminalConsoleConnector.this.connect();
if (!control.getState().equals(state)) {
control.setState(state);
}
}
@Override
public synchronized void disconnect() {
disposePageConnector(this);
}
@Override
public void setTerminalSize(int newWidth, int newHeight) {
if (newWidth != myWidth || newHeight != myHeight) {
myWidth = newWidth;
myHeight = newHeight;
TerminalConsoleConnector.this.setTerminalSize();
}
}
@Override
public String getId() {
// No id, we're magic
return null;
}
@Override
public String getName() {
// No name
return null;
}
@Override
public boolean isHidden() {
// in case we do leak into the TM world, we shouldn't be visible
return true;
}
@Override
public boolean isInitialized() {
return true;
}
@Override
public String getInitializationErrorMessage() {
return null;
}
@Override
public boolean isLocalEcho() {
// TODO should the be a property of the connection?
return false;
}
@Override
public void setDefaultSettings() {
// we don't do settings
}
@Override
public String getSettingsSummary() {
// we don't do settings
return null;
}
@Override
public void load(ISettingsStore arg0) {
// we don't do settings
}
@Override
public void save(ISettingsStore arg0) {
// we don't do settings
}
}
}

View file

@ -0,0 +1,83 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.window.Window;
import org.eclipse.remote.core.IRemoteCommandShellService;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.exception.RemoteConnectionException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleFactory;
import org.eclipse.ui.console.IConsoleManager;
public class TerminalConsoleFactory implements IConsoleFactory {
@Override
public void openConsole() {
final TerminalConsoleSettingsDialog settingsDialog = new TerminalConsoleSettingsDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
if (settingsDialog.open() == Window.OK) {
openConsole(settingsDialog.getRemoteConnection(), settingsDialog.getEncoding());
}
}
public static void openConsole(final IRemoteConnection connection, final String encoding) {
new Job(ConsoleMessages.OPENNING_TERMINAL) {
@Override
public IStatus run(IProgressMonitor monitor) {
IRemoteCommandShellService commandShellService = connection.getService(IRemoteCommandShellService.class);
if (commandShellService == null) {
return Status.CANCEL_STATUS;
}
try {
if (!connection.isOpen()) {
connection.open(monitor);
}
// TODO, how to handle command shells that are singletons, like serial ports
// Find the index;
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
IConsole[] consoles = consoleManager.getConsoles();
boolean[] indices = new boolean[consoles.length];
for (IConsole console : consoles) {
if (console instanceof TerminalConsole) {
TerminalConsole terminalConsole = (TerminalConsole) console;
if (terminalConsole.getConnection().equals(connection)) {
indices[terminalConsole.getIndex()] = true;
}
}
}
int index = 0;
while (index < indices.length && indices[index]) {
index++;
}
TerminalConsole terminalConsole = new TerminalConsole(connection, index, encoding);
consoleManager.addConsoles(new IConsole[] { terminalConsole });
consoleManager.showConsoleView(terminalConsole);
return Status.OK_STATUS;
} catch (RemoteConnectionException e) {
return e.getStatus();
}
}
}.schedule();
}
}

View file

@ -0,0 +1,178 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console;
import java.io.UnsupportedEncodingException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.remote.internal.console.actions.ConsoleActionConnect;
import org.eclipse.remote.internal.console.actions.ConsoleActionDisconnect;
import org.eclipse.remote.internal.console.actions.ConsoleActionScrollLock;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.tm.internal.terminal.control.ITerminalListener;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.actions.CloseConsoleAction;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.part.Page;
import org.eclipse.ui.progress.UIJob;
@SuppressWarnings("restriction")
public class TerminalConsolePage extends Page {
public static final String TOOLBAR_GROUP_ID = "org.eclipse.remote.internal.terminal.console.Toolbar"; //$NON-NLS-1$
private final ConsoleActionConnect connectAction;
private final ConsoleActionDisconnect disconnectAction;
private final TerminalConsole terminalConsole;
private final String encoding;
private Composite mainComposite;
private ITerminalViewControl tViewCtrl;
private Job connectTerminalJob = new ConnectTerminalJob();
private final ITerminalListener listener = new ITerminalListener() {
@Override
public void setState(TerminalState state) {
if (state == TerminalState.CONNECTING || state == TerminalState.CONNECTED) {
disconnectAction.setEnabled(true);
connectAction.setEnabled(false);
} else if (state == TerminalState.CLOSED) {
disconnectAction.setEnabled(false);
connectAction.setEnabled(true);
}
terminalConsole.setState(state);
}
@Override
public void setTerminalTitle(final String title) {
// ignore titles coming from the widget
}
};
public TerminalConsolePage(TerminalConsole console, String encoding) {
terminalConsole = console;
this.encoding = encoding;
connectAction = new ConsoleActionConnect(console);
disconnectAction = new ConsoleActionDisconnect(console);
}
public TerminalConsole getConsole() {
return terminalConsole;
}
@Override
public void init(IPageSite pageSite) {
super.init(pageSite);
IToolBarManager toolBarManager = pageSite.getActionBars().getToolBarManager();
toolBarManager.insertBefore(IConsoleConstants.OUTPUT_GROUP, new GroupMarker(TOOLBAR_GROUP_ID));
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, connectAction);
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, disconnectAction);
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new ConsoleActionScrollLock(this));
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new CloseConsoleAction(terminalConsole));
}
@Override
public void createControl(Composite parent) {
mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
mainComposite.setLayout(new FillLayout());
tViewCtrl = TerminalViewControlFactory.makeControl(listener,
mainComposite,
new ITerminalConnector[] {});
tViewCtrl.setConnector(terminalConsole.getTerminalConnector().newPageConnector());
try {
tViewCtrl.setEncoding(encoding);
} catch (UnsupportedEncodingException e) {
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
NLS.bind(ConsoleMessages.ENCODING_UNAVAILABLE_1, encoding));
Activator.log(status);
ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
ConsoleMessages.OPEN_CONSOLE_ERROR,
ConsoleMessages.ENCODING_UNAVAILABLE_0,
status);
}
connectTerminalJob.schedule();
}
@Override
public Control getControl() {
return mainComposite;
}
@Override
public void setFocus() {
tViewCtrl.setFocus();
}
@Override
public void dispose() {
tViewCtrl.disposeTerminal();
super.dispose();
}
public TerminalState getTerminalState() {
return tViewCtrl.getState();
}
public void connectTerminal() {
if (!tViewCtrl.isConnected()) {
connectTerminalJob.schedule();
}
}
public void disconnectTerminal() {
if (tViewCtrl.getState() != TerminalState.CLOSED) {
tViewCtrl.getTerminalConnector().disconnect();
}
}
public void setScrollLock(boolean enabled) {
tViewCtrl.setScrollLock(enabled);
}
public boolean getScrollLock() {
return tViewCtrl.isScrollLock();
}
class ConnectTerminalJob extends UIJob {
public ConnectTerminalJob() {
super(ConsoleMessages.CONNECTING_TO_TERMINAL);
setSystem(true);
}
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
if (tViewCtrl != null && !tViewCtrl.isDisposed()) {
tViewCtrl.clearTerminal();
tViewCtrl.connectTerminal();
}
return Status.OK_STATUS;
}
}
}

View file

@ -0,0 +1,188 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.remote.core.IRemoteCommandShellService;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionType;
import org.eclipse.remote.core.IRemoteProcessService;
import org.eclipse.remote.core.IRemoteServicesManager;
import org.eclipse.remote.ui.widgets.RemoteConnectionWidget;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class TerminalConsoleSettingsDialog extends Dialog {
private static final String CONNECTION_TYPE = "connectionType"; //$NON-NLS-1$
private static final String CONNECTION_NAME = "connectionName"; //$NON-NLS-1$
private static final String ENCODING = "encoding"; //$NON-NLS-1$
private RemoteConnectionWidget remoteConnWidget;
private Combo encodingCombo;
private String selectedEncoding;
public TerminalConsoleSettingsDialog(IShellProvider parentShell) {
this(parentShell.getShell());
}
public TerminalConsoleSettingsDialog(Shell parentShell) {
super(parentShell);
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
composite.setLayout(new GridLayout(2, false));
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
// TODO remove the remote process service once we get command shell available with ssh and local
@SuppressWarnings("unchecked") List<IRemoteConnectionType> connTypes = manager.getConnectionTypesSupporting(
IRemoteCommandShellService.class, IRemoteProcessService.class);
remoteConnWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0, connTypes);
IDialogSettings settings = getDialogSettings();
String initialId = settings.get(CONNECTION_TYPE);
String initialName = settings.get(CONNECTION_NAME);
if (initialId != null && initialName != null) {
remoteConnWidget.setConnection(initialId, initialName);
}
GridData gd = new GridData();
gd.horizontalSpan = 2;
remoteConnWidget.setLayoutData(gd);
remoteConnWidget.addSelectionListener(new ValidationSelectionListener());
Label encodingLabel = new Label(composite, SWT.NONE);
encodingLabel.setLayoutData(new GridData());
encodingLabel.setText(ConsoleMessages.ENCODING);
encodingCombo = new Combo(composite, SWT.READ_ONLY);
encodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
int i = 0;
String initialEncoding = settings.get(ENCODING);
if (initialEncoding == null) {
initialEncoding = Charset.defaultCharset().name();
}
for (String encoding : getEncodings()) {
encodingCombo.add(encoding);
if (encoding.equals(initialEncoding)) {
selectedEncoding = encoding;
encodingCombo.select(i);
}
i++;
}
encodingCombo.addSelectionListener(new ValidationSelectionListener());
return composite;
}
private List<String> getEncodings(){
List<String> encodings = new ArrayList<>(2);
encodings.add("ISO-8859-1"); //$NON-NLS-1$
encodings.add("UTF-8"); //$NON-NLS-1$
String hostEncoding = Charset.defaultCharset().name();
if (!encodings.contains(hostEncoding)) {
encodings.add(hostEncoding);
}
return encodings;
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent);
validateDialog();
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(ConsoleMessages.SELECT_CONNECTION);
}
private void validateDialog() {
IRemoteConnection connection = remoteConnWidget.getConnection();
selectedEncoding = encodingCombo.getItem(encodingCombo.getSelectionIndex());
if (connection != null && selectedEncoding != null) {
getButton(OK).setEnabled(true);
} else {
getButton(OK).setEnabled(false);
}
}
/**
* Get the remote connection selected in the dialog.
*/
public IRemoteConnection getRemoteConnection() {
return remoteConnWidget.getConnection();
}
/**
* Get the encoding selected in the dialog.
*/
public String getEncoding() {
return selectedEncoding;
}
class ValidationSelectionListener implements SelectionListener {
@Override
public void widgetSelected(SelectionEvent e) {
validateDialog();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
validateDialog();
}
}
private IDialogSettings getDialogSettings() {
IDialogSettings result = Activator.getDefault().getDialogSettings().getSection(TerminalConsoleSettingsDialog.class.getName());
if (result == null) {
result = Activator.getDefault().getDialogSettings().addNewSection(TerminalConsoleSettingsDialog.class.getName());
}
return result;
}
@Override
public int open() {
int rc = super.open();
if (rc == Window.OK) {
// save the settings
IDialogSettings settings = getDialogSettings();
IRemoteConnection connection = getRemoteConnection();
settings.put(CONNECTION_TYPE, connection.getConnectionType().getId());
settings.put(CONNECTION_NAME, connection.getName());
settings.put(ENCODING, getEncoding());
}
return rc;
}
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console.actions;
import org.eclipse.osgi.util.NLS;
public class ActionMessages extends NLS {
static {
NLS.initializeMessages(ActionMessages.class.getName(), ActionMessages.class);
}
public static String CONNECT;
public static String DISCONNECT;
public static String SCROLL_LOCK;
}

View file

@ -0,0 +1,13 @@
################################################################################
# Copyright (c) 2015 QNX Software Systems 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
#
# Contributors:
# QNX Software Systems - Initial API and implementation
################################################################################
CONNECT = Connect
DISCONNECT = Disconnect
SCROLL_LOCK = Scroll Lock

View file

@ -0,0 +1,62 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.remote.internal.console.Activator;
public abstract class ConsoleAction extends Action {
public ConsoleAction(String id) {
this(id, 0);
}
public ConsoleAction(String id, int style) {
super("", style); //$NON-NLS-1$
setId(id);
}
protected void setupAction(String text, String tooltip,
String image, String enabledImage, String disabledImage,
boolean enabled) {
ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry();
setupAction(text, tooltip, image, enabledImage, disabledImage, enabled, imageRegistry);
}
protected void setupAction(String text, String tooltip,
String hoverImage, String enabledImage, String disabledImage,
boolean enabled, ImageRegistry imageRegistry) {
setupAction(text,
tooltip,
imageRegistry.getDescriptor(hoverImage),
imageRegistry.getDescriptor(enabledImage),
imageRegistry.getDescriptor(disabledImage),
enabled);
}
protected void setupAction(String text, String tooltip,
ImageDescriptor hoverImage, ImageDescriptor enabledImage, ImageDescriptor disabledImage,
boolean enabled) {
setText(text);
setToolTipText(tooltip);
setEnabled(enabled);
if (enabledImage != null) {
setImageDescriptor(enabledImage);
}
if (disabledImage != null) {
setDisabledImageDescriptor(disabledImage);
}
if (hoverImage != null) {
setHoverImageDescriptor(hoverImage);
}
}
}

View file

@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console.actions;
import org.eclipse.remote.internal.console.ImageConsts;
import org.eclipse.remote.internal.console.TerminalConsole;
public class ConsoleActionConnect extends ConsoleAction {
private final TerminalConsole console;
public ConsoleActionConnect(TerminalConsole console) {
super(ConsoleActionConnect.class.getName());
this.console = console;
setupAction(ActionMessages.CONNECT,
ActionMessages.CONNECT,
ImageConsts.IMAGE_CLCL_CONNECT,
ImageConsts.IMAGE_ELCL_CONNECT,
ImageConsts.IMAGE_DLCL_CONNECT,
true);
}
@Override
public void run() {
console.getTerminalConnector().connect();
}
}

View file

@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console.actions;
import org.eclipse.remote.internal.console.ImageConsts;
import org.eclipse.remote.internal.console.TerminalConsole;
public class ConsoleActionDisconnect extends ConsoleAction {
private final TerminalConsole console;
public ConsoleActionDisconnect(TerminalConsole console)
{
super(ConsoleActionDisconnect.class.getName());
this.console = console;
setupAction(ActionMessages.DISCONNECT,
ActionMessages.DISCONNECT,
ImageConsts.IMAGE_CLCL_DISCONNECT,
ImageConsts.IMAGE_ELCL_DISCONNECT,
ImageConsts.IMAGE_DLCL_DISCONNECT,
false);
}
@Override
public void run() {
console.getTerminalConnector().disconnect();
}
}

View file

@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.console.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.remote.internal.console.ImageConsts;
import org.eclipse.remote.internal.console.TerminalConsolePage;
public class ConsoleActionScrollLock extends ConsoleAction {
private final TerminalConsolePage page;
public ConsoleActionScrollLock(TerminalConsolePage page)
{
super(ConsoleActionScrollLock.class.getName(), IAction.AS_RADIO_BUTTON);
this.page = page;
setupAction(ActionMessages.SCROLL_LOCK,
ActionMessages.SCROLL_LOCK,
ImageConsts.IMAGE_CLCL_SCROLL_LOCK,
ImageConsts.IMAGE_ELCL_SCROLL_LOCK,
ImageConsts.IMAGE_DLCL_SCROLL_LOCK,
true);
}
@Override
public void run() {
page.setScrollLock(!page.getScrollLock());
setChecked(page.getScrollLock());
}
}

View file

@ -0,0 +1,27 @@
package org.eclipse.remote.internal.console.actions;
import java.nio.charset.Charset;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.internal.console.TerminalConsoleFactory;
import org.eclipse.ui.handlers.HandlerUtil;
public class OpenCommandShellHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
if (selection != null && selection instanceof IStructuredSelection) {
IRemoteConnection connection = (IRemoteConnection) ((IStructuredSelection) selection).iterator().next();
TerminalConsoleFactory.openConsole(connection, Charset.defaultCharset().name());
}
return Status.OK_STATUS;
}
}

View file

@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.filesystem,
org.eclipse.core.resources,
org.eclipse.core.variables,
org.eclipse.debug.core
org.eclipse.debug.core,
org.eclipse.cdt.core.native;bundle-version="5.8.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.remote.core,
org.eclipse.remote.core.exception,

View file

@ -33,6 +33,11 @@
factory="org.eclipse.remote.internal.core.services.local.LocalProcessService$Factory"
service="org.eclipse.remote.core.IRemoteProcessService">
</connectionService>
<connectionService
connectionTypeId="org.eclipse.remote.LocalServices"
factory="org.eclipse.remote.internal.core.services.local.LocalCommandShellService$Factory"
service="org.eclipse.remote.core.IRemoteCommandShellService">
</connectionService>
<processService
connectionTypeId="org.eclipse.remote.LocalServices"
factory="org.eclipse.remote.internal.core.services.local.LocalProcess$Factory"
@ -43,6 +48,11 @@
factory="org.eclipse.remote.internal.core.services.local.LocalProcess$Factory"
service="org.eclipse.remote.internal.core.services.local.LocalProcess">
</processService>
<processService
connectionTypeId="org.eclipse.remote.LocalServices"
factory="org.eclipse.remote.internal.core.services.local.LocalProcess$Factory"
service="org.eclipse.remote.core.IRemoteProcessTerminalService">
</processService>
</extension>
<extension
point="org.eclipse.core.runtime.adapters">

View file

@ -60,12 +60,14 @@ public class RemoteConnectionType implements IRemoteConnectionType {
}
// load up existing connections
try {
for (String connectionName : getPreferenceNode().childrenNames()) {
connections.put(connectionName, new RemoteConnection(this, connectionName));
synchronized (connections) {
try {
for (String connectionName : getPreferenceNode().childrenNames()) {
connections.put(connectionName, new RemoteConnection(this, connectionName));
}
} catch (BackingStoreException e) {
RemoteCorePlugin.log(e);
}
} catch (BackingStoreException e) {
RemoteCorePlugin.log(e);
}
}
@ -284,23 +286,27 @@ public class RemoteConnectionType implements IRemoteConnectionType {
*/
@Override
public IRemoteConnection getConnection(String name) {
return connections.get(name);
synchronized (connections) {
return connections.get(name);
}
}
@Override
public IRemoteConnection getConnection(URI uri) {
IRemoteConnection connection = connections.get(uri.getAuthority());
if (connection != null) {
return connection;
synchronized (connections) {
IRemoteConnection connection = connections.get(uri.getAuthority());
if (connection != null) {
return connection;
}
// If it's a file: scheme we must be the local connection type, just return our
// hopefully one connection, the Local connection.
if (uri.getScheme().equals("file") && !connections.isEmpty()) { //$NON-NLS-1$
return connections.values().iterator().next();
}
return null;
}
// If it's a file: scheme we must be the local connection type, just return our
// hopefully one connection, the Local connection.
if (uri.getScheme().equals("file") && !connections.isEmpty()) { //$NON-NLS-1$
return connections.values().iterator().next();
}
return null;
}
/*
@ -310,7 +316,9 @@ public class RemoteConnectionType implements IRemoteConnectionType {
*/
@Override
public List<IRemoteConnection> getConnections() {
return new ArrayList<IRemoteConnection>(connections.values());
synchronized (connections) {
return new ArrayList<IRemoteConnection>(connections.values());
}
}
/*
@ -320,18 +328,24 @@ public class RemoteConnectionType implements IRemoteConnectionType {
*/
@Override
public IRemoteConnectionWorkingCopy newConnection(String name) throws RemoteConnectionException {
if (connections.containsKey(name)) {
throw new ConnectionExistsException(name);
synchronized (connections) {
if (connections.containsKey(name)) {
throw new ConnectionExistsException(name);
}
return new RemoteConnectionWorkingCopy(this, name);
}
return new RemoteConnectionWorkingCopy(this, name);
}
void addConnection(RemoteConnection remoteConnection) {
connections.put(remoteConnection.getName(), remoteConnection);
synchronized (connections) {
connections.put(remoteConnection.getName(), remoteConnection);
}
}
void removeConnection(String name) {
connections.remove(name);
synchronized (connections) {
connections.remove(name);
}
}
/*
@ -341,19 +355,21 @@ public class RemoteConnectionType implements IRemoteConnectionType {
*/
@Override
public void removeConnection(IRemoteConnection connection) throws RemoteConnectionException {
if (connection instanceof RemoteConnection) {
connection.close();
RemoteConnection conn = (RemoteConnection) connection;
try {
conn.getPreferences().removeNode();
} catch (BackingStoreException e) {
throw new RemoteConnectionException(e);
synchronized (connections) {
if (connection instanceof RemoteConnection) {
connection.close();
RemoteConnection conn = (RemoteConnection) connection;
try {
conn.getPreferences().removeNode();
} catch (BackingStoreException e) {
throw new RemoteConnectionException(e);
}
conn.getSecurePreferences().removeNode();
connections.remove(conn.getName());
connection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_REMOVED);
} else {
RemoteCorePlugin.log("Wrong class for " + connection.getName() + ", was " + connection.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
}
conn.getSecurePreferences().removeNode();
connections.remove(conn.getName());
connection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_REMOVED);
} else {
RemoteCorePlugin.log("Wrong class for " + connection.getName() + ", was " + connection.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
}
}

View file

@ -0,0 +1,66 @@
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems 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
*
* Contributors:
* QNX - initial API and implementation
*******************************************************************************/
package org.eclipse.remote.internal.core.services.local;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.runtime.Platform;
import org.eclipse.remote.core.IRemoteCommandShellService;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnection.Service;
import org.eclipse.remote.core.IRemoteProcess;
import org.eclipse.remote.core.IRemoteProcessBuilder;
import org.eclipse.remote.core.IRemoteProcessService;
public class LocalCommandShellService implements IRemoteCommandShellService {
private final IRemoteConnection connection;
public LocalCommandShellService(IRemoteConnection connection) {
this.connection = connection;
}
public static class Factory implements IRemoteCommandShellService.Factory {
@SuppressWarnings("unchecked")
@Override
public <T extends Service> T getService(IRemoteConnection remoteConnection, Class<T> service) {
if (service.equals(IRemoteCommandShellService.class)) {
return (T) new LocalCommandShellService(remoteConnection);
}
return null;
}
}
@Override
public IRemoteConnection getRemoteConnection() {
return connection;
}
@SuppressWarnings("nls")
@Override
public IRemoteProcess getCommandShell(int flags) throws IOException {
IRemoteProcessService procService = connection.getService(IRemoteProcessService.class);
String[] command;
if (Platform.getOS().equals(Platform.OS_WIN32)) {
command = new String[] { "cmd" };
} else {
List<String> list = new ArrayList<>(Arrays.asList(System.getenv("SHELL").split("\\s+")));
list.add("-l");
command = list.toArray(new String[list.size()]);
}
IRemoteProcessBuilder builder = procService.getProcessBuilder(command);
return builder.start(IRemoteProcessBuilder.ALLOCATE_PTY);
}
}

View file

@ -16,14 +16,18 @@ import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.remote.core.IRemoteProcess;
import org.eclipse.remote.core.IRemoteProcessControlService;
import org.eclipse.remote.core.IRemoteProcessTerminalService;
public class LocalProcess implements IRemoteProcessControlService {
public class LocalProcess implements IRemoteProcessControlService, IRemoteProcessTerminalService {
private static int refCount = 0;
private final IRemoteProcess remoteProcess;
private final Process localProcess;
private final PTY pty;
private int width, height;
private InputStream procStdout;
private InputStream procStderr;
private Thread stdoutReader;
@ -52,6 +56,9 @@ public class LocalProcess implements IRemoteProcessControlService {
if (IRemoteProcessControlService.class.equals(service)) {
return (T) remoteProcess.getService(LocalProcess.class);
}
if (IRemoteProcessTerminalService.class.equals(service)) {
return (T) remoteProcess.getService(LocalProcess.class);
}
return null;
}
}
@ -113,7 +120,9 @@ public class LocalProcess implements IRemoteProcessControlService {
public LocalProcess(IRemoteProcess process) {
remoteProcess = process;
localProcess = ((LocalProcessBuilder) process.getProcessBuilder()).getProcess();
LocalProcessBuilder builder = (LocalProcessBuilder) process.getProcessBuilder();
localProcess = builder.getProcess();
pty = builder.getPty();
try {
if (process.getProcessBuilder().redirectErrorStream()) {
@ -226,4 +235,13 @@ public class LocalProcess implements IRemoteProcessControlService {
public IRemoteProcess getRemoteProcess() {
return remoteProcess;
}
@Override
public void setTerminalSize(int cols, int rows, int pwidth, int pheight) {
if (pty != null && (width != cols || height != rows)) {
width = cols;
height = rows;
pty.setTerminalSize(width, height);
}
}
}

View file

@ -18,6 +18,9 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.cdt.utils.pty.PTY.Mode;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.runtime.CoreException;
@ -32,6 +35,7 @@ import org.eclipse.remote.core.AbstractRemoteProcessBuilder;
import org.eclipse.remote.core.IProcessFactory;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteProcess;
import org.eclipse.remote.core.IRemoteProcessBuilder;
import org.eclipse.remote.internal.core.RemoteCorePlugin;
import org.eclipse.remote.internal.core.RemoteProcess;
@ -43,6 +47,7 @@ public class LocalProcessBuilder extends AbstractRemoteProcessBuilder {
private final Map<String, String> fRemoteEnv = new HashMap<String, String>();
private Process localProcess;
private PTY pty;
public LocalProcessBuilder(IRemoteConnection connection, List<String> command) {
super(connection, command);
@ -103,20 +108,31 @@ public class LocalProcessBuilder extends AbstractRemoteProcessBuilder {
@Override
public IRemoteProcess start(int flags) throws IOException {
String commandArray[] = command().toArray(new String[0]);
if ((flags & IRemoteProcessBuilder.ALLOCATE_PTY) != 0) {
environment().put("TERM", "vt100"); //$NON-NLS-1$ //$NON-NLS-2$
}
String environmentArray[] = new String[environment().size()];
int index = 0;
for (Entry<String, String> entry : environment().entrySet()) {
environmentArray[index++] = entry.getKey() + "=" + entry.getValue(); //$NON-NLS-1$
}
if (directory() != null) {
try {
localProcess = fProcessFactory.exec(commandArray, environmentArray,
directory().toLocalFile(EFS.NONE, new NullProgressMonitor()));
} catch (CoreException e) {
throw new IOException(e.getMessage());
try {
if ((flags & IRemoteProcessBuilder.ALLOCATE_PTY) != 0) {
pty = new PTY(Mode.TERMINAL);
File dir = directory() != null ? directory().toLocalFile(EFS.NONE, new NullProgressMonitor()) : null;
localProcess = ProcessFactory.getFactory().exec(commandArray, environmentArray, dir, pty);
} else {
if (directory() != null) {
localProcess = fProcessFactory.exec(commandArray, environmentArray,
directory().toLocalFile(EFS.NONE, new NullProgressMonitor()));
} else {
localProcess = fProcessFactory.exec(commandArray, environmentArray);
}
}
} else {
localProcess = fProcessFactory.exec(commandArray, environmentArray);
} catch (CoreException e) {
throw new IOException(e.getMessage());
}
return new RemoteProcess(getRemoteConnection(), this);
}
@ -125,6 +141,10 @@ public class LocalProcessBuilder extends AbstractRemoteProcessBuilder {
return localProcess;
}
public PTY getPty() {
return pty;
}
private IProcessFactory getProcessFactory() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint(RemoteCorePlugin.getUniqueIdentifier(), EXTENSION_POINT_ID);

View file

@ -46,6 +46,7 @@ public class JSchProcessBuilder extends AbstractRemoteProcessBuilder {
private Channel fChannel;
private Map<String, String> fNewRemoteEnv;
private boolean fPreamble = true;
private boolean fShell = false;
public JSchProcessBuilder(IRemoteConnection connection, List<String> command) {
super(connection, command);
@ -67,7 +68,8 @@ public class JSchProcessBuilder extends AbstractRemoteProcessBuilder {
}
public JSchProcessBuilder(IRemoteConnection connection) {
this(connection, "shell"); //$NON-NLS-1$
this(connection, new ArrayList<String>());
fShell = true;
}
@Override
@ -102,7 +104,7 @@ public class JSchProcessBuilder extends AbstractRemoteProcessBuilder {
}
List<String> cmdArgs = command();
if (cmdArgs.size() < 1) {
if (cmdArgs.size() < 1 && !fShell) {
throw new IndexOutOfBoundsException();
}
@ -161,10 +163,11 @@ public class JSchProcessBuilder extends AbstractRemoteProcessBuilder {
}
try {
if (cmdArgs.size() == 1 && cmdArgs.get(0).equals("shell")) { //$NON-NLS-1$
if (fShell) {
fChannel = fConnection.getShellChannel();
((ChannelShell) fChannel).setPty((flags & ALLOCATE_PTY) == ALLOCATE_PTY);
RemoteDebugOptions.trace(RemoteDebugOptions.DEBUG_REMOTE_COMMANDS, "executing command: shell"); //$NON-NLS-1$
((ChannelShell) fChannel).setPtyType("vt100"); //$NON-NLS-1$
RemoteDebugOptions.trace(RemoteDebugOptions.DEBUG_REMOTE_COMMANDS, "executing shell"); //$NON-NLS-1$
} else {
fChannel = fConnection.getExecChannel();
String command = buildCommand(remoteCmd, env, clearEnv);

View file

@ -16,5 +16,4 @@ ConnectionsView.name=Connections
ConnectionsContent.name=Connections
NewConnectionCommand.name=New Connection
DeleteConnectionCommand.name=Delete Connection
OpenTerminalCommand.name=Open Terminal
ConnectionProperties.name=Connection

View file

@ -121,11 +121,6 @@
id="org.eclipse.remote.ui.command.deleteConnection"
name="%DeleteConnectionCommand.name">
</command>
<command
defaultHandler="org.eclipse.remote.internal.ui.views.OpenTerminalHandler"
id="org.eclipse.remote.ui.command.openTerminal"
name="%OpenTerminalCommand.name">
</command>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
@ -168,23 +163,6 @@
</with>
</visibleWhen>
</command>
<command
commandId="org.eclipse.remote.ui.command.openTerminal"
label="%OpenTerminalCommand.name"
style="push">
<visibleWhen
checkEnabled="false">
<with
variable="selection">
<iterate>
<test
args="org.eclipse.remote.core.IRemoteCommandShellService"
property="org.eclipse.remote.ui.hasConnectionService">
</test>
</iterate>
</with>
</visibleWhen>
</command>
</menuContribution>
</extension>
<extension

View file

@ -1,24 +0,0 @@
package org.eclipse.remote.internal.ui.views;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.remote.internal.ui.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
public class OpenTerminalHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// TODO Need to figure out how to open a terminal for this connection
Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
MessageDialog.open(MessageDialog.INFORMATION, parent,
Messages.OpenTerminalHandler_OpenTerminalTitle, Messages.OpenTerminalHandler_OpenTerminalDesc, SWT.NONE);
return Status.OK_STATUS;
}
}

View file

@ -488,6 +488,7 @@ public class RemoteConnectionWidget extends Composite {
fConnectionCombo.select(0);
fConnectionCombo.setEnabled(false);
fNewConnectionButton.setEnabled(false);
handleConnectionSelected();
} else {
fConnectionCombo.setEnabled(true);

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.remote.console-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,4 @@
bin.includes = feature.xml,\
feature.properties,\
epl-v10.html,\
eclipse_update_120.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -0,0 +1,328 @@
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List
href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
<title>Eclipse Public License - Version 1.0</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Revision>2</o:Revision>
<o:TotalTime>3</o:TotalTime>
<o:Created>2004-03-05T23:03:00Z</o:Created>
<o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
<o:Pages>4</o:Pages>
<o:Words>1626</o:Words>
<o:Characters>9270</o:Characters>
<o:Lines>77</o:Lines>
<o:Paragraphs>18</o:Paragraphs>
<o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
<o:Version>9.4402</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:TrackRevisions/>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:553679495 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p
{margin-right:0in;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p.BalloonText, li.BalloonText, div.BalloonText
{mso-style-name:"Balloon Text";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:8.0pt;
font-family:Tahoma;
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US style='tab-interval:.5in'>
<div class=Section1>
<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
</p>
<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
OF THIS AGREEMENT.</span> </p>
<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
in the case of the initial Contributor, the initial code and documentation
distributed under this Agreement, and<br clear=left>
b) in the case of each subsequent Contributor:</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
changes to the Program, and</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
additions to the Program;</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
such changes and/or additions to the Program originate from and are distributed
by that particular Contributor. A Contribution 'originates' from a Contributor
if it was added to the Program by such Contributor itself or anyone acting on
such Contributor's behalf. Contributions do not include additions to the
Program which: (i) are separate modules of software distributed in conjunction
with the Program under their own license agreement, and (ii) are not derivative
works of the Program. </span></p>
<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
entity that distributes the Program.</span> </p>
<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
claims licensable by a Contributor which are necessarily infringed by the use
or sale of its Contribution alone or when combined with the Program. </span></p>
<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
distributed in accordance with this Agreement.</span> </p>
<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
receives the Program under this Agreement, including all Contributors.</span> </p>
<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
Subject to the terms of this Agreement, each Contributor hereby grants Recipient
a non-exclusive, worldwide, royalty-free copyright license to<span
style='color:red'> </span>reproduce, prepare derivative works of, publicly
display, publicly perform, distribute and sublicense the Contribution of such
Contributor, if any, and such derivative works, in source code and object code
form.</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
patent license under Licensed Patents to make, use, sell, offer to sell, import
and otherwise transfer the Contribution of such Contributor, if any, in source
code and object code form. This patent license shall apply to the combination
of the Contribution and the Program if, at the time the Contribution is added
by the Contributor, such addition of the Contribution causes such combination
to be covered by the Licensed Patents. The patent license shall not apply to
any other combinations which include the Contribution. No hardware per se is
licensed hereunder. </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
Recipient understands that although each Contributor grants the licenses to its
Contributions set forth herein, no assurances are provided by any Contributor
that the Program does not infringe the patent or other intellectual property
rights of any other entity. Each Contributor disclaims any liability to Recipient
for claims brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the rights and
licenses granted hereunder, each Recipient hereby assumes sole responsibility
to secure any other intellectual property rights needed, if any. For example,
if a third party patent license is required to allow Recipient to distribute
the Program, it is Recipient's responsibility to acquire that license before
distributing the Program.</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
Each Contributor represents that to its knowledge it has sufficient copyright
rights in its Contribution, if any, to grant the copyright license set forth in
this Agreement. </span></p>
<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
Program in object code form under its own license agreement, provided that:</span>
</p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
it complies with the terms and conditions of this Agreement; and</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
its license agreement:</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
effectively disclaims on behalf of all Contributors all warranties and
conditions, express and implied, including warranties or conditions of title
and non-infringement, and implied warranties or conditions of merchantability
and fitness for a particular purpose; </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
effectively excludes on behalf of all Contributors all liability for damages,
including direct, indirect, special, incidental and consequential damages, such
as lost profits; </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
states that any provisions which differ from this Agreement are offered by that
Contributor alone and not by any other party; and</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
states that source code for the Program is available from such Contributor, and
informs licensees how to obtain it in a reasonable manner on or through a
medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
<p><span style='font-size:10.0pt'>When the Program is made available in source
code form:</span> </p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
it must be made available under this Agreement; and </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
copy of this Agreement must be included with each copy of the Program. </span></p>
<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
copyright notices contained within the Program. </span></p>
<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
originator of its Contribution, if any, in a manner that reasonably allows
subsequent Recipients to identify the originator of the Contribution. </span></p>
<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
<p><span style='font-size:10.0pt'>Commercial distributors of software may
accept certain responsibilities with respect to end users, business partners
and the like. While this license is intended to facilitate the commercial use
of the Program, the Contributor who includes the Program in a commercial
product offering should do so in a manner which does not create potential
liability for other Contributors. Therefore, if a Contributor includes the
Program in a commercial product offering, such Contributor (&quot;Commercial
Contributor&quot;) hereby agrees to defend and indemnify every other
Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
legal actions brought by a third party against the Indemnified Contributor to
the extent caused by the acts or omissions of such Commercial Contributor in
connection with its distribution of the Program in a commercial product
offering. The obligations in this section do not apply to any claims or Losses
relating to any actual or alleged intellectual property infringement. In order
to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
Contributor in writing of such claim, and b) allow the Commercial Contributor
to control, and cooperate with the Commercial Contributor in, the defense and
any related settlement negotiations. The Indemnified Contributor may participate
in any such claim at its own expense.</span> </p>
<p><span style='font-size:10.0pt'>For example, a Contributor might include the
Program in a commercial product offering, Product X. That Contributor is then a
Commercial Contributor. If that Commercial Contributor then makes performance
claims, or offers warranties related to Product X, those performance claims and
warranties are such Commercial Contributor's responsibility alone. Under this
section, the Commercial Contributor would have to defend claims against the
other Contributors related to those performance claims and warranties, and if a
court requires any other Contributor to pay any damages as a result, the
Commercial Contributor must pay those damages.</span> </p>
<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
responsible for determining the appropriateness of using and distributing the
Program and assumes all risks associated with its exercise of rights under this
Agreement , including but not limited to the risks and costs of program errors,
compliance with applicable laws, damage to or loss of data, programs or
equipment, and unavailability or interruption of operations. </span></p>
<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
or unenforceable under applicable law, it shall not affect the validity or
enforceability of the remainder of the terms of this Agreement, and without
further action by the parties hereto, such provision shall be reformed to the
minimum extent necessary to make such provision valid and enforceable.</span> </p>
<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
against any entity (including a cross-claim or counterclaim in a lawsuit)
alleging that the Program itself (excluding combinations of the Program with
other software or hardware) infringes such Recipient's patent(s), then such
Recipient's rights granted under Section 2(b) shall terminate as of the date
such litigation is filed. </span></p>
<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
shall terminate if it fails to comply with any of the material terms or
conditions of this Agreement and does not cure such failure in a reasonable
period of time after becoming aware of such noncompliance. If all Recipient's
rights under this Agreement terminate, Recipient agrees to cease use and
distribution of the Program as soon as reasonably practicable. However,
Recipient's obligations under this Agreement and any licenses granted by
Recipient relating to the Program shall continue and survive. </span></p>
<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
copies of this Agreement, but in order to avoid inconsistency the Agreement is
copyrighted and may only be modified in the following manner. The Agreement
Steward reserves the right to publish new versions (including revisions) of
this Agreement from time to time. No one other than the Agreement Steward has
the right to modify this Agreement. The Eclipse Foundation is the initial
Agreement Steward. The Eclipse Foundation may assign the responsibility to
serve as the Agreement Steward to a suitable separate entity. Each new version
of the Agreement will be given a distinguishing version number. The Program
(including Contributions) may always be distributed subject to the version of
the Agreement under which it was received. In addition, after a new version of
the Agreement is published, Contributor may elect to distribute the Program
(including its Contributions) under the new version. Except as expressly stated
in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
the intellectual property of any Contributor under this Agreement, whether
expressly, by implication, estoppel or otherwise. All rights in the Program not
expressly granted under this Agreement are reserved.</span> </p>
<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
State of New York and the intellectual property laws of the United States of
America. No party to this Agreement will bring a legal action under this
Agreement more than one year after the cause of action arose. Each party waives
its rights to a jury trial in any resulting litigation.</span> </p>
<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</div>
</body>
</html>

View file

@ -0,0 +1,24 @@
#################################################################################
# Copyright (c) 2015 QNX Software Systems Corporation.
# 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
#################################################################################
# "featureName" property - name of the feature
featureName=Remote Command Shell Console
# "providerName" property - name of the company that provides the feature
providerName=Eclipse PTP
# "description" property - description of the feature
description=Provides serial port services for the remote framework
# copyright
copyright=\
Copyright (c) 2015 QNX Software Corporation.\n\
All rights reserved. This program and the accompanying materials\n\
are made available under the terms of the Eclipse Public License v1.0\n\
which accompanies this distribution, and is available at\n\
http://www.eclipse.org/legal/epl-v10.html\n

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.eclipse.remote.console"
label="%featureName"
version="1.0.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
<description>
%description
</description>
<copyright>
%copyright
</copyright>
<license url="%licenseURL">
%license
</license>
<plugin
id="org.eclipse.remote.console"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.remote</groupId>
<artifactId>remote-parent</artifactId>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../releng/org.eclipse.remote.build/pom.xml</relativePath>
</parent>
<groupId>org.eclipse.remote.features</groupId>
<artifactId>org.eclipse.remote.console</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-source-feature-plugin</artifactId>
<executions>
<execution>
<id>source-feature</id>
<phase>package</phase>
<goals>
<goal>source-feature</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>attached-p2-metadata</id>
<phase>package</phase>
<goals>
<goal>p2-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -15,6 +15,9 @@
<unit id="org.eclipse.cdt.native.serial" version="0.0.0"/>
<repository location="http://download.eclipse.org/tools/cdt/builds/master/nightly/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.tm.terminal.control" version="0.0.0"/>
<repository location="http://download.eclipse.org/tm/terminal/builds/development/nightly/"/>
</location>
</locations>
</target>

View file

@ -23,7 +23,7 @@
<platform-version>4.5milestones</platform-version>
<platform-site>http://download.eclipse.org/eclipse/updates/${platform-version}/</platform-site>
<license-site>http://download.eclipse.org/cbi/updates/license/</license-site>
<tm-site>http://download.eclipse.org/tm/updates/4.0milestones/</tm-site>
<tm-site>http://download.eclipse.org/tm/terminal/builds/development/nightly/</tm-site>
<cdt-site>http://download.eclipse.org/tools/cdt/builds/master/nightly/</cdt-site>
<remote-install-dir>/home/data/httpd/download.eclipse.org/tools/ptp/builds/remote/${remote-release}</remote-install-dir>
</properties>
@ -50,9 +50,12 @@
<module>../../bundles/org.eclipse.remote.ui</module>
<module>../../features/org.eclipse.remote-feature</module>
<module>../../releng/org.eclipse.remote.repo</module>
<!-- Remote Terminal feature -->
<!-- Remote Terminal feature
<module>../../bundles/org.eclipse.remote.terminal</module>
<module>../../features/org.eclipse.remote.terminal-feature</module>
<module>../../features/org.eclipse.remote.terminal-feature</module> -->
<!-- Console Terminal feature -->
<module>../../bundles/org.eclipse.remote.console</module>
<module>../../features/org.eclipse.remote.console-feature</module>
<!-- Serial Port feature -->
<module>../../bundles/org.eclipse.remote.serial.core</module>
<module>../../bundles/org.eclipse.remote.serial.ui</module>

View file

@ -6,10 +6,22 @@
<feature url="features/org.eclipse.remote.source_0.0.0.jar" id="org.eclipse.remote.source" version="0.0.0">
<category name="Remote Services SDK"/>
</feature>
<feature url="features/org.eclipse.remote.terminal_0.0.0.jar" id="org.eclipse.remote.terminal" version="0.0.0">
<feature url="features/org.eclipse.remote.serial_0.0.0.jar" id="org.eclipse.remote.serial" version="0.0.0">
<category name="Remote Serial Port"/>
</feature>
<feature url="features/org.eclipse.remote.serial.source_0.0.0.jar" id="org.eclipse.remote.serial.source" version="0.0.0">
<category name="Remote Console SDK"/>
</feature>
<!--feature url="features/org.eclipse.remote.terminal_0.0.0.jar" id="org.eclipse.remote.terminal" version="0.0.0">
<category name="Remote Terminal"/>
</feature>
<feature url="features/org.eclipse.remote.terminal.source_0.0.0.jar" id="org.eclipse.remote.terminal.source" version="0.0.0">
<category name="Remote Terminal SDK"/>
</feature-->
<feature url="features/org.eclipse.remote.console_0.0.0.jar" id="org.eclipse.remote.console" version="0.0.0">
<category name="Remote Console"/>
</feature>
<feature url="features/org.eclipse.remote.console.source_0.0.0.jar" id="org.eclipse.remote.console.source" version="0.0.0">
<category name="Remote Console SDK"/>
</feature>
</site>