Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-01-08 03:20:41 -0500
committerUwe Stieber2013-01-08 03:20:41 -0500
commit8850f5bacb206c639d3ff34094758b256e11d646 (patch)
tree5eb60bf3108c4e232c943b55028b17dc52b3a954
parentb82a0f3aae005d0165a735ae38807ea8689b3cdd (diff)
downloadorg.eclipse.tcf-8850f5bacb206c639d3ff34094758b256e11d646.tar.gz
org.eclipse.tcf-8850f5bacb206c639d3ff34094758b256e11d646.tar.xz
org.eclipse.tcf-8850f5bacb206c639d3ff34094758b256e11d646.zip
Target Explorer: Keep compatible terminal settings data entered by the user if switching the terminal type
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java19
4 files changed, 68 insertions, 2 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java
index f61106b7e..c1e5310fc 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java
@@ -34,6 +34,8 @@ public class BaseWizardConfigurationPanelControl extends BaseDialogPageControl {
private Composite panel;
private StackLayout panelLayout;
+ private IWizardConfigurationPanel activeConfigurationPanel = null;
+
/**
* Constructor.
*
@@ -189,11 +191,21 @@ public class BaseWizardConfigurationPanelControl extends BaseDialogPageControl {
IWizardConfigurationPanel configPanel = getConfigurationPanel(key);
if (configPanel != null && configPanel.getControl() != null) {
+ activeConfigurationPanel = configPanel;
panelLayout.topControl = configPanel.getControl();
panel.layout();
}
}
+ /**
+ * Returns the currently active configuration panel.
+ *
+ * @return The active configuration panel or <code>null</code>.
+ */
+ public IWizardConfigurationPanel getActiveConfigurationPanel() {
+ return activeConfigurationPanel;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.controls.BaseControl#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
*/
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 7ceee8f9f..71479cd65 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
@@ -108,6 +108,30 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
*/
@Override
public void setupData(IPropertiesContainer data) {
+ if (data == null || sshSettings == null || sshSettingsPage == null) return;
+
+ String value = data.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST);
+ if (value != null) sshSettings.setHost(value);
+
+ value = data.getStringProperty(ITerminalsConnectorConstants.PROP_IP_PORT);
+ if (value != null) sshSettings.setPort(value);
+
+ value = data.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT);
+ if (value != null) sshSettings.setTimeout(value);
+
+ value = data.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE);
+ if (value != null) sshSettings.setKeepalive(value);
+
+ value = data.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_PASSWORD);
+ if (value != null) sshSettings.setPassword(value);
+
+ value = data.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_USER);
+ if (value != null) sshSettings.setUser(value);
+
+ value = data.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING);
+ if (value != null) setEncoding(value);
+
+ sshSettingsPage.loadSettings();
}
/**
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 8643a2a33..7d0252504 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
@@ -106,6 +106,21 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
*/
@Override
public void setupData(IPropertiesContainer data) {
+ if (data == null || telnetSettings == null || telnetSettingsPage == null) return;
+
+ String value = data.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST);
+ if (value != null) telnetSettings.setHost(value);
+
+ value = data.getStringProperty(ITerminalsConnectorConstants.PROP_IP_PORT);
+ if (value != null) telnetSettings.setNetworkPort(value);
+
+ value = data.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT);
+ if (value != null) telnetSettings.setTimeout(value);
+
+ value = data.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING);
+ if (value != null) setEncoding(value);
+
+ telnetSettingsPage.loadSettings();
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
index 5df498cbb..05bcfb6dc 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
@@ -297,7 +297,22 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
terminals.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
+ // Get the old panel
+ IWizardConfigurationPanel oldPanel = settings.getActiveConfigurationPanel();
+ // Extract the current settings in an special properties container
+ IPropertiesContainer data = new PropertiesContainer();
+ if (oldPanel instanceof IDataExchangeNode) ((IDataExchangeNode)oldPanel).extractData(data);
+ // Clean out settings which are never passed between the panels
+ data.setProperty(ITerminalsConnectorConstants.PROP_IP_PORT, null);
+ data.setProperty(ITerminalsConnectorConstants.PROP_TIMEOUT, null);
+ data.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, null);
+ data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, null);
+ // Switch to the new panel
settings.showConfigurationPanel(terminals.getText());
+ // Get the new panel
+ IWizardConfigurationPanel newPanel = settings.getActiveConfigurationPanel();
+ // Re-setup the relevant data
+ if (newPanel instanceof IDataExchangeNode) ((IDataExchangeNode)newPanel).setupData(data);
}
});
@@ -421,7 +436,7 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
*/
@Override
public void validate() {
- IWizardConfigurationPanel panel = this.settings.getConfigurationPanel(terminals.getText());
+ IWizardConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
Button okButton = getButton(IDialogConstants.OK_ID);
SWTControlUtil.setEnabled(okButton, panel.isValid());
}
@@ -461,7 +476,7 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
*/
@Override
protected void okPressed() {
- IWizardConfigurationPanel panel = this.settings.getConfigurationPanel(terminals.getText());
+ IWizardConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
if(!panel.isValid()){
MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK);

Back to the top