Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ITerminalsConnectorConstants.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/plugin.xml80
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsWizardConfigurationPanel.java151
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsLauncherDelegate.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/LauncherDelegate.java)165
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialWizardConfigurationPanel.java21
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java784
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java8
14 files changed, 805 insertions, 494 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ITerminalsConnectorConstants.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ITerminalsConnectorConstants.java
index b68928f23..3d2b820e7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ITerminalsConnectorConstants.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ITerminalsConnectorConstants.java
@@ -26,6 +26,11 @@ public interface ITerminalsConnectorConstants {
public static final String PROP_TITLE = "title"; //$NON-NLS-1$
/**
+ * Property: The encoding of the terminal tab to open.
+ */
+ public static final String PROP_ENCODING = "encoding"; //$NON-NLS-1$
+
+ /**
* Property: Custom data object to associate with the terminal tab.
*/
public static final String PROP_DATA = "data"; //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/META-INF/MANIFEST.MF
index 143304e40..fd228119d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/META-INF/MANIFEST.MF
@@ -23,5 +23,6 @@ Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.tcf.terminals.ui.activator;x-internal:=true,
org.eclipse.tcf.te.tcf.terminals.ui.connector,
+ org.eclipse.tcf.te.tcf.terminals.ui.controls,
org.eclipse.tcf.te.tcf.terminals.ui.launcher,
org.eclipse.tcf.te.tcf.terminals.ui.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/plugin.xml
index 3f33082f5..03a38ec60 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/plugin.xml
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Terminal connector contributions -->
- <extension point="org.eclipse.tm.terminal.terminalConnectors">
- <connector
- name="%TerminalConnector.terminals"
- id="org.eclipse.tcf.te.tcf.terminals.ui.TerminalsConnector"
- hidden="true"
- class="org.eclipse.tcf.te.tcf.terminals.ui.connector.TerminalsConnector"/>
- </extension>
-
-<!-- Terminal connector type contributions -->
- <extension point="org.eclipse.tcf.te.ui.terminals.connectorTypes">
- <connectorType
- class="org.eclipse.tcf.te.tcf.terminals.ui.connector.TerminalsConnectorType"
- id="org.eclipse.tcf.te.ui.terminals.type.terminals"
- label="%TerminalsConnectorType.label">
- </connectorType>
- </extension>
-
-<!-- Terminals launcher delegate contributions -->
- <extension point="org.eclipse.tcf.te.ui.terminals.launcherDelegates">
- <delegate
- class="org.eclipse.tcf.te.tcf.terminals.ui.launcher.LauncherDelegate"
- id="org.eclipse.tcf.te.ui.terminals.launcher.tcf"
- label="%launcherDelegate.label">
- <enablement>
- <with variable="selection">
- <count value="1"/>
- <iterate operator="and" ifEmpty="false">
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- </iterate>
- </with>
- </enablement>
- </delegate>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<!-- Terminal connector contributions -->
+ <extension point="org.eclipse.tm.terminal.terminalConnectors">
+ <connector
+ name="%TerminalConnector.terminals"
+ id="org.eclipse.tcf.te.tcf.terminals.ui.TerminalsConnector"
+ hidden="true"
+ class="org.eclipse.tcf.te.tcf.terminals.ui.connector.TerminalsConnector"/>
+ </extension>
+
+<!-- Terminal connector type contributions -->
+ <extension point="org.eclipse.tcf.te.ui.terminals.connectorTypes">
+ <connectorType
+ class="org.eclipse.tcf.te.tcf.terminals.ui.connector.TerminalsConnectorType"
+ id="org.eclipse.tcf.te.ui.terminals.type.terminals"
+ label="%TerminalsConnectorType.label">
+ </connectorType>
+ </extension>
+
+<!-- Terminals launcher delegate contributions -->
+ <extension point="org.eclipse.tcf.te.ui.terminals.launcherDelegates">
+ <delegate
+ class="org.eclipse.tcf.te.tcf.terminals.ui.launcher.TerminalsLauncherDelegate"
+ id="org.eclipse.tcf.te.ui.terminals.launcher.tcf"
+ label="%launcherDelegate.label">
+ <enablement>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ </iterate>
+ </with>
+ </enablement>
+ </delegate>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsWizardConfigurationPanel.java
new file mode 100644
index 000000000..fab2e09f2
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsWizardConfigurationPanel.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.tcf.terminals.ui.controls;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.TypedEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
+import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
+import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * Terminals (TCF) wizard configuration panel implementation.
+ */
+public class TerminalsWizardConfigurationPanel extends AbstractConfigurationPanel implements IDataExchangeNode {
+
+ /**
+ * Constructor.
+ *
+ * @param parentControl The parent control. Must not be <code>null</code>!
+ */
+ public TerminalsWizardConfigurationPanel(BaseDialogPageControl parentControl) {
+ super(parentControl);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
+ */
+ @Override
+ public void setupPanel(Composite parent, FormToolkit toolkit) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayout(new GridLayout());
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ panel.setLayoutData(data);
+
+ // Create the host selection combo
+ if (isWithoutSelection()) createHostsUI(panel, true);
+
+ // Create the encoding selection combo
+ createEncodingUI(panel, false);
+
+ setControl(panel);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
+ */
+ @Override
+ public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataWizardPage#setupData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public void setupData(IPropertiesContainer data) {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataWizardPage#extractData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public void extractData(IPropertiesContainer data) {
+ // set the terminal connector id for terminals (TCF)
+ data.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.tcf.terminals.ui.TerminalsConnector");
+
+ // set the connector type for terminals (TCF)
+ data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.terminals");
+
+ // Extract the encoding
+ data.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
+ }
+
+ /* (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 isEncodingValid();
+ }
+
+ /* (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) {
+ Assert.isNotNull(settings);
+ String encoding = getEncoding();
+ if (encoding != null) {
+ settings.put(getParentControl().prefixDialogSettingsSlotId(ITerminalsConnectorConstants.PROP_ENCODING, idPrefix), encoding);
+ }
+ }
+
+ /* (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) {
+ Assert.isNotNull(settings);
+ String encoding = settings.get(getParentControl().prefixDialogSettingsSlotId(ITerminalsConnectorConstants.PROP_ENCODING, idPrefix));
+ if (encoding != null && encoding.trim().length() > 0) {
+ setEncoding(encoding);
+ }
+ }
+
+ /* (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;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/LauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsLauncherDelegate.java
index 118b24bbc..b69d13f59 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/LauncherDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsLauncherDelegate.java
@@ -1,82 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.tcf.terminals.ui.launcher;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.terminals.core.interfaces.launcher.ITerminalsLauncher;
-import org.eclipse.tcf.te.tcf.terminals.core.launcher.TerminalsLauncher;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
-
-/**
- * Terminals launcher delegate implementation.
- */
-public class LauncherDelegate extends AbstractLauncherDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.controls.BaseDialogPageControl)
- */
- @Override
- public IConfigurationPanel getPanel(BaseDialogPageControl parentControl) {
- return null;
- }
-
- /* (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#execute(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
- */
- @Override
- public void execute(IPropertiesContainer properties, ICallback callback) {
- Assert.isNotNull(properties);
-
- // Get the selection from the properties
- ISelection selection = (ISelection)properties.getProperty("selection"); //$NON-NLS-1$
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object element = ((IStructuredSelection)selection).getFirstElement();
- if (element instanceof IPeerModel) {
- final IPeerModel peerModel = (IPeerModel)element;
- final AtomicReference<IPeer> peer = new AtomicReference<IPeer>();
- if (Protocol.isDispatchThread()) {
- peer.set(peerModel.getPeer());
- } else {
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- peer.set(peerModel.getPeer());
- }
- });
- }
-
- if (peer.get() != null) {
- ITerminalsLauncher launcher = new TerminalsLauncher();
- launcher.launch(peer.get(), properties, callback);
- }
- }
-
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 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.tcf.terminals.ui.launcher;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.terminals.core.interfaces.launcher.ITerminalsLauncher;
+import org.eclipse.tcf.te.tcf.terminals.core.launcher.TerminalsLauncher;
+import org.eclipse.tcf.te.tcf.terminals.ui.controls.TerminalsWizardConfigurationPanel;
+import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
+import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
+
+/**
+ * Terminals (TCF) launcher delegate implementation.
+ */
+public class TerminalsLauncherDelegate extends AbstractLauncherDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.controls.BaseDialogPageControl)
+ */
+ @Override
+ public IConfigurationPanel getPanel(BaseDialogPageControl parentControl) {
+ return new TerminalsWizardConfigurationPanel(parentControl);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration()
+ */
+ @Override
+ public boolean needsUserConfiguration() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IPropertiesContainer properties, ICallback callback) {
+ Assert.isNotNull(properties);
+
+ // Get the selection from the properties
+ ISelection selection = (ISelection)properties.getProperty("selection"); //$NON-NLS-1$
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Object element = ((IStructuredSelection)selection).getFirstElement();
+ if (element instanceof IPeerModel) {
+ final IPeerModel peerModel = (IPeerModel)element;
+ final AtomicReference<IPeer> peer = new AtomicReference<IPeer>();
+ if (Protocol.isDispatchThread()) {
+ peer.set(peerModel.getPeer());
+ } else {
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ peer.set(peerModel.getPeer());
+ }
+ });
+ }
+
+ if (peer.get() != null) {
+ ITerminalsLauncher launcher = new TerminalsLauncher();
+ launcher.launch(peer.get(), properties, callback);
+ }
+ }
+
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialWizardConfigurationPanel.java
index bbb49ad98..6f8f7d5be 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialWizardConfigurationPanel.java
@@ -9,6 +9,7 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.serial.controls;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.TypedEvent;
@@ -49,13 +50,15 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
panel.setLayoutData(data);
- if(isWithoutSelection()){
- createHostsUI(panel);
- }
+ // Create the host selection combo
+ if (isWithoutSelection()) createHostsUI(panel, true);
serialSettingsPage = new SerialLinePanel(new BaseDialogPageControl(), true, true, true);
serialSettingsPage.setupPanel(panel, toolkit);
+ // Create the encoding selection combo
+ createEncodingUI(panel, true);
+
setControl(panel);
}
@@ -87,6 +90,7 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.serial");
serialSettingsPage.extractData(data);
+ data.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
}
/* (non-Javadoc)
@@ -116,7 +120,13 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
*/
@Override
public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ Assert.isNotNull(settings);
serialSettingsPage.doSaveWidgetValues(settings, idPrefix);
+
+ String encoding = getEncoding();
+ if (encoding != null) {
+ settings.put(getParentControl().prefixDialogSettingsSlotId(ITerminalsConnectorConstants.PROP_ENCODING, idPrefix), encoding);
+ }
}
/* (non-Javadoc)
@@ -124,7 +134,12 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
*/
@Override
public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+ Assert.isNotNull(settings);
serialSettingsPage.doRestoreWidgetValues(settings, idPrefix);
+ String encoding = settings.get(getParentControl().prefixDialogSettingsSlotId(ITerminalsConnectorConstants.PROP_ENCODING, idPrefix));
+ if (encoding != null && encoding.trim().length() > 0) {
+ setEncoding(encoding);
+ }
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
index e55d6df61..0ceef4086 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
@@ -61,9 +61,8 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
panel.setLayoutData(data);
- if(isWithoutSelection()){
- createHostsUI(panel);
- }
+ // Create the host selection combo
+ if (isWithoutSelection()) createHostsUI(panel, true);
SshConnector conn = new SshConnector();
sshSettings = (SshSettings) conn.getSshSettings();
@@ -72,6 +71,9 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
sshSettingsPage = conn.makeSettingsPage();
sshSettingsPage.createControl(panel);
+ // Create the encoding selection combo
+ createEncodingUI(panel, true);
+
setControl(panel);
}
@@ -117,6 +119,7 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
data.setProperty(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, sshSettings.getKeepalive());
data.setProperty(ITerminalsConnectorConstants.PROP_SSH_PASSWORD, sshSettings.getPassword());
data.setProperty(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser());
+ data.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
}
/* (non-Javadoc)
@@ -124,9 +127,9 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
*/
@Override
protected void fillSettingsForHost(String host){
- if(host!=null && host.length()!=0){
- if(hostSettingsMap.containsKey(host)){
- Map<String, String> hostSettings=hostSettingsMap.get(host);
+ if (host != null && host.length() != 0){
+ if (hostSettingsMap.containsKey(host)){
+ Map<String, String> hostSettings = hostSettingsMap.get(host);
if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) {
sshSettings.setHost(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST));
}
@@ -146,6 +149,9 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
if (password != null) {
sshSettings.setPassword(password);
}
+ if (hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING) != null) {
+ setEncoding(hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING));
+ }
} else {
sshSettings.setHost(getSelectionHost());
sshSettings.setUser(getDefaultUser());
@@ -164,31 +170,36 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
super.doSaveWidgetValues(settings, idPrefix);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean)
+ */
@Override
protected void saveSettingsForHost(boolean add){
- String host=getHostFromSettings();
- if(host!=null && host.length()!=0){
- if(hostSettingsMap.containsKey(host)){
- Map<String, String> hostSettings=hostSettingsMap.get(host);
+ String host = getHostFromSettings();
+ if (host != null && host.length() != 0) {
+ if (hostSettingsMap.containsKey(host)){
+ Map<String, String> hostSettings = hostSettingsMap.get(host);
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, sshSettings.getHost());
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(sshSettings.getPort()));
hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(sshSettings.getTimeout()));
hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, Integer.toString(sshSettings.getKeepalive()));
hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
- if(sshSettings.getPassword()!=null && sshSettings.getPassword().length()!=0){
+ if (sshSettings.getPassword() != null && sshSettings.getPassword().length() != 0){
saveSecurePassword(host, sshSettings.getPassword());
}
- } else if(add){
- Map<String, String> hostSettings=new HashMap<String, String>();
+ } else if (add) {
+ Map<String, String> hostSettings = new HashMap<String, String>();
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, sshSettings.getHost());
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(sshSettings.getPort()));
hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(sshSettings.getTimeout()));
hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, Integer.toString(sshSettings.getKeepalive()));
hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser());
+ hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
hostSettingsMap.put(host, hostSettings);
- if(sshSettings.getPassword()!=null && sshSettings.getPassword().length()!=0){
+ if (sshSettings.getPassword() != null && sshSettings.getPassword().length() != 0){
saveSecurePassword(host, sshSettings.getPassword());
}
}
@@ -272,7 +283,7 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
*/
@Override
public boolean isValid(){
- return sshSettingsPage.validateSettings();
+ return isEncodingValid() && sshSettingsPage.validateSettings();
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java
index 424a515e5..c93dee6f4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java
@@ -58,9 +58,8 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
panel.setLayoutData(data);
- if(isWithoutSelection()){
- createHostsUI(panel);
- }
+ // Create the host selection combo
+ if (isWithoutSelection()) createHostsUI(panel, true);
TelnetConnector conn = new TelnetConnector();
telnetSettings = (TelnetSettings) conn.getTelnetSettings();
@@ -70,6 +69,9 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
// MWE otherwise we don't get a valid default selection of the combo
telnetSettings.setNetworkPort(NetworkPortMap.PROP_VALUETELNET);
+ // Create the encoding selection combo
+ createEncodingUI(panel, true);
+
setControl(panel);
}
@@ -103,6 +105,7 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
data.setProperty(ITerminalsConnectorConstants.PROP_IP_HOST,telnetSettings.getHost());
data.setProperty(ITerminalsConnectorConstants.PROP_IP_PORT, telnetSettings.getNetworkPort());
data.setProperty(ITerminalsConnectorConstants.PROP_TIMEOUT, telnetSettings.getTimeout());
+ data.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
}
/* (non-Javadoc)
@@ -110,9 +113,9 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
*/
@Override
protected void fillSettingsForHost(String host){
- if(host!=null && host.length()!=0){
- if(hostSettingsMap.containsKey(host)){
- Map<String, String> hostSettings=hostSettingsMap.get(host);
+ if (host != null && host.length() != 0){
+ if (hostSettingsMap.containsKey(host)){
+ Map<String, String> hostSettings = hostSettingsMap.get(host);
if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) {
telnetSettings.setHost(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST));
}
@@ -122,7 +125,10 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
if (hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT) != null) {
telnetSettings.setTimeout(hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT));
}
- } else{
+ if (hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING) != null) {
+ setEncoding(hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING));
+ }
+ } else {
telnetSettings.setHost(getSelectionHost());
// MWE otherwise we don't get a valid default selection of the combo
telnetSettings.setNetworkPort(NetworkPortMap.PROP_VALUETELNET);
@@ -137,18 +143,20 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
*/
@Override
protected void saveSettingsForHost(boolean add){
- String host=getHostFromSettings();
- if(host!=null && host.length()!=0){
- if(hostSettingsMap.containsKey(host)){
+ String host = getHostFromSettings();
+ if(host != null && host.length() != 0) {
+ if (hostSettingsMap.containsKey(host)) {
Map<String, String> hostSettings=hostSettingsMap.get(host);
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost());
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(telnetSettings.getNetworkPort()));
hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(telnetSettings.getTimeout()));
- } else if(add){
+ hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
+ } else if (add) {
Map<String, String> hostSettings=new HashMap<String, String>();
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost());
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(telnetSettings.getNetworkPort()));
hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(telnetSettings.getTimeout()));
+ hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
hostSettingsMap.put(host, hostSettings);
}
}
@@ -159,7 +167,7 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
*/
@Override
public boolean isValid(){
- return telnetSettingsPage.validateSettings();
+ return isEncodingValid() && telnetSettingsPage.validateSettings();
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java
index 8436d2baf..f186f894f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java
@@ -388,12 +388,13 @@ public class ConsoleManager {
*
* @param id The terminals console view id or <code>null</code> to show the default terminals console view.
* @param title The console title. Must not be <code>null</code>.
+ * @param encoding The terminal encoding or <code>null</code>.
* @param connector The terminal connector. Must not be <code>null</code>.
* @param data The custom terminal data node or <code>null</code>.
* @param activate If <code>true</code> activate the console view.
* @param forceNew If <code>true</code> a new console tab is created even if another one matches the criteria.
*/
- public void openConsole(String id, String title, ITerminalConnector connector, Object data, boolean activate, boolean forceNew) {
+ public void openConsole(String id, String title, String encoding, ITerminalConnector connector, Object data, boolean activate, boolean forceNew) {
Assert.isNotNull(title);
Assert.isNotNull(connector);
Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
@@ -423,7 +424,7 @@ public class ConsoleManager {
}
// Create a new tab item
- item = manager.createTabItem(title, connector, data);
+ item = manager.createTabItem(title, encoding, connector, data);
}
// If still null, something went wrong
if (item == null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
index 6684f8f2a..f62a8c4b7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
@@ -35,6 +35,7 @@ public class Messages extends NLS {
public static String AbstractConfigurationPanel_delete;
public static String AbstractConfigurationPanel_deleteButtonTooltip;
public static String AbstractConfigurationPanel_hosts;
+ public static String AbstractConfigurationPanel_encoding;
public static String TabTerminalListener_consoleTerminated;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
index 0b4558afe..4736d0187 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
@@ -13,6 +13,7 @@ AbstractAction_error_commandExecutionFailed="Failed to execute command (id = {0}
AbstractConfigurationPanel_delete=Delete
AbstractConfigurationPanel_deleteButtonTooltip=Delete terminal settings for host
AbstractConfigurationPanel_hosts=Hosts:
+AbstractConfigurationPanel_encoding=Encoding:
TabTerminalListener_consoleTerminated=<terminated> {0}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java
index 85acd228c..5366af511 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java
@@ -1,335 +1,449 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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.panels;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.ui.ISharedImages;
-
-/**
- * Abstract terminal configuration panel implementation.
- */
-public abstract class AbstractConfigurationPanel extends AbstractWizardConfigurationPanel implements IConfigurationPanel {
- private static final String LAST_HOST_TAG = "lastHost";//$NON-NLS-1$
- private static final String HOSTS_TAG = "hosts";//$NON-NLS-1$
- // The selection
- private ISelection selection;
- protected Map<String, Map<String, String>> hostSettingsMap;
- protected Combo hostCombo;
- private Button deleteHostButton;
-
- /**
- * Constructor.
- *
- * @param parentControl The parent control. Must not be <code>null</code>!
- */
- public AbstractConfigurationPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
-
- hostSettingsMap = new HashMap<String, Map<String, String>>();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getSelection()
- */
- @Override
- public ISelection getSelection() {
- return selection;
- }
-
- /**
- * Returns the host name or IP from the current selection.
- *
- * @return The host name or IP, or <code>null</code>.
- */
- public String getSelectionHost() {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object element = ((IStructuredSelection) selection).getFirstElement();
- IPropertiesAccessService service = ServiceManager.getInstance()
- .getService(element, IPropertiesAccessService.class);
- if (service != null) {
- Map<String, String> props = service.getTargetAddress(element);
- if (props != null && props
- .containsKey(IPropertiesAccessServiceConstants.PROP_ADDRESS)) {
- return props.get(IPropertiesAccessServiceConstants.PROP_ADDRESS);
- }
- }
- }
-
- return null;
- }
-
- @Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
-
- String[] hosts = settings.getArray(HOSTS_TAG);
- if (hosts != null) {
- for (int i = 0; i < hosts.length; i++) {
- String hostEntry = hosts[i];
- String[] hostString = hostEntry.split("\\|");//$NON-NLS-1$
- String hostName = hostString[0];
- if (hostString.length == 2) {
- HashMap<String, String> attr = deSerialize(hostString[1]);
- hostSettingsMap.put(hostName, attr);
- }
- else {
- hostSettingsMap.put(hostName, new HashMap<String, String>());
- }
- }
- }
-
- if (!isWithoutSelection()) {
- String host = getSelectionHost();
- if (host != null) {
- fillSettingsForHost(host);
- }
- }
- else {
- if (hostCombo != null) {
- fillCombo();
- String lastHost = settings.get(LAST_HOST_TAG);
- if (lastHost != null) {
- int index = hostCombo.indexOf(lastHost);
- if (index != -1) {
- hostCombo.select(index);
- }
- else {
- hostCombo.select(0);
- }
- }
- else {
- hostCombo.select(0);
- }
- fillSettingsForHost(hostCombo.getText());
- }
- }
- }
-
- protected HashMap<String, String> deSerialize(String hostString) {
- HashMap<String, String> attr = new HashMap<String, String>();
-
- if (hostString.length() != 0) {
- String[] hostAttrs = hostString.split("\\:");//$NON-NLS-1$
- for (int j = 0; j < hostAttrs.length; j = j + 2) {
- String key = hostAttrs[j];
- String value = hostAttrs[j + 1];
- attr.put(key, value);
- }
- }
- return attr;
- }
-
- protected void serialize(Map<String, String> hostEntry, StringBuffer hostString) {
- if (hostEntry.keySet().size() != 0) {
- Iterator<Entry<String, String>> nextHostAttr = hostEntry.entrySet().iterator();
- while (nextHostAttr.hasNext()) {
- Entry<String, String> entry = nextHostAttr.next();
- String attrKey = entry.getKey();
- String attrValue = entry.getValue();
- hostString.append(attrKey + ":" + attrValue + ":");//$NON-NLS-1$ //$NON-NLS-2$
- }
- hostString.deleteCharAt(hostString.length() - 1);
- }
- }
-
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- Iterator<String> nextHost = hostSettingsMap.keySet().iterator();
- String[] hosts = new String[hostSettingsMap.keySet().size()];
- int i = 0;
- while (nextHost.hasNext()) {
- StringBuffer hostString = new StringBuffer();
- String host = nextHost.next();
- hostString.append(host + "|");//$NON-NLS-1$
- Map<String, String> hostEntry = hostSettingsMap.get(host);
- serialize(hostEntry, hostString);
- hosts[i] = hostString.toString();
- i = i + 1;
- }
- settings.put(HOSTS_TAG, hosts);
- if (isWithoutSelection()) {
- if (hostCombo != null) {
- String host = getHostFromSettings();
- if (host != null) settings.put(LAST_HOST_TAG, host);
- }
- }
- }
-
- protected abstract void saveSettingsForHost(boolean add);
-
- protected abstract void fillSettingsForHost(String host);
-
- protected abstract String getHostFromSettings();
-
- protected void removeSecurePassword(String host) {
- // noop by default
- }
-
- protected String getHostFromCombo() {
- if (hostCombo != null) {
- return hostCombo.getText();
- }
- return null;
- }
-
- protected void removeSettingsForHost(String host) {
- if (hostSettingsMap.containsKey(host)) {
- hostSettingsMap.remove(host);
- }
- }
-
- private List<String> getHostList() {
- List<String> hostList = new ArrayList<String>();
- hostList.addAll(hostSettingsMap.keySet());
- return hostList;
- }
-
- public void fillCombo() {
- if (hostCombo != null) {
- hostCombo.removeAll();
- List<String> hostList = getHostList();
- Collections.sort(hostList);
- Iterator<String> nextHost = hostList.iterator();
- while (nextHost.hasNext()) {
- String host = nextHost.next();
- hostCombo.add(host);
- }
- if (hostList.size() <= 1) {
- hostCombo.setEnabled(false);
- }
- else {
- hostCombo.setEnabled(true);
-
- }
- if (deleteHostButton != null) {
- if (hostList.size() == 0) {
- deleteHostButton.setEnabled(false);
- }
- else {
- deleteHostButton.setEnabled(true);
- }
- }
- }
- }
-
- public boolean isWithoutSelection() {
- ISelection selection = getSelection();
- if (selection == null) {
- return true;
- }
- if (selection instanceof IStructuredSelection && selection.isEmpty()) {
- return true;
- }
- return false;
- }
-
- public boolean isWithHostList() {
- return true;
- }
-
- protected void createHostsUI(Composite parent) {
- if (isWithoutSelection() && isWithHostList()) {
- Composite comboComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- comboComposite.setLayout(layout);
- comboComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- Label label = new Label(comboComposite, SWT.HORIZONTAL);
- label.setText(Messages.AbstractConfigurationPanel_hosts);
-
- hostCombo = new Combo(comboComposite, SWT.READ_ONLY);
- hostCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- hostCombo.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- String host = SWTControlUtil.getText(hostCombo);
- fillSettingsForHost(host);
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- deleteHostButton = new Button(comboComposite, SWT.NONE);
- // deleteHostButton.setText(Messages.AbstractConfigurationPanel_delete);
-
- ISharedImages workbenchImages = UIPlugin.getDefault().getWorkbench().getSharedImages();
- deleteHostButton.setImage(workbenchImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE).createImage());
-
- deleteHostButton.setToolTipText(Messages.AbstractConfigurationPanel_deleteButtonTooltip);
- deleteHostButton.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- String host = getHostFromCombo();
- if (host != null && host.length() != 0) {
- removeSettingsForHost(host);
- removeSecurePassword(host);
- fillCombo();
- SWTControlUtil.select(hostCombo, 0);
- host = getHostFromCombo();
- if (host != null && host.length() != 0) {
- fillSettingsForHost(host);
- }
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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.panels;
+
+import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
+import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
+import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
+import org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel;
+import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
+import org.eclipse.tcf.te.ui.terminals.nls.Messages;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.ide.IDEEncoding;
+
+/**
+ * Abstract terminal configuration panel implementation.
+ */
+public abstract class AbstractConfigurationPanel extends AbstractWizardConfigurationPanel implements IConfigurationPanel {
+ private static final String LAST_HOST_TAG = "lastHost";//$NON-NLS-1$
+ private static final String HOSTS_TAG = "hosts";//$NON-NLS-1$
+
+ // The sub-controls
+ /* default */ Combo hostCombo;
+ private Button deleteHostButton;
+ private Combo encodingCombo;
+
+ // The selection
+ private ISelection selection;
+ // A map containing the settings per host
+ protected final Map<String, Map<String, String>> hostSettingsMap = new HashMap<String, Map<String, String>>();
+
+ /**
+ * Constructor.
+ *
+ * @param parentControl The parent control. Must not be <code>null</code>!
+ */
+ public AbstractConfigurationPanel(BaseDialogPageControl parentControl) {
+ super(parentControl);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setSelection(org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void setSelection(ISelection selection) {
+ this.selection = selection;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getSelection()
+ */
+ @Override
+ public ISelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * Returns the host name or IP from the current selection.
+ *
+ * @return The host name or IP, or <code>null</code>.
+ */
+ public String getSelectionHost() {
+ ISelection selection = getSelection();
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Object element = ((IStructuredSelection) selection).getFirstElement();
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(element, IPropertiesAccessService.class);
+ if (service != null) {
+ Map<String, String> props = service.getTargetAddress(element);
+ if (props != null && props.containsKey(IPropertiesAccessServiceConstants.PROP_ADDRESS)) {
+ return props.get(IPropertiesAccessServiceConstants.PROP_ADDRESS);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+
+ String[] hosts = settings.getArray(HOSTS_TAG);
+ if (hosts != null) {
+ for (int i = 0; i < hosts.length; i++) {
+ String hostEntry = hosts[i];
+ String[] hostString = hostEntry.split("\\|");//$NON-NLS-1$
+ String hostName = hostString[0];
+ if (hostString.length == 2) {
+ HashMap<String, String> attr = deSerialize(hostString[1]);
+ hostSettingsMap.put(hostName, attr);
+ }
+ else {
+ hostSettingsMap.put(hostName, new HashMap<String, String>());
+ }
+ }
+ }
+
+ if (!isWithoutSelection()) {
+ String host = getSelectionHost();
+ if (host != null) {
+ fillSettingsForHost(host);
+ }
+ }
+ else {
+ if (hostCombo != null) {
+ fillHostCombo();
+ String lastHost = settings.get(LAST_HOST_TAG);
+ if (lastHost != null) {
+ int index = hostCombo.indexOf(lastHost);
+ if (index != -1) {
+ hostCombo.select(index);
+ }
+ else {
+ hostCombo.select(0);
+ }
+ }
+ else {
+ hostCombo.select(0);
+ }
+ fillSettingsForHost(hostCombo.getText());
+ }
+ }
+ }
+
+ protected HashMap<String, String> deSerialize(String hostString) {
+ HashMap<String, String> attr = new HashMap<String, String>();
+
+ if (hostString.length() != 0) {
+ String[] hostAttrs = hostString.split("\\:");//$NON-NLS-1$
+ for (int j = 0; j < hostAttrs.length; j = j + 2) {
+ String key = hostAttrs[j];
+ String value = hostAttrs[j + 1];
+ attr.put(key, value);
+ }
+ }
+ return attr;
+ }
+
+ protected void serialize(Map<String, String> hostEntry, StringBuffer hostString) {
+ if (hostEntry.keySet().size() != 0) {
+ Iterator<Entry<String, String>> nextHostAttr = hostEntry.entrySet().iterator();
+ while (nextHostAttr.hasNext()) {
+ Entry<String, String> entry = nextHostAttr.next();
+ String attrKey = entry.getKey();
+ String attrValue = entry.getValue();
+ hostString.append(attrKey + ":" + attrValue + ":");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ hostString.deleteCharAt(hostString.length() - 1);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ Iterator<String> nextHost = hostSettingsMap.keySet().iterator();
+ String[] hosts = new String[hostSettingsMap.keySet().size()];
+ int i = 0;
+ while (nextHost.hasNext()) {
+ StringBuffer hostString = new StringBuffer();
+ String host = nextHost.next();
+ hostString.append(host + "|");//$NON-NLS-1$
+ Map<String, String> hostEntry = hostSettingsMap.get(host);
+ serialize(hostEntry, hostString);
+ hosts[i] = hostString.toString();
+ i = i + 1;
+ }
+ settings.put(HOSTS_TAG, hosts);
+ if (isWithoutSelection()) {
+ if (hostCombo != null) {
+ String host = getHostFromSettings();
+ if (host != null) settings.put(LAST_HOST_TAG, host);
+ }
+ }
+ }
+
+ protected abstract void saveSettingsForHost(boolean add);
+
+ protected abstract void fillSettingsForHost(String host);
+
+ protected abstract String getHostFromSettings();
+
+ protected void removeSecurePassword(String host) {
+ // noop by default
+ }
+
+ protected String getHostFromCombo() {
+ if (hostCombo != null) {
+ return hostCombo.getText();
+ }
+ return null;
+ }
+
+ protected void removeSettingsForHost(String host) {
+ if (hostSettingsMap.containsKey(host)) {
+ hostSettingsMap.remove(host);
+ }
+ }
+
+ private List<String> getHostList() {
+ List<String> hostList = new ArrayList<String>();
+ hostList.addAll(hostSettingsMap.keySet());
+ return hostList;
+ }
+
+ /**
+ * Fill the host combo with the stored per host setting names.
+ */
+ protected void fillHostCombo() {
+ if (hostCombo != null) {
+ hostCombo.removeAll();
+ List<String> hostList = getHostList();
+ Collections.sort(hostList);
+ Iterator<String> nextHost = hostList.iterator();
+ while (nextHost.hasNext()) {
+ String host = nextHost.next();
+ hostCombo.add(host);
+ }
+ if (hostList.size() <= 1) {
+ hostCombo.setEnabled(false);
+ }
+ else {
+ hostCombo.setEnabled(true);
+
+ }
+ if (deleteHostButton != null) {
+ if (hostList.size() == 0) {
+ deleteHostButton.setEnabled(false);
+ }
+ else {
+ deleteHostButton.setEnabled(true);
+ }
+ }
+ }
+ }
+
+ public boolean isWithoutSelection() {
+ ISelection selection = getSelection();
+ if (selection == null) {
+ return true;
+ }
+ if (selection instanceof IStructuredSelection && selection.isEmpty()) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isWithHostList() {
+ return true;
+ }
+
+ /**
+ * Create the host selection combo.
+ *
+ * @param parent The parent composite. Must not be <code>null</code>.
+ * @param separator If <code>true</code>, a separator will be added after the controls.
+ */
+ protected void createHostsUI(Composite parent, boolean separator) {
+ Assert.isNotNull(parent);
+
+ if (isWithoutSelection() && isWithHostList()) {
+ Composite comboComposite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ comboComposite.setLayout(layout);
+ comboComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Label label = new Label(comboComposite, SWT.HORIZONTAL);
+ label.setText(Messages.AbstractConfigurationPanel_hosts);
+
+ hostCombo = new Combo(comboComposite, SWT.READ_ONLY);
+ hostCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ hostCombo.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String host = SWTControlUtil.getText(hostCombo);
+ fillSettingsForHost(host);
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ deleteHostButton = new Button(comboComposite, SWT.NONE);
+ // deleteHostButton.setText(Messages.AbstractConfigurationPanel_delete);
+
+ ISharedImages workbenchImages = UIPlugin.getDefault().getWorkbench().getSharedImages();
+ deleteHostButton.setImage(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE).createImage());
+
+ deleteHostButton.setToolTipText(Messages.AbstractConfigurationPanel_deleteButtonTooltip);
+ deleteHostButton.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String host = getHostFromCombo();
+ if (host != null && host.length() != 0) {
+ removeSettingsForHost(host);
+ removeSecurePassword(host);
+ fillHostCombo();
+ SWTControlUtil.select(hostCombo, 0);
+ host = getHostFromCombo();
+ if (host != null && host.length() != 0) {
+ fillSettingsForHost(host);
+ }
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ if (separator) {
+ Label sep = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ }
+ }
+ }
+
+ /**
+ * Create the encoding selection combo.
+ *
+ * @param parent The parent composite. Must not be <code>null</code>.
+ * @param separator If <code>true</code>, a separator will be added before the controls.
+ */
+ protected void createEncodingUI(Composite parent, boolean separator) {
+ Assert.isNotNull(parent);
+
+ if (separator) {
+ Label sep = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ }
+
+ Composite panel = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0; layout.marginWidth = 0;
+ panel.setLayout(layout);
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Label label = new Label(panel, SWT.HORIZONTAL);
+ label.setText(Messages.AbstractConfigurationPanel_encoding);
+
+ encodingCombo = new Combo(panel, SWT.READ_ONLY);
+ encodingCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ fillEncodingCombo();
+ }
+
+ /**
+ * Fill the encoding combo.
+ */
+ protected void fillEncodingCombo() {
+ if (encodingCombo != null) {
+ List<String> encodings = new ArrayList<String>();
+
+ // Some hard-coded encodings
+ encodings.add("Default (ISO-8859-1)"); //$NON-NLS-1$
+ encodings.add("UTF-8"); //$NON-NLS-1$
+
+ // The default Eclipse encoding (configured in the preferences)
+ String eclipseEncoding = IDEEncoding.getResourceEncoding();
+ if (eclipseEncoding != null && !encodings.contains(eclipseEncoding)) encodings.add(eclipseEncoding);
+
+ // The default host (Java VM) encoding
+ String hostEncoding = Charset.defaultCharset().displayName();
+ if (!encodings.contains(hostEncoding)) encodings.add(hostEncoding);
+
+ SWTControlUtil.setItems(encodingCombo, encodings.toArray(new String[encodings.size()]));
+ SWTControlUtil.select(encodingCombo, 0);
+ }
+ }
+
+ /**
+ * Select the encoding.
+ *
+ * @param encoding The encoding. Must not be <code>null</code>.
+ */
+ protected void setEncoding(String encoding) {
+ Assert.isNotNull(encoding);
+
+ int index = SWTControlUtil.indexOf(encodingCombo, encoding);
+ if (index != -1) SWTControlUtil.select(encodingCombo, index);
+ else SWTControlUtil.setText(encodingCombo, encoding);
+ }
+
+ /**
+ * Returns the selected encoding.
+ *
+ * @return The selected encoding or <code>null</code>.
+ */
+ protected String getEncoding() {
+ String encoding = SWTControlUtil.getText(encodingCombo);
+ return encoding != null && encoding.startsWith("Default") ? null : encoding; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns if or if not the selected encoding is supported.
+ *
+ * @return <code>True</code> if the selected encoding is supported.
+ */
+ protected boolean isEncodingValid() {
+ try {
+ String encoding = getEncoding();
+ return Charset.isSupported(encoding != null ? encoding : "ISO-8859-1"); //$NON-NLS-1$
+ } catch (IllegalCharsetNameException e) {
+ return false;
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java
index f9b42d84d..3a8e61e29 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java
@@ -175,8 +175,10 @@ public class TerminalService extends AbstractService implements ITerminalService
public void run(String id, String title, ITerminalConnector connector, Object data, ICallback callback) {
// Determine if a new terminal tab shall be enforced
boolean forceNew = properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW);
+ // Determine the terminal encoding
+ String encoding = properties.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING);
// Open the new console
- ConsoleManager.getInstance().openConsole(id, title, connector, data, true, forceNew);
+ ConsoleManager.getInstance().openConsole(id, title, encoding, connector, data, true, forceNew);
// Invoke the callback
if (callback != null) {
callback.done(this, Status.OK_STATUS);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java
index da94eebcc..7316fcf17 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java
@@ -50,7 +50,6 @@ import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDEEncoding;
/**
* Terminals tab folder manager.
@@ -284,13 +283,14 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
* Creates a new tab item with the given title and connector.
*
* @param title The tab title. Must not be <code>null</code>.
+ * @param encoding The terminal encoding or <code>null</code>.
* @param connector The terminal connector. Must not be <code>null</code>.
* @param data The custom terminal data node or <code>null</code>.
*
* @return The created tab item or <code>null</code> if failed.
*/
@SuppressWarnings("unused")
- public CTabItem createTabItem(String title, ITerminalConnector connector, Object data) {
+ public CTabItem createTabItem(String title, String encoding, ITerminalConnector connector, Object data) {
Assert.isNotNull(title);
Assert.isNotNull(connector);
@@ -326,8 +326,8 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
ITerminalViewControl terminal = TerminalViewControlFactory.makeControl(doCreateTerminalTabTerminalListener(item), composite, new ITerminalConnector[] { connector }, true);
// Add the "selection" listener to the terminal control
new TerminalControlSelectionListener(terminal);
- // Use the default Eclipse IDE encoding setting to configure the terminals encoding
- try { terminal.setEncoding(IDEEncoding.getResourceEncoding()); } catch (UnsupportedEncodingException e) { /* ignored on purpose */ }
+ // Configure the terminal encoding
+ try { terminal.setEncoding(encoding); } catch (UnsupportedEncodingException e) { /* ignored on purpose */ }
// Associated the terminal with the tab item
item.setData(terminal);
// Associated the custom data node with the tab item (if any)

Back to the top