Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-01-07 02:28:49 -0500
committerUwe Stieber2013-01-07 03:06:59 -0500
commitc3ce4537144aed437e18ef36a49bcd40e440044b (patch)
tree81c6e2959406f1074ac677365ae0098e72747785 /target_explorer
parentd9f4b749a41ee44cc5d27992e10fbf4ab826d380 (diff)
downloadorg.eclipse.tcf-c3ce4537144aed437e18ef36a49bcd40e440044b.tar.gz
org.eclipse.tcf-c3ce4537144aed437e18ef36a49bcd40e440044b.tar.xz
org.eclipse.tcf-c3ce4537144aed437e18ef36a49bcd40e440044b.zip
Target Explorer: Disable the launch terminal settings dialog OK button if the settings panel is not valid for launching.
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialWizardConfigurationPanel.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java16
-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/interfaces/IConfigurationPanel.java66
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java46
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties7
7 files changed, 113 insertions, 44 deletions
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 5ff7fc062..a7d8f375c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2012, 2013 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
@@ -53,7 +53,7 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
// Create the host selection combo
if (isWithoutSelection()) createHostsUI(panel, true);
- serialSettingsPage = new SerialLinePanel(new BaseDialogPageControl(), true, true, true);
+ serialSettingsPage = new SerialLinePanel(getParentControl(), true, true, true);
serialSettingsPage.setupPanel(panel, toolkit);
// Create the encoding selection combo
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 55703444f..168dc0e6c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2011, 2013 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
@@ -23,10 +23,12 @@ 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.swt.widgets.Control;
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.jface.interfaces.IValidatingContainer;
import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage;
import org.eclipse.tm.internal.terminal.ssh.SshConnector;
@@ -68,9 +70,21 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
sshSettings = (SshSettings) conn.getSshSettings();
sshSettings.setHost(getSelectionHost());
sshSettings.setUser(getDefaultUser());
+
sshSettingsPage = conn.makeSettingsPage();
sshSettingsPage.createControl(panel);
+ // Add the listener to the settings page
+ if (getParentControl() instanceof IValidatingContainer) {
+ sshSettingsPage.addListener(new ISettingsPage.Listener() {
+
+ @Override
+ public void onSettingsPageChanged(Control control) {
+ ((IValidatingContainer)getParentControl()).validate();
+ }
+ });
+ }
+
// Create the encoding selection combo
createEncodingUI(panel, true);
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 0ddc34d8f..d72b0f614 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2011, 2013 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
@@ -19,10 +19,12 @@ 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.swt.widgets.Control;
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.jface.interfaces.IValidatingContainer;
import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage;
import org.eclipse.tm.internal.terminal.telnet.NetworkPortMap;
@@ -70,6 +72,17 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
telnetSettingsPage = conn.makeSettingsPage();
telnetSettingsPage.createControl(panel);
+ // Add the listener to the settings page
+ if (getParentControl() instanceof IValidatingContainer) {
+ telnetSettingsPage.addListener(new ISettingsPage.Listener() {
+
+ @Override
+ public void onSettingsPageChanged(Control control) {
+ ((IValidatingContainer)getParentControl()).validate();
+ }
+ });
+ }
+
// Create the encoding selection combo
createEncodingUI(panel, true);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java
index 53d278495..c1bcf12e5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * 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.ui.terminals.interfaces;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel;
-
-/**
- * Terminal launcher configuration panel.
- */
-public interface IConfigurationPanel extends IWizardConfigurationPanel {
-
- /**
- * Set the selection to the configuration panel.
- *
- * @param selection The selection or <code>null</code>.
- */
- public void setSelection(ISelection selection);
-
- /**
- * Returns the selection associated with the configuration panel.
- *
- * @return The selection or <code>null</code>.
- */
- public ISelection getSelection();
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.interfaces;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel;
+
+/**
+ * Terminal launcher configuration panel.
+ */
+public interface IConfigurationPanel extends IWizardConfigurationPanel {
+
+ /**
+ * Set the selection to the configuration panel.
+ *
+ * @param selection The selection or <code>null</code>.
+ */
+ public void setSelection(ISelection selection);
+
+ /**
+ * Returns the selection associated with the configuration panel.
+ *
+ * @return The selection or <code>null</code>.
+ */
+ public ISelection getSelection();
+}
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 a493c5a7f..5df498cbb 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2011, 2013 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
@@ -18,15 +18,18 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.TypedEvent;
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.Control;
@@ -41,6 +44,7 @@ import org.eclipse.tcf.te.ui.controls.BaseWizardConfigurationPanelControl;
import org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel;
import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
import org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog;
+import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
import org.eclipse.tcf.te.ui.terminals.help.IContextHelpIds;
@@ -55,7 +59,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
/**
* Launch terminal settings dialog implementation.
*/
-public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
+public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IValidatingContainer {
// The parent selection
private ISelection selection = null;
@@ -74,7 +78,7 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
/**
* The control managing the terminal setting panels.
*/
- protected class SettingsPanelControl extends BaseWizardConfigurationPanelControl {
+ protected class SettingsPanelControl extends BaseWizardConfigurationPanelControl implements IValidatingContainer {
/**
* Constructor.
@@ -118,6 +122,16 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
}
super.showConfigurationPanel(key);
+
+ validate();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
+ */
+ @Override
+ public void validate() {
+ LaunchTerminalSettingsDialog.this.validate();
}
}
@@ -243,6 +257,19 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
}
/* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ Control composite = super.createContents(parent);
+
+ // Validate the dialog after having created all the content
+ validate();
+
+ return composite;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
@@ -295,6 +322,7 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
configPanel.setSelection(getSelection());
// Add it
settings.addConfigurationPanel(terminalLabel, configPanel);
+ // Attach the listener
}
// Create the toolkit
@@ -389,6 +417,16 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
}
/* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
+ */
+ @Override
+ public void validate() {
+ IWizardConfigurationPanel panel = this.settings.getConfigurationPanel(terminals.getText());
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ SWTControlUtil.setEnabled(okButton, panel.isValid());
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#saveWidgetValues()
*/
@Override
@@ -428,7 +466,7 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
if(!panel.isValid()){
MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText(Messages.LaunchTerminalSettingsDialog_error_title);
- mb.setMessage(Messages.LaunchTerminalSettingsDialog_error_invalidSettings);
+ mb.setMessage(NLS.bind(Messages.LaunchTerminalSettingsDialog_error_invalidSettings, panel.getMessage() != null ? panel.getMessage() : Messages.LaunchTerminalSettingsDialog_error_unknownReason));
mb.open();
return;
}
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 2c982e715..849899188 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2011, 2013 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
@@ -95,6 +95,7 @@ public class Messages extends NLS {
public static String LaunchTerminalSettingsDialog_error_title;
public static String LaunchTerminalSettingsDialog_error_invalidSettings;
+ public static String LaunchTerminalSettingsDialog_error_unknownReason;
public static String EncodingSelectionDialog_title;
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 2ef18b250..b3c8295d7 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
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+# Copyright (c) 2012, 2013 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
@@ -52,7 +52,10 @@ TabScrollLockAction_text=Scroll &Lock
TabScrollLockAction_tooltip=Scroll Lock
LaunchTerminalSettingsDialog_error_title=Terminal Settings
-LaunchTerminalSettingsDialog_error_invalidSettings=The specified settings are invalid, please review or cancel.
+LaunchTerminalSettingsDialog_error_invalidSettings=The specified settings are invalid\n\n\
+{0}\n\n\
+Please review and specify valid settings. Or cancel the settings dialog to abort.
+LaunchTerminalSettingsDialog_error_unknownReason=Cannot determine specifically which setting is invalid.
EncodingSelectionDialog_title=Encoding

Back to the top