diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java new file mode 100644 index 000000000..124fc8b7d --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * 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.ui.terminals.telnet.launcher; + +import org.eclipse.core.runtime.Assert; +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.terminals.interfaces.IMementoHandler; +import org.eclipse.ui.IMemento; + +/** + * Telnet terminal connection memento handler implementation. + */ +public class TelnetMementoHandler implements IMementoHandler { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer) + */ + @Override + public void saveState(IMemento memento, IPropertiesContainer properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + + // Do not write the terminal title to the memento -> needs to + // be recreated at the time of restoration. + memento.putString(ITerminalsConnectorConstants.PROP_IP_HOST, properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST)); + memento.putString(ITerminalsConnectorConstants.PROP_IP_PORT, properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_PORT)); + memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, properties.getIntProperty(ITerminalsConnectorConstants.PROP_TIMEOUT)); + memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, properties.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING)); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer) + */ + @Override + public void restoreState(IMemento memento, IPropertiesContainer properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + + // Restore the terminal properties from the memento + properties.setProperty(ITerminalsConnectorConstants.PROP_IP_HOST, memento.getString(ITerminalsConnectorConstants.PROP_IP_HOST)); + properties.setProperty(ITerminalsConnectorConstants.PROP_IP_PORT, memento.getString(ITerminalsConnectorConstants.PROP_IP_PORT)); + properties.setProperty(ITerminalsConnectorConstants.PROP_TIMEOUT, memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT)); + properties.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING)); + } +} |