Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-02-19 04:02:34 -0500
committerUwe Stieber2015-02-19 04:02:52 -0500
commitabbb34028ca8e2f480d8282e423eac74b4d13b59 (patch)
tree6dcb906bcae7a9e1138697c9abcef762723f32ba
parent2c8f936daf8b75528eeed662eabb75f00082a14b (diff)
downloadorg.eclipse.tcf-abbb34028ca8e2f480d8282e423eac74b4d13b59.tar.gz
org.eclipse.tcf-abbb34028ca8e2f480d8282e423eac74b4d13b59.tar.xz
org.eclipse.tcf-abbb34028ca8e2f480d8282e423eac74b4d13b59.zip
Terminals: Bug 443046 -- Encoding is lost if restoring terminal sessions
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java2
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java15
2 files changed, 16 insertions, 1 deletions
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java
index f4cbb513e..67f5ac618 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java
@@ -16,7 +16,7 @@ import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
import org.eclipse.ui.IMemento;
/**
- * SSH terminal connection memento handler implementation.
+ * Local terminal connection memento handler implementation.
*/
public class LocalMementoHandler implements IMementoHandler {
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java
index 4fcd76596..c4d419fb0 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java
@@ -25,12 +25,14 @@ import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderToolbarHandler;
+import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.PlatformUI;
/**
* Take care of the persisted state handling of the "Terminals" view.
*/
+@SuppressWarnings("restriction")
public class TerminalsViewMementoHandler {
// The list of items to save. See the workbench listener implementation
// in o.e.tcf.te.ui.terminals.activator.UIPlugin.
@@ -100,6 +102,14 @@ public class TerminalsViewMementoHandler {
connectionMemento.putBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW, ((Boolean)properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW)).booleanValue());
}
+ // Store the current encoding
+ ITerminalViewControl terminal = (ITerminalViewControl)item.getData();
+ String encoding = terminal != null ? terminal.getEncoding() : null;
+ if (encoding == null || "".equals(encoding)) encoding = (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING); //$NON-NLS-1$
+ if (encoding != null && !"".equals(encoding)) { //$NON-NLS-1$
+ connectionMemento.putString(ITerminalsConnectorConstants.PROP_ENCODING, encoding);
+ }
+
// Pass on to the memento handler
mementoHandler.saveState(connectionMemento, properties);
}
@@ -166,6 +176,11 @@ public class TerminalsViewMementoHandler {
properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW));
}
+ // Restore the encoding
+ if (connection.getString(ITerminalsConnectorConstants.PROP_ENCODING) != null) {
+ properties.put(ITerminalsConnectorConstants.PROP_ENCODING, connection.getString(ITerminalsConnectorConstants.PROP_ENCODING));
+ }
+
// Get the terminal launcher delegate
String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
ILauncherDelegate delegate = delegateId != null ? LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false) : null;

Back to the top