properties, Done done);
+
+ /**
+ * Register the given listener to receive notifications about terminal events.
+ * Calling this method multiple times with the same listener has no effect.
+
+ * @param listener The terminal tab listener. Must not be null
.
+ */
+ public void addTerminalTabListener(ITerminalTabListener listener);
+
+ /**
+ * Unregister the given listener from receiving notifications about terminal
+ * events. Calling this method multiple times with the same listener
+ * has no effect.
+ *
+ * @param listener The terminal tab listener. Must not be null
.
+ */
+ public void removeTerminalTabListener(ITerminalTabListener listener);
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalServiceOutputStreamMonitorListener.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalServiceOutputStreamMonitorListener.java
new file mode 100644
index 00000000000..dda3704b018
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalServiceOutputStreamMonitorListener.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2014 - 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.interfaces;
+
+/**
+ * An interface to be implemented by listeners who want to listen
+ * to the streams data without interfering with the original data receiver.
+ *
+ * Listeners are invoked within the monitor processing thread.
+ */
+public interface ITerminalServiceOutputStreamMonitorListener {
+
+ /**
+ * Signals that some content has been read from the monitored stream.
+ *
+ * @param byteBuffer The byte stream. Must not be null
.
+ * @param bytesRead The number of bytes that were read into the read buffer.
+ */
+ public void onContentReadFromStream(byte[] byteBuffer, int bytesRead);
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalTabListener.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalTabListener.java
new file mode 100644
index 00000000000..77e3e04eb13
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalTabListener.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.interfaces;
+
+/**
+ * Listener to implement and to register to get notified about
+ * terminal tabs events, like the disposal of a terminal tab.
+ */
+public interface ITerminalTabListener {
+
+ /**
+ * Invoked once a terminal tab got disposed. The source object is
+ * the disposed tab item and data is the custom data object associated
+ * with the disposed tab item.
+ *
+ * @param source The disposed tab item. Must not be null
.
+ * @param data The custom data object associated with the disposed tab item or null
.
+ */
+ public void terminalTabDisposed(Object source, Object data);
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/IContextPropertiesConstants.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/IContextPropertiesConstants.java
new file mode 100644
index 00000000000..b2e98aacd39
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/IContextPropertiesConstants.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.interfaces.constants;
+
+/**
+ * Defines the terminal context properties constants.
+ */
+public interface IContextPropertiesConstants {
+
+ /**
+ * Target name.
+ *
+ * The target name is not meant to be identical with the targets network name. It can
+ * be the targets network name, but it can be any other string identifying the target
+ * to the user as well. The name is for display only, it is not meant to be used for
+ * communicating with the target.
+ */
+ public static String PROP_NAME = "name"; //$NON-NLS-1$
+
+ /**
+ * Target agent address.
+ *
+ * The value is typically the address an agent running at the target.
+ */
+ public static String PROP_ADDRESS = "address"; //$NON-NLS-1$
+
+ /**
+ * Target agent port.
+ *
+ * The value is typically the port an agent running at the target.
+ */
+ public static String PROP_PORT = "port"; //$NON-NLS-1$
+
+ /**
+ * The default user name to use to log into the target.
+ */
+ public static String PROP_DEFAULT_USER = "defaultUser"; //$NON-NLS-1$
+
+ /**
+ * The default encoding to use.
+ */
+ public static String PROP_DEFAULT_ENCODING = "defaultEncoding"; //$NON-NLS-1$
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ILineSeparatorConstants.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ILineSeparatorConstants.java
new file mode 100644
index 00000000000..8fea4b82df7
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ILineSeparatorConstants.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2011 - 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.interfaces.constants;
+
+/**
+ * Line separator constants.
+ *
+ * Copied from org.eclipse.tcf.internal.terminal.local.ILocalTerminalSettings
.
+ */
+public interface ILineSeparatorConstants {
+
+ /**
+ * The line separator setting CR (carriage return only; for example, used by Mac OS 9).
+ */
+ public final static String LINE_SEPARATOR_CR = "\\r"; //$NON-NLS-1$
+
+ /**
+ * The line separator setting CRLF (carriage return and line feed; for example, used by
+ * Windows).
+ */
+ public final static String LINE_SEPARATOR_CRLF = "\\r\\n"; //$NON-NLS-1$
+
+ /**
+ * The line separator setting LF (line feed only; used by all UNIX-based systems).
+ */
+ public final static String LINE_SEPARATOR_LF = "\\n"; //$NON-NLS-1$
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ITerminalsConnectorConstants.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ITerminalsConnectorConstants.java
new file mode 100644
index 00000000000..fe7b65295b5
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ITerminalsConnectorConstants.java
@@ -0,0 +1,322 @@
+/*******************************************************************************
+ * Copyright (c) 2011 - 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.interfaces.constants;
+
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
+
+
+/**
+ * Defines the terminals connector constants.
+ */
+public interface ITerminalsConnectorConstants {
+
+ /**
+ * Property: The unique id of the terminals view to open.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_ID = "id"; //$NON-NLS-1$
+
+ /**
+ * Property: The unique secondary id of the terminals view to open.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_SECONDARY_ID = "secondaryId"; //$NON-NLS-1$
+
+ /**
+ * Property: The title of the terminal tab to open.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_TITLE = "title"; //$NON-NLS-1$
+
+ /**
+ * Property: The encoding of the terminal tab to open.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_ENCODING = "encoding"; //$NON-NLS-1$
+
+ /**
+ * Property: Custom data object to associate with the terminal tab.
+ *
+ * Property Type: {@link Object}
+ */
+ public static final String PROP_DATA = "data"; //$NON-NLS-1$
+
+ /**
+ * Property: External selection to associate with the terminal tab.
+ *
+ * Property Type: {@link org.eclipse.jface.viewers.ISelection}
+ */
+ public static final String PROP_SELECTION = "selection"; //$NON-NLS-1$
+
+ /**
+ * Property: Flag to force a new terminal tab.
+ *
+ * Property Type: {@link Boolean}
+ */
+ public static final String PROP_FORCE_NEW = "terminal.forceNew"; //$NON-NLS-1$
+
+ /**
+ * Property: Terminals launcher delegate id.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_DELEGATE_ID = "delegateId"; //$NON-NLS-1$
+
+ /**
+ * Property: Specific terminal connector type id. Allows clients to
+ * override the specifically used terminal connector
+ * implementation for a given type.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_TERMINAL_CONNECTOR_ID = "tm.terminal.connector.id"; //$NON-NLS-1$
+
+ // ***** Generic terminals connector properties *****
+
+ /**
+ * Property: Timeout to be passed to the terminal connector. The specific terminal
+ * connector implementation may interpret this value differently. If not
+ * set, the terminal connector may use a default value.
+ *
+ * Property Type: {@link Integer}
+ */
+ public static final String PROP_TIMEOUT = "timeout"; //$NON-NLS-1$
+
+ /**
+ * Property: Flag to control if a local echo is needed from the terminal widget.
+ *
Typical for process and streams terminals.
+ *
+ * Property Type: {@link Boolean}
+ */
+ public static final String PROP_LOCAL_ECHO = "localEcho"; //$NON-NLS-1$
+
+ /**
+ * Property: Data flag to tell the terminal to not reconnect when hitting enter
+ * in a disconnected terminal.
+ *
+ * Property Type: {@link Boolean}
+ */
+ public static final String PROP_DATA_NO_RECONNECT = "data.noReconnect"; //$NON-NLS-1$
+
+ /**
+ * Property: The line separator expected by the remote terminal on input streams and
+ * send by the remote terminal on output streams.
+ *
Typical for process and streams terminals.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_LINE_SEPARATOR = "lineSeparator"; //$NON-NLS-1$
+
+ /**
+ * Property: The list of stdout listeners to attach to the corresponding stream monitor.
+ *
Typical for process and streams terminals.
+ *
+ * Property Type: {@link ITerminalServiceOutputStreamMonitorListener} array
+ */
+ public static final String PROP_STDOUT_LISTENERS = "stdoutListeners"; //$NON-NLS-1$
+
+ /**
+ * Property: The list of stderr listeners to attach to the corresponding stream monitor.
+ *
Typical for process and streams terminals.
+ *
+ * Property Type: {@link ITerminalServiceOutputStreamMonitorListener} array
+ */
+ public static final String PROP_STDERR_LISTENERS = "stderrListeners"; //$NON-NLS-1$
+
+ /**
+ * Property: If set to true
, backslashes are translated to
+ * slashes before pasting the text to the terminal widget.
+ *
+ * Property Type: {@link Boolean}
+ */
+ public static final String PROP_TRANSLATE_BACKSLASHES_ON_PASTE = "translateBackslashesOnPaste"; //$NON-NLS-1$
+
+ // ***** IP based terminals connector properties *****
+
+ /**
+ * Property: Host name or IP address the terminal server is running.
+ *
Typical for telnet or ssh terminals.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_IP_HOST = "ip.host"; //$NON-NLS-1$
+
+ /**
+ * Property: Port at which the terminal server is providing the console input and output.
+ *
Typical for telnet or ssh terminals.
+ *
+ * Property Type: {@link Integer}
+ */
+ public static final String PROP_IP_PORT = "ip.port"; //$NON-NLS-1$
+
+ /**
+ * Property: An offset to add to the specified port number.
+ *
Typical for telnet or ssh terminals.
+ *
+ * Property Type: {@link Integer}
+ */
+ public static final String PROP_IP_PORT_OFFSET = "ip.port.offset"; //$NON-NLS-1$
+
+ // ***** Process based terminals connector properties *****
+
+ /**
+ * Property: Process image path.
+ *
Typical for process terminals.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_PROCESS_PATH = "process.path"; //$NON-NLS-1$
+
+ /**
+ * Property: Process arguments.
+ *
Typical for process terminals.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_PROCESS_ARGS = "process.args"; //$NON-NLS-1$
+
+ /**
+ * Property: Process arguments.
+ *
Typical for process terminals.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_PROCESS_WORKING_DIR = "process.working_dir"; //$NON-NLS-1$
+
+ /**
+ * Property: Process environment.
+ *
Typical for process terminals.
+ *
+ * Property Type: {@link String} array
+ */
+ public static final String PROP_PROCESS_ENVIRONMENT = "process.environment"; //$NON-NLS-1$
+
+ /**
+ * Property: Flag to merge process environment with native environment.
+ *
Typical for process terminals.
+ *
+ * Property Type: {@link Boolean}
+ */
+ public static final String PROP_PROCESS_MERGE_ENVIRONMENT = "process.environment.merge"; //$NON-NLS-1$
+
+ /**
+ * Property: Runtime process instance.
+ *
Typical for process terminals.
+ *
+ * Property Type: {@link Process}
+ */
+ public static final String PROP_PROCESS_OBJ = "process"; //$NON-NLS-1$
+
+ /**
+ * Property: Runtime process PTY instance.
+ *
Typical for process terminals.
+ *
+ * Property Type: {@link org.eclipse.cdt.utils.pty.PTY}
+ */
+ public static final String PROP_PTY_OBJ = "pty"; //$NON-NLS-1$
+
+ // ***** Streams based terminals connector properties *****
+
+ /**
+ * Property: Stdin streams instance.
+ *
Typical for streams terminals.
+ *
+ * Property Type: {@link OutputStream}
+ */
+ public static final String PROP_STREAMS_STDIN = "streams.stdin"; //$NON-NLS-1$
+
+ /**
+ * Property: Stdout streams instance.
+ *
Typical for streams terminals.
+ *
+ * Property Type: {@link InputStream}
+ */
+ public static final String PROP_STREAMS_STDOUT = "streams.stdout"; //$NON-NLS-1$
+
+ /**
+ * Property: Stderr streams instance.
+ *
Typical for streams terminals.
+ *
+ * Property Type: {@link InputStream}
+ */
+ public static final String PROP_STREAMS_STDERR = "streams.stderr"; //$NON-NLS-1$
+
+ // ***** Ssh specific properties *****
+
+ /**
+ * Property: ssh keep alive value.
+ *
+ * Property Type: {@link Integer}
+ */
+ public static final String PROP_SSH_KEEP_ALIVE = "ssh.keep_alive"; //$NON-NLS-1$
+
+ /**
+ * Property: Ssh password.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_SSH_PASSWORD = "ssh.password"; //$NON-NLS-1$
+
+ /**
+ * Property: Ssh user.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_SSH_USER = "ssh.user"; //$NON-NLS-1$
+
+ // ***** Serial specific properties *****
+
+ /**
+ * The serial device name.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_SERIAL_DEVICE = "serial.device"; //$NON-NLS-1$
+
+ /**
+ * The baud rate.
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_SERIAL_BAUD_RATE = "serial.baudrate"; //$NON-NLS-1$
+
+ /**
+ * The data bits
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_SERIAL_DATA_BITS = "serial.databits"; //$NON-NLS-1$
+
+ /**
+ * The parity
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_SERIAL_PARITY = "serial.parity"; //$NON-NLS-1$
+
+ /**
+ * The stop bits
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_SERIAL_STOP_BITS = "serial.stopbits"; //$NON-NLS-1$
+
+ /**
+ * The flow control
+ *
+ * Property Type: {@link String}
+ */
+ public static final String PROP_SERIAL_FLOW_CONTROL = "serial.flowcontrol"; //$NON-NLS-1$
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/internal/PropertyTester.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/internal/PropertyTester.java
new file mode 100644
index 00000000000..b2b3dba8d49
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/internal/PropertyTester.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.internal;
+
+import org.eclipse.tcf.te.core.terminals.TerminalContextPropertiesProviderFactory;
+
+
+
+/**
+ * Property tester implementation.
+ */
+public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+
+ // "hasContextPropertiesProvider": Checks if a context properties provider is available for the given receiver.
+ if ("hasContextPropertiesProvider".equals(property)) { //$NON-NLS-1$
+ boolean hasProvider = TerminalContextPropertiesProviderFactory.getProvider(receiver) != null;
+ return expectedValue instanceof Boolean ? ((Boolean)expectedValue).equals(Boolean.valueOf(hasProvider)) : hasProvider;
+ }
+
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.java
new file mode 100644
index 00000000000..23cc87c4636
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.nls;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Externalized strings management.
+ */
+public class Messages extends NLS {
+
+ // The plug-in resource bundle name
+ private static final String BUNDLE_NAME = "org.eclipse.tcf.te.core.terminals.nls.Messages"; //$NON-NLS-1$
+
+ /**
+ * Static constructor.
+ */
+ static {
+ // Load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ // **** Declare externalized string id's down here *****
+
+ public static String TerminalServiceFactory_error_serviceImplLoadFailed;
+
+ public static String Extension_error_missingRequiredAttribute;
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.properties b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.properties
new file mode 100644
index 00000000000..212cd1893c1
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.properties
@@ -0,0 +1,14 @@
+###############################################################################
+# Copyright (c) 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
+#
+# Contributors:
+# Wind River Systems - initial API and implementation
+###############################################################################
+
+TerminalServiceFactory_error_serviceImplLoadFailed=Failed to load terminal service implementation.
+
+Extension_error_missingRequiredAttribute=Required attribute "{0}" missing for extension "{1}"!
+
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/preferences/ScopedEclipsePreferences.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/preferences/ScopedEclipsePreferences.java
new file mode 100644
index 00000000000..33d505f2ce6
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/preferences/ScopedEclipsePreferences.java
@@ -0,0 +1,459 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.preferences;
+
+import java.io.OutputStream;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
+import org.eclipse.core.runtime.preferences.IPreferenceFilter;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * Helper class to handle scoped Eclipse preferences for plug-in's. Scoped
+ * preferences means a given preference context plus the default preferences
+ * scope.
+ *
+ * On changes a {@link PreferenceChangeEvent} is sent to inform all listeners of the change.
+ *
+ * @see IEclipsePreferences
+ * @see IEclipsePreferences.PreferenceChangeEvent
+ * @see IEclipsePreferences.IPreferenceChangeListener
+ */
+public class ScopedEclipsePreferences {
+ /**
+ * The preferences scope qualifier.
+ */
+ private final String qualifier;
+
+ /**
+ * The default scope preference node.
+ */
+ protected final IEclipsePreferences defaultPrefs;
+
+ /**
+ * The context scope preference node.
+ */
+ protected final IEclipsePreferences contextScopePrefs;
+
+ /**
+ * The registered preference change listeners.
+ */
+ private final ListenerList listeners = new ListenerList();
+
+ /**
+ * Constructor.
+ *
+ * Initialize the scoped preferences with a new instance scope for the given qualifier. The default
+ * scope is determined by calling DefaultScope().getNode(qualifier)
.
+ *
+ * @param qualifier The qualifier for the preferences (in example the unique identifier of a plugin). Must not be null
.
+ */
+ public ScopedEclipsePreferences(String qualifier) {
+ this(InstanceScope.INSTANCE, qualifier);
+ }
+
+ /**
+ * Constructor.
+ *
+ * Initialize the scoped preferences with the given scope. The default scope
+ * is determined by calling DefaultScope().getNode(qualifier)
.
+ *
+ * @param context The preference scope context. Must not be null
.
+ * @param qualifier The qualifier for the preferences (in example the unique identifier of a plugin). Must not be null
.
+ */
+ public ScopedEclipsePreferences(IScopeContext context, String qualifier) {
+ Assert.isNotNull(context);
+ Assert.isNotNull(qualifier);
+ this.qualifier = qualifier;
+ defaultPrefs = DefaultScope.INSTANCE.getNode(getQualifier());
+ contextScopePrefs = context.getNode(getQualifier());
+ }
+
+ /**
+ * Returns the qualifier that is used to get the preferences.
+ * For plugin preferences, this is the unique identifier of the plugin.
+ */
+ protected final String getQualifier() {
+ return qualifier;
+ }
+
+ /**
+ * Exports the preferences to the stream.
+ *
+ * Note: The stream will be closed after the export.
+ *
+ * @param stream The stream to where preferences and defaults should be exported.
+ */
+ public void exportPreferences(OutputStream stream) {
+ Assert.isNotNull(stream);
+ try {
+ IPreferenceFilter filter = new IPreferenceFilter() {
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.IPreferenceFilter#getScopes()
+ */
+ @Override
+ public String[] getScopes() {
+ return new String[] { InstanceScope.SCOPE };
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.IPreferenceFilter#getMapping(java.lang.String)
+ */
+ @Override
+ public Map getMapping(String scope) {
+ return null;
+ }
+ };
+
+ Platform.getPreferencesService().exportPreferences(contextScopePrefs, new IPreferenceFilter[] { filter }, stream);
+ stream.close();
+ }
+ catch (Exception e) {
+ }
+ }
+
+ /**
+ * Check whether a key is set or not.
+ *
+ * @param key The key to check.
+ * @return null
if the key does not exist.
+ */
+ public boolean containsKey(String key) {
+ return Platform.getPreferencesService().getString(getQualifier(), key, null, null) != null;
+ }
+
+ /**
+ * Get a String preference value.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key or the default value if not set.
+ */
+ public final String getString(String key) {
+ return Platform.getPreferencesService().getString(getQualifier(), key, null, null);
+ }
+
+ /**
+ * Get a boolean preference value.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key or the default value if not set.
+ */
+ public final boolean getBoolean(String key) {
+ return Platform.getPreferencesService().getBoolean(getQualifier(), key, false, null);
+ }
+
+ /**
+ * Get an int preference value.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key or the default value if not set.
+ */
+ public final int getInt(String key) {
+ return Platform.getPreferencesService().getInt(getQualifier(), key, 0, null);
+ }
+
+ /**
+ * Get a long preference value.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key or the default value if not set.
+ */
+ public final long getLong(String key) {
+ return Platform.getPreferencesService().getLong(getQualifier(), key, 0, null);
+ }
+
+ /**
+ * Get a default String preference value.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key or null
.
+ */
+ public final String getDefaultString(String key) {
+ return defaultPrefs.get(key, null);
+ }
+
+ /**
+ * Get a default boolean preference value.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key or null
.
+ */
+ public final boolean getDefaultBoolean(String key) {
+ return defaultPrefs.getBoolean(key, false);
+ }
+
+ /**
+ * Get a default int preference value.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key or null
.
+ */
+ public final int getDefaultInt(String key) {
+ return defaultPrefs.getInt(key, 0);
+ }
+
+ /**
+ * Get a default long preference value.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key or null
.
+ */
+ public final long getDefaultLong(String key) {
+ return defaultPrefs.getLong(key, 0);
+ }
+
+ /**
+ * Set a String preference value. If the value is null
or is equal to
+ * the default value, the entry will be removed.
+ *
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key.
+ */
+ public void putString(String key, String value) {
+ String defValue = defaultPrefs.get(key, null);
+ String instValue = getString(key);
+ if (value == null || value.equals(defValue)) {
+ contextScopePrefs.remove(key);
+ flushAndNotify(contextScopePrefs, key, instValue, defValue);
+ }
+ else if (!value.equals(instValue)) {
+ contextScopePrefs.put(key, value);
+ flushAndNotify(contextScopePrefs, key, instValue, value);
+ }
+ }
+
+ /**
+ * Set a boolean preference value. If the value is equal the default value,
+ * the entry will be removed.
+ *
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key.
+ */
+ public void putBoolean(String key, boolean value) {
+ boolean defValue = defaultPrefs.getBoolean(key, false);
+ boolean instValue = getBoolean(key);
+ if (value == defValue) {
+ contextScopePrefs.remove(key);
+ flushAndNotify(contextScopePrefs, key, Boolean.toString(instValue), Boolean.toString(defValue));
+ }
+ else if (value != instValue) {
+ contextScopePrefs.putBoolean(key, value);
+ flushAndNotify(contextScopePrefs, key, Boolean.toString(instValue), Boolean.toString(value));
+ }
+ }
+
+ /**
+ * Set an int preference value. If the value is equal to the default value,
+ * the entry will be removed.
+ *
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old
+ * and new values are string representation in base 10.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key.
+ */
+ public void putInt(String key, int value) {
+ int defValue = defaultPrefs.getInt(key, 0);
+ int instValue = getInt(key);
+ if (value == defValue) {
+ contextScopePrefs.remove(key);
+ flushAndNotify(contextScopePrefs, key, Integer.toString(instValue), Integer.toString(defValue));
+ }
+ else if (value != instValue) {
+ contextScopePrefs.putInt(key, value);
+ flushAndNotify(contextScopePrefs, key, Integer.toString(instValue), Integer.toString(value));
+ }
+ }
+
+ /**
+ * Set a long preference value. If the given value is equal to the default
+ * value, the entry will be removed.
+ *
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old
+ * and new values are string representation in base 10.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key.
+ */
+ public void putLong(String key, long value) {
+ long defValue = defaultPrefs.getLong(key, 0);
+ long instValue = getLong(key);
+ if (value == defValue) {
+ contextScopePrefs.remove(key);
+ flushAndNotify(contextScopePrefs, key, Long.toString(instValue), Long.toString(defValue));
+ }
+ else if (value != instValue) {
+ contextScopePrefs.putLong(key, value);
+ flushAndNotify(contextScopePrefs, key, Long.toString(instValue), Long.toString(value));
+ }
+ }
+
+ /**
+ * Set a default String preference value. If the given value is null
,
+ * the entry will be removed.
+ *
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key.
+ */
+ public void putDefaultString(String key, String value) {
+ String defValue = defaultPrefs.get(key, null);
+ if (value == null) {
+ defaultPrefs.remove(key);
+ flushAndNotify(defaultPrefs, key, defValue, null);
+ }
+ else if (!value.equals(defValue)) {
+ defaultPrefs.put(key, value);
+ flushAndNotify(defaultPrefs, key, defValue, value);
+ }
+ }
+
+ /**
+ * Set a default boolean preference value.
+ *
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key.
+ */
+ public void putDefaultBoolean(String key, boolean value) {
+ boolean defValue = defaultPrefs.getBoolean(key, false);
+ if (value != defValue) {
+ defaultPrefs.putBoolean(key, value);
+ flushAndNotify(defaultPrefs, key, Boolean.toString(defValue), Boolean.toString(value));
+ }
+ }
+
+ /**
+ * Set a default int preference value.
+ *
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old
+ * and new values are string representation in base 10.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key.
+ */
+ public void putDefaultInt(String key, int value) {
+ int defValue = defaultPrefs.getInt(key, 0);
+ if (value != defValue) {
+ defaultPrefs.putInt(key, value);
+ flushAndNotify(defaultPrefs, key, Integer.toString(defValue), Integer.toString(value));
+ }
+ }
+
+ /**
+ * Set a default long preference value.
+ *
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old
+ * and new values are string representation in base 10.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key.
+ */
+ public void putDefaultLong(String key, long value) {
+ long defValue = defaultPrefs.getLong(key, 0);
+ if (value != defValue) {
+ defaultPrefs.putLong(key, value);
+ flushAndNotify(defaultPrefs, key, Long.toString(defValue), Long.toString(value));
+ }
+ }
+
+ /**
+ * Write back the changes to the store and notify all listeners about the changed key.
+ *
+ * @param node The preference node which has changed. Must not be null
.
+ * @param key The key of the changed preference. Must not be null
.
+ * @param oldValue The old value as a {@link String}, or null
.
+ * @param newValue The new value as a {@link String}, or null
.
+ */
+ protected final void flushAndNotify(IEclipsePreferences node, String key, String oldValue, String newValue) {
+ // Flush the preferences to the persistence store
+ try { node.flush(); } catch (BackingStoreException e) { /* Ignored on purpose */ }
+
+ // Notify the listeners
+ firePreferenceEvent(node, key, oldValue, newValue);
+ }
+
+ /**
+ * Register the given listener to receive notifications of preference changes to this node.
+ * Calling this method multiple times with the same listener has no effect. The given listener
+ * argument must not be null
.
+ *
+ * @param listener The preference change listener. Must not be null
.
+ */
+ public void addPreferenceChangeListener(IPreferenceChangeListener listener) {
+ Assert.isNotNull(listener);
+ listeners.add(listener);
+ }
+
+ /**
+ * De-register the given listener from receiving notifications of preference changes
+ * to this node. Calling this method multiple times with the same listener has no
+ * effect. The given listener argument must not be null
.
+ *
+ * @param listener The preference change listener. Must not be null
.
+ */
+ public void removePreferenceChangeListener(IPreferenceChangeListener listener) {
+ Assert.isNotNull(listener);
+ listeners.remove(listener);
+ }
+
+ /**
+ * Convenience method for notifying the registered preference change listeners.
+ *
+ * @param node The preference node which has changed. Must not be null
.
+ * @param key The key of the changed preference. Must not be null
.
+ * @param oldValue The old value as a {@link String}, or null
.
+ * @param newValue The new value as a {@link String}, or null
.
+ */
+ protected void firePreferenceEvent(IEclipsePreferences node, String key, String oldValue, String newValue) {
+ Assert.isNotNull(node);
+ Assert.isNotNull(key);
+
+ // If no listener is registered, we are done here
+ if (listeners.isEmpty()) return;
+
+ // Get the list or currently registered listeners
+ Object[] l = listeners.getListeners();
+ // Create the preference change event
+ final PreferenceChangeEvent event = new PreferenceChangeEvent(node, key, oldValue, newValue);
+ for (int i = 0; i < l.length; i++) {
+ final IPreferenceChangeListener listener = (IPreferenceChangeListener) l[i];
+ ISafeRunnable job = new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ // already logged in Platform#run()
+ }
+
+ @Override
+ public void run() throws Exception {
+ listener.preferenceChange(event);
+ }
+ };
+ SafeRunner.run(job);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/tracing/TraceHandler.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/tracing/TraceHandler.java
new file mode 100644
index 00000000000..fcce8ab071d
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/tracing/TraceHandler.java
@@ -0,0 +1,295 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.tracing;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.tcf.te.core.terminals.activator.CoreBundleActivator;
+
+/**
+ * Helper class to handle tracing using the platforms debug capabilities.
+ */
+public class TraceHandler {
+ /**
+ * The bundle identifier.
+ */
+ private final String identifier;
+
+ /**
+ * The tracer instance.
+ */
+ private Tracer tracer = null;
+
+ /**
+ * The tracer is responsible for writing the trace message to the desired
+ * output media.
+ */
+ protected static class Tracer {
+
+ /**
+ * The bundle identifier.
+ */
+ private final String fIdentifier;
+
+ /**
+ * The qualifier for the default "<bundle identifier>/debugmode"
+ * tracing slot.
+ */
+ private final String fDebugModeQualifier;
+
+ /**
+ * Constructor.
+ *
+ * @param identifier The bundle identifier. Must not be null
.
+ */
+ public Tracer(String identifier) {
+ Assert.isNotNull(identifier);
+ fIdentifier = identifier;
+
+ // Initialize the debug mode qualifier
+ fDebugModeQualifier = fIdentifier + "/debugmode"; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the value of the debug mode tracing slot.
+ *
+ * If not set, or the value is not an {@link Integer}, the method returns 0
.
+ *
+ * @return The debug mode value.
+ */
+ protected int getDebugMode() {
+ try {
+ String mode = Platform.getDebugOption(fDebugModeQualifier);
+ if (mode != null && Integer.decode(mode).intValue() > 0) {
+ return Integer.decode(mode).intValue();
+ }
+ } catch (NumberFormatException e) { /* ignored on purpose */ }
+
+ return 0;
+ }
+
+ /**
+ * Check if the specified trace slot is enabled.
+ *
+ * @param slotId The name of the slot.
+ * @return true
if the slot is defined and enabled, false
otherwise.
+ */
+ protected boolean isSlotEnabled(String slotId) {
+ return fIdentifier != null ? Boolean.parseBoolean(Platform.getDebugOption(fIdentifier + "/" + slotId)) : false; //$NON-NLS-1$
+ }
+
+ /**
+ * Check if tracing is enabled for given mode and slot.
+ *
+ * @param debugMode The debug mode for the current debug.
+ * @param slotId The name of the slot.
+ *
+ * @return true
if the debug should be written, false
otherwise.
+ */
+ protected final boolean isEnabled(int debugMode, String slotId) {
+ return getDebugMode() < 0 ||
+ (debugMode <= getDebugMode() &&
+ (slotId == null || slotId.trim().length() == 0 || isSlotEnabled(slotId)));
+ }
+
+ /**
+ * Format the trace message.
+ *
+ * @param message The trace message.
+ * @param debugMode The debug mode.
+ * @param slotId The name of the slot.
+ * @param severity The severity. See {@link IStatus} for valid severity values.
+ * @param clazz The class that calls this tracer.
+ *
+ * @see IStatus
+ */
+ protected String getFormattedDebugMessage(String message, int debugMode, String slotId, int severity, Object clazz) {
+ StringBuffer debug = new StringBuffer();
+ if (slotId != null || clazz != null) {
+ if (clazz != null) {
+ String name = clazz instanceof Class> ? ((Class>)clazz).getSimpleName() : clazz.getClass().getSimpleName();
+ debug.append(name.trim().length() > 0 ? name.trim() : clazz instanceof Class> ? ((Class>)clazz).getName() : clazz.getClass().getName());
+ }
+ if (slotId != null) {
+ debug.append(" at "); //$NON-NLS-1$
+ debug.append(slotId);
+ }
+ if (debugMode >= 0) {
+ debug.append(" (Mode "); //$NON-NLS-1$
+ debug.append(debugMode);
+ debug.append(')');
+ }
+ debug.append('\n');
+ debug.append('\t');
+ }
+ debug.append(message);
+
+ return debug.toString();
+ }
+
+ /**
+ * Write the trace message.
+ *
+ * @param message The trace message.
+ * @param debugMode The debug mode.
+ * @param slotId The name of the slot.
+ * @param severity The severity. See {@link IStatus} for valid severity values.
+ * @param clazz The class that calls this tracer.
+ *
+ * @see IStatus
+ */
+ protected void write(String message, int debugMode, String slotId, int severity, Object clazz) {
+ String formattedMessage = getFormattedDebugMessage(message, debugMode, slotId, severity, clazz);
+ if (severity == IStatus.ERROR || severity == IStatus.WARNING) {
+ System.err.println(formattedMessage);
+ }
+ else {
+ System.out.println(formattedMessage);
+ }
+ }
+
+ /**
+ * Trace the given message with the given debug mode and slot.
+ *
+ * @param message The trace message.
+ * @param debugMode The debug mode.
+ * @param slotId The name of the slot.
+ * @param severity The severity. See {@link IStatus} for valid severity values.
+ * @param clazz The class that calls this tracer.
+ *
+ * @see IStatus
+ */
+ public final void trace(String message, int debugMode, String slotId, int severity, Object clazz) {
+ if (isEnabled(debugMode, slotId)) {
+ write(message, debugMode, slotId, severity, clazz);
+ }
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * Initializes the tracing handler with the given bundle identifier.
+ *
+ * @param identifier The bundle identifier or null
.
+ */
+ public TraceHandler(String identifier) {
+ this.identifier = identifier != null ? identifier : CoreBundleActivator.getUniqueIdentifier();
+ Assert.isNotNull(this.identifier);
+ }
+
+ /**
+ * Returns the identifier.
+ */
+ protected final String getIdentifier() {
+ return identifier;
+ }
+
+ /**
+ * Returns the tracer instance. Create a new tracer instance
+ * on first invocation.
+ *
+ * @return The tracer instance.
+ */
+ protected Tracer getTracer() {
+ if (tracer == null) {
+ tracer = new Tracer(identifier);
+ }
+ return tracer;
+ }
+
+ /**
+ * Return the current debug mode.
+ */
+ public final int getDebugMode() {
+ return getTracer().getDebugMode();
+ }
+
+ /**
+ * Check whether a trace slot is enabled. The debug mode defaults
+ * to 0.
+ *
+ * @param slotId The name of the slot.
+ *
+ * @return true
if the slot is enabled, false
otherwise.
+ */
+ public final boolean isSlotEnabled(String slotId) {
+ return isSlotEnabled(0, slotId);
+ }
+
+ /**
+ * Check whether a trace slot is enabled with the given debug mode.
+ *
+ * @param debugMode The debug mode
+ * @param slotId The name of the slot.
+ *
+ * @return true
if the slot is enabled, false
otherwise.
+ */
+ public final boolean isSlotEnabled(int debugMode, String slotId) {
+ return getTracer().isEnabled(debugMode, slotId);
+ }
+
+ /**
+ * Trace the given message.
+ *
+ * The message severity will be {@link IStatus#INFO} and the message will be
+ * traced unconditionally.
+ *
+ * @param message The message.
+ * @param clazz The class that calls this tracer or null
.
+ */
+ public final void trace(String message, Object clazz) {
+ getTracer().trace(message, 0, null, IStatus.INFO, clazz);
+ }
+
+ /**
+ * Trace the given message.
+ *
+ * The message severity will be {@link IStatus#INFO}.
+ *
+ * @param message The message.
+ * @param debugMode The minimum debug mode that has to be set to write out the message.
+ * @param clazz The class that calls this tracer or null
.
+ */
+ public final void trace(String message, int debugMode, Object clazz) {
+ getTracer().trace(message, debugMode, null, IStatus.INFO, clazz);
+ }
+
+ /**
+ * Trace the given message.
+ *
+ * The message severity will be {@link IStatus#INFO} and the debug mode
+ * will default to 0
.
+ *
+ * @param message The message.
+ * @param slotId The slot that has to be enabled to write out the message.
+ * @param clazz The class that calls this tracer or null
.
+ */
+ public final void trace(String message, String slotId, Object clazz) {
+ getTracer().trace(message, 0, slotId, IStatus.INFO, clazz);
+ }
+
+ /**
+ * Trace the given message.
+ *
+ * @param message The message.
+ * @param debugMode The minimum debug mode that has to be set to write out the message.
+ * @param slotId The slot that has to be enabled to write out the message.
+ * @param severity The severity. See {@link IStatus} for valid severity values.
+ * @param clazz The class that calls this tracer or null
.
+ *
+ * @see IStatus
+ */
+ public final void trace(String message, int debugMode, String slotId, int severity, Object clazz) {
+ getTracer().trace(message, debugMode, slotId, severity, clazz);
+ }
+
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/utils/Env.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/utils/Env.java
new file mode 100644
index 00000000000..2605d765812
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/utils/Env.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2013, 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.core.terminals.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osgi.service.environment.Constants;
+
+/**
+ * Environment handling utility methods.
+ */
+public class Env {
+
+ // Reference to the monitor to lock if determining the native environment
+ private final static Object ENV_GET_MONITOR = new Object();
+
+ // Reference to the native environment with the case of the variable names preserved
+ private static Map nativeEnvironmentCasePreserved = null;
+
+ /**
+ * Returns the merged environment of the native environment and the passed
+ * in environment. Passed in variables will overwrite the native environment
+ * if the same variables are set there.
+ *
+ * For use with terminals, the parameter terminal
should be set to
+ * true
. In this case, the method will assure that the TERM
+ * environment variable is always set to ANSI
and is not overwritten
+ * by the passed in environment.
+ *
+ * @param envp The environment to set on top of the native environment or null
.
+ * @param terminal True
if used with an terminal, false
otherwise.
+ *
+ * @return The merged environment.
+ */
+ public static String[] getEnvironment(String[] envp, boolean terminal) {
+ // Get the cached native environment
+ Map nativeEnv = getNativeEnvironmentCasePreserved();
+ // Make a copy of the native environment so it can be manipulated without changing
+ // the cached environment
+ Map env = new LinkedHashMap(nativeEnv);
+ // Set the TERM environment variable if in terminal mode
+ if (terminal) env.put("TERM", "xterm"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // On Windows, the environment variable names are not case-sensitive. However,
+ // we desire to preserve the original case. Build up a translation map between
+ // an all lowercase name and the original environment name
+ Map k2n = null;
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
+ k2n = new HashMap();
+ for (String name : env.keySet()) {
+ k2n.put(name.toLowerCase(), name);
+ }
+ }
+
+ // If a "local" environment is provided, merge it with the native
+ // environment.
+ if (envp != null) {
+ for (int i = 0; i < envp.length; i++) {
+ // The full provided variable in form "name=value"
+ String envpPart = envp[i];
+ // Split the variable
+ String[] parts = envpPart.split("=");//$NON-NLS-1$
+ String name = parts[0].trim();
+ // Map the variable name to the real environment name (Windows only)
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
+ if (k2n.containsKey(name.toLowerCase())) {
+ String candidate = k2n.get(name.toLowerCase());
+ Assert.isNotNull(candidate);
+ name = candidate;
+ }
+ // Filter out environment variables with bad names
+ if ("".equals(name.trim()) || name.contains("=") || name.contains(":")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ continue;
+ }
+ }
+ // Get the variable value
+ String value = parts.length > 1 ? parts[1].trim() : ""; //$NON-NLS-1$
+ // Don't overwrite the TERM variable if in terminal mode
+ if (terminal && "TERM".equals(name)) continue; //$NON-NLS-1$
+ // If a variable with the name does not exist, just append it
+ if (!env.containsKey(name) && !"".equals(value)) { //$NON-NLS-1$
+ env.put(name, value);
+ } else if (env.containsKey(name)) {
+ // If the value contains the special placeholder "", remove the variable from the environment
+ if ("".equals(value)) {//$NON-NLS-1$
+ env.remove(name);
+ } else {
+ // A variable with the name already exist, check if the value is different
+ String oldValue = env.get(name);
+ if (oldValue != null && !oldValue.equals(value) || oldValue == null && value != null) {
+ env.put(name, value);
+ }
+ }
+ }
+ }
+ }
+
+ // Convert into an array of strings
+ List keys = new ArrayList(env.keySet());
+ // On Windows hosts, sort the environment keys
+ if (Platform.OS_WIN32.equals(Platform.getOS())) Collections.sort(keys);
+ Iterator iter = keys.iterator();
+ List strings = new ArrayList(env.size());
+ StringBuilder buffer = null;
+ while (iter.hasNext()) {
+ String key = iter.next();
+ buffer = new StringBuilder(key);
+ buffer.append('=').append(env.get(key));
+ strings.add(buffer.toString());
+ }
+
+ return strings.toArray(new String[strings.size()]);
+ }
+
+ /**
+ * Determine the native environment.
+ *
+ * @return The native environment, or an empty map.
+ */
+ private static Map getNativeEnvironmentCasePreserved() {
+ synchronized (ENV_GET_MONITOR) {
+ if (nativeEnvironmentCasePreserved == null) {
+ nativeEnvironmentCasePreserved = new LinkedHashMap();
+ cacheNativeEnvironment(nativeEnvironmentCasePreserved);
+ }
+ return new LinkedHashMap(nativeEnvironmentCasePreserved);
+ }
+ }
+
+ /**
+ * Query the native environment and store it to the specified cache.
+ *
+ * @param cache The environment cache. Must not be null
.
+ */
+ private static void cacheNativeEnvironment(Map cache) {
+ Assert.isNotNull(cache);
+
+ try {
+ String nativeCommand = null;
+ if (Platform.getOS().equals(Constants.OS_WIN32)) {
+ nativeCommand = "cmd.exe /C set"; //$NON-NLS-1$
+ } else if (!Platform.getOS().equals(Constants.OS_UNKNOWN)) {
+ nativeCommand = "env"; //$NON-NLS-1$
+ }
+ if (nativeCommand == null) { return; }
+ Process process = Runtime.getRuntime().exec(nativeCommand);
+
+ // read process directly on other platforms
+ // we need to parse out matching '{' and '}' for function declarations in .bash environments
+ // pattern is [function name]=() { and we must find the '}' on its own line with no trailing ';'
+ InputStream stream = process.getInputStream();
+ InputStreamReader isreader = new InputStreamReader(stream);
+ BufferedReader reader = new BufferedReader(isreader);
+ try {
+ String line = reader.readLine();
+ String key = null;
+ String value = null;
+ while (line != null) {
+ int func = line.indexOf("=()"); //$NON-NLS-1$
+ if (func > 0) {
+ key = line.substring(0, func);
+ // scan until we find the closing '}' with no following chars
+ value = line.substring(func + 1);
+ while (line != null && !line.equals("}")) { //$NON-NLS-1$
+ line = reader.readLine();
+ if (line != null) {
+ value += line;
+ }
+ }
+ line = reader.readLine();
+ } else {
+ int separator = line.indexOf('=');
+ if (separator > 0) {
+ key = line.substring(0, separator);
+ value = line.substring(separator + 1);
+ StringBuilder bufValue = new StringBuilder(value);
+ line = reader.readLine();
+ if (line != null) {
+ // this line has a '=' read ahead to check next line for '=', might be broken on more
+ // than one line
+ separator = line.indexOf('=');
+ while (separator < 0) {
+ bufValue.append(line.trim());
+ line = reader.readLine();
+ if (line == null) {
+ // if next line read is the end of the file quit the loop
+ break;
+ }
+ separator = line.indexOf('=');
+ }
+ }
+ value = bufValue.toString();
+ }
+ }
+ if (key != null) {
+ cache.put(key, value);
+ key = null;
+ value = null;
+ } else {
+ line = reader.readLine();
+ }
+ }
+ } finally {
+ reader.close();
+ }
+ } catch (IOException e) {
+ // Native environment-fetching code failed.
+ // This can easily happen and is not useful to log.
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.tcf.te.core.terminals/te-feature.png b/plugins/org.eclipse.tcf.te.core.terminals/te-feature.png
new file mode 100644
index 00000000000..8e1143d7de2
Binary files /dev/null and b/plugins/org.eclipse.tcf.te.core.terminals/te-feature.png differ
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.classpath b/plugins/org.eclipse.tcf.te.ui.terminals.local/.classpath
new file mode 100644
index 00000000000..ad32c83a788
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.options b/plugins/org.eclipse.tcf.te.ui.terminals.local/.options
new file mode 100644
index 00000000000..b396734183f
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.options
@@ -0,0 +1 @@
+org.eclipse.tcf.te.ui.terminals.local/debugmode = 0
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.project b/plugins/org.eclipse.tcf.te.ui.terminals.local/.project
new file mode 100644
index 00000000000..f86fbb751ca
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.project
@@ -0,0 +1,39 @@
+
+
+ org.eclipse.tcf.te.ui.terminals.local
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
+
+ 0
+
+ 10
+
+ org.eclipse.ui.ide.multiFilter
+ 1.0-name-matches-false-false-target
+
+
+
+
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..24dad4464e4
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,362 @@
+#Tue Oct 11 11:53:38 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=4
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.lineSplit=100
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..88bb9570e83
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,56 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Target Explorer Java STD
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.pde.prefs
new file mode 100644
index 00000000000..cf80c8bc5b8
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,32 @@
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=1
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=1
+compilers.p.missing-version-require-bundle=1
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..84f9ad6ac24
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF
@@ -0,0 +1,30 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.local;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin
+Bundle-Vendor: %providerName
+Import-Package: org.eclipse.cdt.utils.pty;mandatory:=native
+Require-Bundle: org.eclipse.cdt.core;bundle-version="5.6";resolution:=optional,
+ org.eclipse.core.expressions;bundle-version="3.4.400",
+ org.eclipse.core.resources;bundle-version="3.8.1";resolution:=optional,
+ org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.core.variables;bundle-version="3.2.600",
+ org.eclipse.debug.ui;bundle-version="3.8.1";resolution:=optional,
+ org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
+ org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0",
+ org.eclipse.tcf.te.ui.terminals.process;bundle-version="1.3.0",
+ org.eclipse.tm.terminal;bundle-version="3.3.1",
+ org.eclipse.ui;bundle-version="3.8.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.ui.terminals.local.activator;x-internal:=true,
+ org.eclipse.tcf.te.ui.terminals.local.controls,
+ org.eclipse.tcf.te.ui.terminals.local.help,
+ org.eclipse.tcf.te.ui.terminals.local.launcher,
+ org.eclipse.tcf.te.ui.terminals.local.nls;x-internal:=true,
+ org.eclipse.tcf.te.ui.terminals.local.showin,
+ org.eclipse.tcf.te.ui.terminals.local.showin.interfaces,
+ org.eclipse.tcf.te.ui.terminals.local.showin.preferences
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/p2.inf b/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/p2.inf
new file mode 100644
index 00000000000..9bd5194fa74
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/p2.inf
@@ -0,0 +1,82 @@
+###############################################################################
+# Copyright (c) 2014 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
+#
+# Contributors:
+# Wind River Systems - initial API and implementation
+###############################################################################
+
+# Most of the dependencies exposed here are actually covered in the feature.xml
+# This file ensures that the current bundle has all it needs, even if installed
+# without the enclosing org.eclipse.tcf.te.terminals.feature .
+# See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=435150 .
+
+# 1. Make the optional cdt.core dependency non-greedy: Use (or update to proper
+# version!) when installed, but do not install automatically since the newer
+# org.eclipse.cdt.core.native can satisfy the dependency better. We use this
+# trick since CDT 8.3 had no version on export-package yet but we do want
+# a version constraint.
+requires.0.namespace = org.eclipse.equinox.p2.iu
+requires.0.name = org.eclipse.cdt.core
+#requires.0.range = [5.6, 6.0)
+requires.0.greedy = false
+requires.0.optional = true
+
+#requires.1.namespace = org.eclipse.equinox.p2.iu
+#requires.1.name = org.eclipse.cdt.core.native
+#requires.1.range = [5.6, 6.0)
+#requires.1.greedy = true
+#requires.1.optional = true
+
+# 2. Add the required fragments for local terminal support with proper version.
+requires.2.namespace = org.eclipse.equinox.p2.iu
+requires.2.name = org.eclipse.cdt.core.aix
+#requires.2.range = [5.3, 6.0)
+requires.2.filter = (osgi.os=aix)
+
+requires.3.namespace = org.eclipse.equinox.p2.iu
+requires.3.name = org.eclipse.cdt.core.linux
+#requires.3.range = [5.2, 6.0)
+requires.3.filter = (osgi.os=linux)
+
+requires.4.namespace = org.eclipse.equinox.p2.iu
+requires.4.name = org.eclipse.cdt.core.linux.ppc64
+#requires.4.range = [5.1, 6.0)
+requires.4.filter = (&(osgi.os=linux)(osgi.arch=ppc64))
+
+requires.5.namespace = org.eclipse.equinox.p2.iu
+requires.5.name = org.eclipse.cdt.core.linux.x86
+#requires.5.range = [5.2, 6.0)
+requires.5.filter = (&(osgi.os=linux)(osgi.arch=x86))
+
+requires.6.namespace = org.eclipse.equinox.p2.iu
+requires.6.name = org.eclipse.cdt.core.linux.x86_64
+#requires.6.range = [5.2, 6.0)
+requires.6.filter = (&(osgi.os=linux)(osgi.arch=x86_64))
+
+requires.7.namespace = org.eclipse.equinox.p2.iu
+requires.7.name = org.eclipse.cdt.core.macosx
+#requires.7.range = [5.2, 6.0)
+requires.7.filter = (osgi.os=macosx)
+
+requires.8.namespace = org.eclipse.equinox.p2.iu
+requires.8.name = org.eclipse.cdt.core.solaris
+#requires.8.range = [5.2, 6.0)
+requires.8.filter = (&(osgi.os=solaris)(osgi.arch=sparc))
+
+requires.9.namespace = org.eclipse.equinox.p2.iu
+requires.9.name = org.eclipse.cdt.core.win32
+#requires.9.range = [5.3, 6.0)
+requires.9.filter = (osgi.os=win32)
+
+requires.10.namespace = org.eclipse.equinox.p2.iu
+requires.10.name = org.eclipse.cdt.core.win32.x86
+#requires.10.range = [5.2, 6.0)
+requires.10.filter = (&(osgi.os=win32)(osgi.arch=x86))
+
+requires.11.namespace = org.eclipse.equinox.p2.iu
+requires.11.name = org.eclipse.cdt.core.win32.x86_64
+#requires.11.range = [5.2, 6.0)
+requires.11.filter = (&(osgi.os=win32)(osgi.arch=x86_64))
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/about.html b/plugins/org.eclipse.tcf.te.ui.terminals.local/about.html
new file mode 100644
index 00000000000..0f07cf034df
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+About This Content
+
+May 24, 2012
+License
+
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") 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 http://www.eclipse.org.
+
+
+
\ No newline at end of file
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/build.properties b/plugins/org.eclipse.tcf.te.ui.terminals.local/build.properties
new file mode 100644
index 00000000000..a17f48f7453
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/build.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2012, 2014 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
+#
+# Contributors:
+# Wind River Systems - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html,\
+ icons/
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/contexts.xml b/plugins/org.eclipse.tcf.te.ui.terminals.local/contexts.xml
new file mode 100644
index 00000000000..2dbe1516c5b
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/contexts.xml
@@ -0,0 +1,6 @@
+
+
+
+ Add or modify an external executable added to the 'Show In' context menu.
+
+
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/icons/eview16/terminal_view.gif b/plugins/org.eclipse.tcf.te.ui.terminals.local/icons/eview16/terminal_view.gif
new file mode 100644
index 00000000000..bbb6a9e153e
Binary files /dev/null and b/plugins/org.eclipse.tcf.te.ui.terminals.local/icons/eview16/terminal_view.gif differ
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties b/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties
new file mode 100644
index 00000000000..ceb5be00523
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties
@@ -0,0 +1,23 @@
+##################################################################################
+# Copyright (c) 2011, 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
+#
+# Contributors:
+# Wind River Systems - initial API and implementation
+##################################################################################
+
+pluginName = Terminals Local Connector
+providerName = Eclipse.org - Target Explorer
+
+# ----- Commands and Menu contributions -----
+LocalLauncherDelegate.label=Local Terminal
+
+command.launch.name=Open Local Terminal on Selection
+
+menu.showIn.localterminal.label = Terminals
+
+# ----- Preference Pages -----
+
+preference.page.name=Local Terminal
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml b/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml
new file mode 100644
index 00000000000..45808813c7c
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/pom.xml b/plugins/org.eclipse.tcf.te.ui.terminals.local/pom.xml
new file mode 100644
index 00000000000..144c83e1fc1
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+
+ org.eclipse.tcf
+ org.eclipse.tcf.maven-build
+ 1.3.0-SNAPSHOT
+ ../../../admin/pom-build.xml
+
+
+ 1.3.0.qualifier
+ org.eclipse.tcf.te.ui.terminals.local
+ eclipse-plugin
+
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java
new file mode 100644
index 00000000000..80de64f1c4c
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2012 - 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.terminals.local.activator;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences;
+import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIPlugin extends AbstractUIPlugin {
+ // The shared instance
+ private static UIPlugin plugin;
+ // The scoped preferences instance
+ private static volatile ScopedEclipsePreferences scopedPreferences;
+ // The trace handler instance
+ private static volatile TraceHandler traceHandler;
+
+ /**
+ * The constructor
+ */
+ public UIPlugin() {
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plug-in.
+ */
+ public static String getUniqueIdentifier() {
+ if (getDefault() != null && getDefault().getBundle() != null) {
+ return getDefault().getBundle().getSymbolicName();
+ }
+ return "org.eclipse.tcf.te.ui.terminals.local"; //$NON-NLS-1$
+ }
+
+ /**
+ * Return the scoped preferences for this plug-in.
+ */
+ public static ScopedEclipsePreferences getScopedPreferences() {
+ if (scopedPreferences == null) {
+ scopedPreferences = new ScopedEclipsePreferences(getUniqueIdentifier());
+ }
+ return scopedPreferences;
+ }
+
+ /**
+ * Returns the bundles trace handler.
+ *
+ * @return The bundles trace handler.
+ */
+ public static TraceHandler getTraceHandler() {
+ if (traceHandler == null) {
+ traceHandler = new TraceHandler(getUniqueIdentifier());
+ }
+ return traceHandler;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ scopedPreferences = null;
+ traceHandler = null;
+ super.stop(context);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
+ */
+ @Override
+ protected void initializeImageRegistry(ImageRegistry registry) {
+ super.initializeImageRegistry(registry);
+ }
+
+ /**
+ * Loads the image registered under the specified key from the image
+ * registry and returns the Image
object instance.
+ *
+ * @param key The key the image is registered with.
+ * @return The Image
object instance or null
.
+ */
+ public static Image getImage(String key) {
+ return getDefault().getImageRegistry().get(key);
+ }
+
+ /**
+ * Loads the image registered under the specified key from the image
+ * registry and returns the ImageDescriptor
object instance.
+ *
+ * @param key The key the image is registered with.
+ * @return The ImageDescriptor
object instance or null
.
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return getDefault().getImageRegistry().getDescriptor(key);
+ }
+}
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
new file mode 100644
index 00000000000..63f452e9c77
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.terminals.local.controls;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
+import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.WorkbenchEncoding;
+import org.osgi.framework.Bundle;
+
+/**
+ * Serial wizard configuration panel implementation.
+ */
+public class LocalWizardConfigurationPanel extends AbstractExtendedConfigurationPanel {
+
+ private Object resource;
+
+ /**
+ * Constructor.
+ *
+ * @param container The configuration panel container or null
.
+ */
+ public LocalWizardConfigurationPanel(IConfigurationPanelContainer container) {
+ super(container);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void setupPanel(Composite parent) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayout(new GridLayout());
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ // Create the encoding selection combo
+ createEncodingUI(panel, false);
+
+ // Set the default encoding:
+ // Default UTF-8 on Mac or Windows for Local, Preferences:Platform encoding otherwise
+ if (Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_WIN32.equals(Platform.getOS())) {
+ setEncoding("UTF-8"); //$NON-NLS-1$
+ } else {
+ String encoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
+ if (encoding != null && !"".equals(encoding)) setEncoding(encoding); //$NON-NLS-1$
+ }
+
+ // Fill the rest of the panel with a label to be able to
+ // set a height and width hint for the dialog
+ Label label = new Label(panel, SWT.HORIZONTAL);
+ GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ layoutData.widthHint = 300;
+ layoutData.heightHint = 80;
+ label.setLayoutData(layoutData);
+
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
+ resource = getSelectionResource();
+ }
+
+ setControl(panel);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map)
+ */
+ @Override
+ public void setupData(Map data) {
+ if (data == null) return;
+
+ String value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING);
+ if (value != null) setEncoding(value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
+ */
+ @Override
+ public void extractData(Map data) {
+ // set the terminal connector id for local terminal
+ data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"); //$NON-NLS-1$
+
+ // Store the encoding
+ data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
+
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
+ // if we have a IResource selection use the location for working directory
+ if (resource instanceof org.eclipse.core.resources.IResource){
+ String dir = ((org.eclipse.core.resources.IResource)resource).getProject().getLocation().toString();
+ data.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String)
+ */
+ @Override
+ protected void fillSettingsForHost(String host){
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean)
+ */
+ @Override
+ protected void saveSettingsForHost(boolean add){
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid()
+ */
+ @Override
+ public boolean isValid(){
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ // Save the encodings widget values
+ doSaveEncodingsWidgetValues(settings, idPrefix);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+ // Restore the encodings widget values
+ doRestoreEncodingsWidgetValues(settings, idPrefix);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings()
+ */
+ @Override
+ protected String getHostFromSettings() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#isWithHostList()
+ */
+ @Override
+ public boolean isWithHostList() {
+ return false;
+ }
+
+ /**
+ * Returns the IResource from the current selection
+ *
+ * @return the IResource, or null
.
+ */
+ private org.eclipse.core.resources.IResource getSelectionResource() {
+ ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ ISelection selection = selectionService != null ? selectionService.getSelection() : StructuredSelection.EMPTY;
+
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Object element = ((IStructuredSelection) selection).getFirstElement();
+ if (element instanceof org.eclipse.core.resources.IResource){
+ return ((org.eclipse.core.resources.IResource)element);
+ }
+ if (element instanceof IAdaptable) {
+ return (org.eclipse.core.resources.IResource) ((IAdaptable) element).getAdapter(org.eclipse.core.resources.IResource.class);
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/help/IContextHelpIds.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/help/IContextHelpIds.java
new file mode 100644
index 00000000000..5f7b4108173
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/help/IContextHelpIds.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.terminals.local.help;
+
+import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
+
+
+/**
+ * UI Context help id definitions.
+ */
+public interface IContextHelpIds {
+
+ /**
+ * UI plug-in common context help id prefix.
+ */
+ public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$
+
+ /**
+ * External executables dialog.
+ */
+ public final static String EXTERNAL_EXECUTABLES_DIALOG = PREFIX + "ExternalExecutablesDialog"; //$NON-NLS-1$
+}
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
new file mode 100644
index 00000000000..1baa6bf4e31
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
@@ -0,0 +1,402 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.terminals.local.launcher;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.utils.pty.PTY;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.core.variables.IStringVariableManager;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory;
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done;
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ILineSeparatorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
+import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
+import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
+import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.terminals.local.controls.LocalWizardConfigurationPanel;
+import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys;
+import org.eclipse.tcf.te.ui.terminals.process.ProcessSettings;
+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.TerminalConnectorExtension;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.WorkbenchEncoding;
+import org.osgi.framework.Bundle;
+
+/**
+ * Serial launcher delegate implementation.
+ */
+@SuppressWarnings("restriction")
+public class LocalLauncherDelegate extends AbstractLauncherDelegate {
+
+ private final IMementoHandler mementoHandler = new LocalMementoHandler();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration()
+ */
+ @Override
+ public boolean needsUserConfiguration() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
+ */
+ @Override
+ public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
+ return new LocalWizardConfigurationPanel(container);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
+ */
+ @Override
+ public void execute(Map properties, Done done) {
+ Assert.isNotNull(properties);
+
+ // Set the terminal tab title
+ String terminalTitle = getTerminalTitle(properties);
+ if (terminalTitle != null) {
+ properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
+ }
+
+ // If not configured, set the default encodings for the local terminal
+ if (!properties.containsKey(ITerminalsConnectorConstants.PROP_ENCODING)) {
+ String encoding = null;
+ // Set the default encoding:
+ // Default UTF-8 on Mac or Windows for Local, Preferences:Platform encoding otherwise
+ if (Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_WIN32.equals(Platform.getOS())) {
+ encoding = "UTF-8"; //$NON-NLS-1$
+ } else {
+ encoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
+ }
+ if (encoding != null && !"".equals(encoding)) properties.put(ITerminalsConnectorConstants.PROP_ENCODING, encoding); //$NON-NLS-1$
+ }
+
+ // For local terminals, force a new terminal tab each time it is launched,
+ // if not set otherwise from outside
+ if (!properties.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW)) {
+ properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
+ }
+
+ // Initialize the local terminal working directory.
+ // By default, start the local terminal in the users home directory
+ String initialCwd = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD);
+ String cwd = null;
+ if (initialCwd == null || IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME.equals(initialCwd) || "".equals(initialCwd.trim())) { //$NON-NLS-1$
+ cwd = System.getProperty("user.home"); //$NON-NLS-1$
+ } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd)) {
+ String eclipseHomeLocation = System.getProperty("eclipse.home.location"); //$NON-NLS-1$
+ if (eclipseHomeLocation != null) {
+ try {
+ URI uri = URIUtil.fromString(eclipseHomeLocation);
+ File f = URIUtil.toFile(uri);
+ cwd = f.getAbsolutePath();
+ } catch (URISyntaxException ex) { /* ignored on purpose */ }
+ }
+ } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd)) {
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
+ if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null
+ && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null
+ && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
+ cwd = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
+ }
+ }
+ } else {
+ try {
+ // Resolve possible dynamic variables
+ IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager();
+ String resolved = vm.performStringSubstitution(initialCwd);
+
+ IPath p = new Path(resolved);
+ if (p.toFile().canRead() && p.toFile().isDirectory()) {
+ cwd = p.toOSString();
+ }
+ } catch (CoreException ex) {
+ if (Platform.inDebugMode()) {
+ UIPlugin.getDefault().getLog().log(ex.getStatus());
+ }
+ }
+ }
+
+ if (cwd != null && !"".equals(cwd)) { //$NON-NLS-1$
+ properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, cwd);
+ }
+
+ // If the current selection resolved to an folder, default the working directory
+ // to that folder and update the terminal title
+ ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ if ((service != null && service.getSelection() != null) || properties.containsKey(ITerminalsConnectorConstants.PROP_SELECTION)) {
+ ISelection selection = (ISelection)properties.get(ITerminalsConnectorConstants.PROP_SELECTION);
+ if (selection == null) selection = service.getSelection();
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ String dir = null;
+ Iterator> iter = ((IStructuredSelection)selection).iterator();
+ while (iter.hasNext()) {
+ Object element = iter.next();
+
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
+ // If the element is not an IResource, try to adapt to IResource
+ if (!(element instanceof org.eclipse.core.resources.IResource)) {
+ Object adapted = element instanceof IAdaptable ? ((IAdaptable)element).getAdapter(org.eclipse.core.resources.IResource.class) : null;
+ if (adapted == null) adapted = Platform.getAdapterManager().getAdapter(element, org.eclipse.core.resources.IResource.class);
+ if (adapted != null) element = adapted;
+ }
+
+ if (element instanceof org.eclipse.core.resources.IResource && ((org.eclipse.core.resources.IResource)element).exists()) {
+ IPath location = ((org.eclipse.core.resources.IResource)element).getLocation();
+ if (location == null) continue;
+ if (location.toFile().isFile()) location = location.removeLastSegments(1);
+ if (location.toFile().isDirectory() && location.toFile().canRead()) {
+ dir = location.toFile().getAbsolutePath();
+ break;
+ }
+ }
+
+ if (element instanceof IPath || element instanceof File) {
+ File f = element instanceof IPath ? ((IPath)element).toFile() : (File)element;
+ if (f.isDirectory() && f.canRead()) {
+ dir = f.getAbsolutePath();
+ break;
+ }
+ }
+ }
+ }
+ if (dir != null) {
+ properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
+
+ String basename = new Path(dir).lastSegment();
+ properties.put(ITerminalsConnectorConstants.PROP_TITLE, basename + " (" + terminalTitle + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+
+ // Get the terminal service
+ ITerminalService terminal = TerminalServiceFactory.getService();
+ // If not available, we cannot fulfill this request
+ if (terminal != null) {
+ terminal.openConsole(properties, done);
+ }
+ }
+
+ /**
+ * Returns the terminal title string.
+ *
+ * The default implementation constructs a title like "Serial <port> (Start time) ".
+ *
+ * @return The terminal title string or null
.
+ */
+ private String getTerminalTitle(Map properties) {
+ try {
+ String hostname = InetAddress.getLocalHost().getHostName();
+ if (hostname != null && !"".equals(hostname.trim())) { //$NON-NLS-1$
+ return hostname;
+ }
+ } catch (UnknownHostException e) { /* ignored on purpose */ }
+ return "Local"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (IMementoHandler.class.equals(adapter)) {
+ return mementoHandler;
+ }
+ return super.getAdapter(adapter);
+ }
+
+ /**
+ * Returns the default shell to launch. Looks at the environment
+ * variable "SHELL" first before assuming some default default values.
+ *
+ * @return The default shell to launch.
+ */
+ private final File defaultShell() {
+ String shell = null;
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
+ if (System.getenv("ComSpec") != null && !"".equals(System.getenv("ComSpec").trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ shell = System.getenv("ComSpec").trim(); //$NON-NLS-1$
+ } else {
+ shell = "cmd.exe"; //$NON-NLS-1$
+ }
+ }
+ if (shell == null) {
+ shell = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX);
+ if (shell == null || "".equals(shell)) { //$NON-NLS-1$
+ if (System.getenv("SHELL") != null && !"".equals(System.getenv("SHELL").trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ shell = System.getenv("SHELL").trim(); //$NON-NLS-1$
+ } else {
+ shell = "/bin/sh"; //$NON-NLS-1$
+ }
+ }
+ }
+
+ return new File(shell);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map)
+ */
+ @Override
+ public ITerminalConnector createTerminalConnector(Map properties) {
+ Assert.isNotNull(properties);
+
+ // Check for the terminal connector id
+ String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
+ if (connectorId == null) connectorId = "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"; //$NON-NLS-1$
+
+ // Extract the process properties using defaults
+ String image;
+ if (!properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_PATH)
+ || properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH) == null) {
+ File defaultShell = defaultShell();
+ image = defaultShell.isAbsolute() ? defaultShell.getAbsolutePath() : defaultShell.getPath();
+ } else {
+ image = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH);
+ }
+
+ String arguments = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ARGS);
+ if (arguments == null && !Platform.OS_WIN32.equals(Platform.getOS())) {
+ arguments = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX_ARGS);
+ }
+
+ // Determine if a PTY will be used
+ boolean isUsingPTY = (properties.get(ITerminalsConnectorConstants.PROP_PROCESS_OBJ) == null && PTY.isSupported(PTY.Mode.TERMINAL))
+ || properties.get(ITerminalsConnectorConstants.PROP_PTY_OBJ) instanceof PTY;
+
+ boolean localEcho = false;
+ if (!properties.containsKey(ITerminalsConnectorConstants.PROP_LOCAL_ECHO)
+ || !(properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO) instanceof Boolean)) {
+ // On Windows, turn on local echo by default if no PTY is used (bug 433645)
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
+ localEcho = !isUsingPTY;
+ }
+ } else {
+ localEcho = ((Boolean)properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO)).booleanValue();
+ }
+
+ String lineSeparator = null;
+ if (!properties.containsKey(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR)
+ || !(properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR) instanceof String)) {
+ // No line separator will be set if a PTY is used
+ if (!isUsingPTY) {
+ lineSeparator = Platform.OS_WIN32.equals(Platform.getOS()) ? ILineSeparatorConstants.LINE_SEPARATOR_CRLF : ILineSeparatorConstants.LINE_SEPARATOR_LF;
+ }
+ } else {
+ lineSeparator = (String)properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
+ }
+
+ Process process = (Process)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_OBJ);
+ PTY pty = (PTY)properties.get(ITerminalsConnectorConstants.PROP_PTY_OBJ);
+ ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS);
+ ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS);
+ String workingDir = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR);
+
+ String[] envp = null;
+ if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) &&
+ properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) != null &&
+ properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) instanceof String[]){
+ envp = (String[])properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT);
+ }
+
+ // Set the ECLIPSE_HOME and ECLIPSE_WORKSPACE environment variables
+ List envpList = new ArrayList();
+ if (envp != null) envpList.addAll(Arrays.asList(envp));
+
+ // ECLIPSE_HOME
+ String eclipseHomeLocation = System.getProperty("eclipse.home.location"); //$NON-NLS-1$
+ if (eclipseHomeLocation != null) {
+ try {
+ URI uri = URIUtil.fromString(eclipseHomeLocation);
+ File f = URIUtil.toFile(uri);
+ envpList.add("ECLIPSE_HOME=" + f.getAbsolutePath()); //$NON-NLS-1$
+ } catch (URISyntaxException e) { /* ignored on purpose */ }
+ }
+
+ // ECLIPSE_WORKSPACE
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
+ if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null
+ && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null
+ && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
+ envpList.add("ECLIPSE_WORKSPACE=" + org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); //$NON-NLS-1$
+ }
+ }
+
+ // Convert back into a string array
+ envp = envpList.toArray(new String[envpList.size()]);
+
+ Assert.isTrue(image != null || process != null);
+
+ // Construct the terminal settings store
+ ISettingsStore store = new SettingsStore();
+
+ // Construct the process settings
+ ProcessSettings processSettings = new ProcessSettings();
+ processSettings.setImage(image);
+ processSettings.setArguments(arguments);
+ processSettings.setProcess(process);
+ processSettings.setPTY(pty);
+ processSettings.setLocalEcho(localEcho);
+ processSettings.setLineSeparator(lineSeparator);
+ processSettings.setStdOutListeners(stdoutListeners);
+ processSettings.setStdErrListeners(stderrListeners);
+ processSettings.setWorkingDir(workingDir);
+ processSettings.setEnvironment(envp);
+
+ if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT)) {
+ Object value = properties.get(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT);
+ processSettings.setMergeWithNativeEnvironment(value instanceof Boolean ? ((Boolean)value).booleanValue() : false);
+ }
+
+ // And save the settings to the store
+ processSettings.save(store);
+
+ // Construct the terminal connector instance
+ ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId);
+ if (connector != null) {
+ // Apply default settings
+ connector.makeSettingsPage();
+ // And load the real settings
+ connector.load(store);
+ }
+
+ return connector;
+ }
+}
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
new file mode 100644
index 00000000000..aa51e164605
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.terminals.local.launcher;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
+import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPathEditorInput;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Local terminal launcher handler implementation.
+ */
+public class LocalLauncherHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // Get the current selection
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+
+ // If the selection is not a structured selection, check if there is an active
+ // editor and get the path from the editor input
+ if (!(selection instanceof IStructuredSelection)) {
+ IEditorInput input = HandlerUtil.getActiveEditorInput(event);
+ if (input instanceof IPathEditorInput) {
+ IPath path = ((IPathEditorInput)input).getPath();
+ if (path != null) {
+ if (path.toFile().isFile()) path = path.removeLastSegments(1);
+ if (path.toFile().isDirectory() && path.toFile().canRead()) selection = new StructuredSelection(path);
+ }
+ }
+ }
+
+ // Get all applicable launcher delegates for the current selection
+ ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
+ // Find the local terminal launcher delegate
+ ILauncherDelegate delegate = null;
+ for (ILauncherDelegate candidate : delegates) {
+ if ("org.eclipse.tcf.te.ui.terminals.local.launcher.local".equals(candidate.getId())) { //$NON-NLS-1$
+ delegate = candidate;
+ break;
+ }
+ }
+
+ // Launch the local terminal
+ if (delegate != null) {
+ Map properties = new HashMap();
+ properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
+ properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
+
+ delegate.execute(properties, null);
+ }
+
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java
new file mode 100644
index 00000000000..67f5ac618a0
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.terminals.local.launcher;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
+import org.eclipse.ui.IMemento;
+
+/**
+ * Local terminal connection memento handler implementation.
+ */
+public class LocalMementoHandler implements IMementoHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
+ */
+ @Override
+ public void saveState(IMemento memento, Map properties) {
+ Assert.isNotNull(memento);
+ Assert.isNotNull(properties);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
+ */
+ @Override
+ public void restoreState(IMemento memento, Map properties) {
+ Assert.isNotNull(memento);
+ Assert.isNotNull(properties);
+ }
+}
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java
new file mode 100644
index 00000000000..aff56bf5b6a
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2011 - 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.terminals.local.nls;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Process terminal connector plug-in externalized strings management.
+ */
+public class Messages extends NLS {
+
+ // The plug-in resource bundle name
+ private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.local.nls.Messages"; //$NON-NLS-1$
+
+ /**
+ * Static constructor.
+ */
+ static {
+ // Load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ // **** Declare externalized string id's down here *****
+
+ public static String ProcessConnector_error_creatingProcess;
+
+ public static String PreferencePage_label;
+ public static String PreferencePage_executables_label;
+ public static String PreferencePage_executables_column_name_label;
+ public static String PreferencePage_executables_column_path_label;
+ public static String PreferencePage_executables_button_add_label;
+ public static String PreferencePage_executables_button_edit_label;
+ public static String PreferencePage_executables_button_remove_label;
+ public static String PreferencePage_workingDir_label;
+ public static String PreferencePage_workingDir_userhome_label;
+ public static String PreferencePage_workingDir_eclipsehome_label;
+ public static String PreferencePage_workingDir_eclipsews_label;
+ public static String PreferencePage_workingDir_button_browse;
+ public static String PreferencePage_workingDir_note_label;
+ public static String PreferencePage_workingDir_note_text;
+ public static String PreferencePage_workingDir_button_variables;
+ public static String PreferencePage_workingDir_invalid;
+ public static String PreferencePage_command_label;
+ public static String PreferencePage_command_button_browse;
+ public static String PreferencePage_command_invalid;
+ public static String PreferencePage_command_note_label;
+ public static String PreferencePage_command_note_text;
+ public static String PreferencePage_command_arguments_label;
+
+ public static String ExternalExecutablesDialog_title_add;
+ public static String ExternalExecutablesDialog_title_edit;
+ public static String ExternalExecutablesDialog_button_add;
+ public static String ExternalExecutablesDialog_button_browse;
+ public static String ExternalExecutablesDialog_field_path;
+ public static String ExternalExecutablesDialog_field_name;
+ public static String ExternalExecutablesDialog_field_args;
+ public static String ExternalExecutablesDialog_field_icon;
+ public static String ExternalExecutablesDialog_field_translate;
+}
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties
new file mode 100644
index 00000000000..8bc8c292ae5
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties
@@ -0,0 +1,46 @@
+###############################################################################
+# Copyright (c) 2012 - 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
+#
+# Contributors:
+# Wind River Systems - initial API and implementation
+###############################################################################
+
+ProcessConnector_error_creatingProcess=Exception when creating process. Possibly caused by: {0}
+
+ExternalExecutablesDialog_title_add=Add External Executable
+ExternalExecutablesDialog_title_edit=Edit External Executable
+ExternalExecutablesDialog_button_add=Add
+ExternalExecutablesDialog_button_browse=Browse...
+ExternalExecutablesDialog_field_path=Path:
+ExternalExecutablesDialog_field_name=Name:
+ExternalExecutablesDialog_field_args=Arguments:
+ExternalExecutablesDialog_field_icon=Icon:
+ExternalExecutablesDialog_field_translate=Translate Backslashes on Paste
+
+# ----- Preference Pages -----
+
+PreferencePage_label=Local Terminal Settings:
+PreferencePage_executables_label="Show In ..." Custom Entries
+PreferencePage_executables_column_name_label=Name
+PreferencePage_executables_column_path_label=Path
+PreferencePage_executables_button_add_label=Add...
+PreferencePage_executables_button_edit_label=Edit...
+PreferencePage_executables_button_remove_label=Remove
+PreferencePage_workingDir_label=Initial Working Directory
+PreferencePage_workingDir_userhome_label=User home
+PreferencePage_workingDir_eclipsehome_label=Eclipse home
+PreferencePage_workingDir_eclipsews_label=Eclipse workspace
+PreferencePage_workingDir_button_browse=&Browse...
+PreferencePage_workingDir_note_label=Note:
+PreferencePage_workingDir_note_text=The chosen initial working directory might be overwritten by the current selection of the active view.
+PreferencePage_workingDir_button_variables=&Variables...
+PreferencePage_workingDir_invalid=Selected initial working directory is not a directory or is not readable.
+PreferencePage_command_label=Shell Command
+PreferencePage_command_button_browse=&Browse...
+PreferencePage_command_invalid=Selected shell command is not a file or is not readable or executable.
+PreferencePage_command_note_label=Note:
+PreferencePage_command_note_text=Leave the shell command empty to fallback to the SHELL environment variable or if not set, to /bin/sh.
+PreferencePage_command_arguments_label=Arguments:
diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java
new file mode 100644
index 00000000000..6be5842e924
--- /dev/null
+++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.terminals.local.showin;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
+import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
+import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.menus.IWorkbenchContribution;
+import org.eclipse.ui.services.IServiceLocator;
+
+/**
+ * Dynamic "Show In" contribution items implementation.
+ */
+public class DynamicContributionItems extends CompoundContributionItem implements IWorkbenchContribution {
+ // Service locator to located the handler service.
+ protected IServiceLocator serviceLocator;
+ // Reference to the local terminal launcher delegate
+ /* default */ ILauncherDelegate delegate;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator)
+ */
+ @Override
+ public void initialize(IServiceLocator serviceLocator) {
+ this.serviceLocator = serviceLocator;
+
+ // Get the local terminal launcher delegate
+ delegate = LauncherDelegateManager.getInstance().getLauncherDelegate("org.eclipse.tcf.te.ui.terminals.local.launcher.local", false); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
+ */
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ List items = new ArrayList();
+
+ if (delegate != null) {
+ List