1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Terminals: Bug 443046 -- Encoding is lost if restoring terminal sessions

This commit is contained in:
Uwe Stieber 2015-02-19 10:02:34 +01:00
parent b643b03b7a
commit 73c38e44c7
2 changed files with 16 additions and 1 deletions

View file

@ -16,7 +16,7 @@ import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
import org.eclipse.ui.IMemento; import org.eclipse.ui.IMemento;
/** /**
* SSH terminal connection memento handler implementation. * Local terminal connection memento handler implementation.
*/ */
public class LocalMementoHandler implements IMementoHandler { public class LocalMementoHandler implements IMementoHandler {

View file

@ -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.interfaces.IMementoHandler;
import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager; import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderToolbarHandler; 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.IMemento;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
/** /**
* Take care of the persisted state handling of the "Terminals" view. * Take care of the persisted state handling of the "Terminals" view.
*/ */
@SuppressWarnings("restriction")
public class TerminalsViewMementoHandler { public class TerminalsViewMementoHandler {
// The list of items to save. See the workbench listener implementation // The list of items to save. See the workbench listener implementation
// in o.e.tcf.te.ui.terminals.activator.UIPlugin. // 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()); 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 // Pass on to the memento handler
mementoHandler.saveState(connectionMemento, properties); mementoHandler.saveState(connectionMemento, properties);
} }
@ -166,6 +176,11 @@ public class TerminalsViewMementoHandler {
properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW)); 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 // Get the terminal launcher delegate
String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID); String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
ILauncherDelegate delegate = delegateId != null ? LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false) : null; ILauncherDelegate delegate = delegateId != null ? LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false) : null;