Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-08-05 04:54:18 -0400
committerUwe Stieber2014-08-05 04:55:34 -0400
commiteaf2aa9db02c6800e565dbac0fc2ffdb67575c81 (patch)
tree0c2ac1b9f57c9c73aa5b630144424859b54aee96
parentd1e9203e54219ac2d5454ea467ede976e1491213 (diff)
downloadorg.eclipse.tcf-eaf2aa9db02c6800e565dbac0fc2ffdb67575c81.tar.gz
org.eclipse.tcf-eaf2aa9db02c6800e565dbac0fc2ffdb67575c81.tar.xz
org.eclipse.tcf-eaf2aa9db02c6800e565dbac0fc2ffdb67575c81.zip
Target Explorer: Fix regression in LaunchTerminalSettingsDialog - Terminal type setting pages not created except for the first shown terminal type
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/controls/TransportSectionTypePanelControl.java9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java19
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/BaseWizardConfigurationPanelControl.java32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java108
6 files changed, 58 insertions, 121 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/controls/TransportSectionTypePanelControl.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/controls/TransportSectionTypePanelControl.java
index c23ecc82f..6f911b916 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/controls/TransportSectionTypePanelControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/controls/TransportSectionTypePanelControl.java
@@ -51,11 +51,10 @@ public class TransportSectionTypePanelControl extends TransportTypePanelControl
if (transportType != null) {
// get the panel for the transport simulator and validate the panel
IWizardConfigurationPanel panel = getConfigurationPanel(transportType);
-
- if (panel != null) {
- valid = panel.isValid();
- setMessage(panel.getMessage(), panel.getMessageType());
- }
+ // getConfigurationPanel(...) always return a non-null value
+ Assert.isNotNull(panel);
+ valid = panel.isValid();
+ setMessage(panel.getMessage(), panel.getMessageType());
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
index cc44714ee..ccc241e8f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
@@ -335,8 +335,7 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo
}
for (String id : transportTypePanelControl.getConfigurationPanelIds()) {
- IWizardConfigurationPanel panel = transportTypePanelControl
- .getConfigurationPanel(id);
+ IWizardConfigurationPanel panel = transportTypePanelControl.getConfigurationPanel(id);
if (panel instanceof IDataExchangeNode3) {
((IDataExchangeNode3) panel).copyData(src, odc);
}
@@ -391,8 +390,7 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo
}
if (transportTypeControl != null) {
- data.setProperty(IPeer.ATTR_TRANSPORT_NAME, transportTypeControl
- .getSelectedTransportType());
+ data.setProperty(IPeer.ATTR_TRANSPORT_NAME, transportTypeControl.getSelectedTransportType());
}
}
@@ -551,10 +549,7 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo
}
if (transportTypePanelControl != null) {
- IWizardConfigurationPanel panel = transportTypePanelControl.getConfigurationPanel(transportType);
- if (panel != null) {
- isDirty |= panel.dataChanged(odc, e);
- }
+ isDirty |= transportTypePanelControl.getConfigurationPanel(transportType).dataChanged(odc, e);
}
}
@@ -591,8 +586,7 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo
}
if (transportTypeControl != null) {
- attributes.setProperty(IPeer.ATTR_TRANSPORT_NAME, transportTypeControl
- .getSelectedTransportType());
+ attributes.setProperty(IPeer.ATTR_TRANSPORT_NAME, transportTypeControl.getSelectedTransportType());
}
}
@@ -608,10 +602,7 @@ public class TransportSection extends AbstractSection implements IDataExchangeNo
boolean enabled = !isReadOnly() && (!(input instanceof IPeerNode) || ((IPeerNode)input).getConnectState() == IConnectable.STATE_DISCONNECTED);
SWTControlUtil.setEnabled(transportTypeControl.getEditFieldControl(), enabled && SWTControlUtil.getItemCount(transportTypeControl.getEditFieldControl()) > 1);
if (transportTypePanelControl != null) {
- IWizardConfigurationPanel panel = transportTypePanelControl.getConfigurationPanel(transportTypeControl.getSelectedTransportType());
- if (panel != null) {
- panel.setEnabled(enabled);
- }
+ transportTypePanelControl.getConfigurationPanel(transportTypeControl.getSelectedTransportType()).setEnabled(enabled);
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
index 7d861e01f..d89872013 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
@@ -149,11 +149,10 @@ public class NewTargetWizardPage extends AbstractValidatingWizardPage implements
if (transportType != null) {
// get the panel for the transport type and validate the panel
IWizardConfigurationPanel panel = getConfigurationPanel(transportType);
-
- if (panel != null) {
- valid = panel.isValid();
- setMessage(panel.getMessage(), panel.getMessageType());
- }
+ // getConfigurationPanel(...) always return a non-null value
+ Assert.isNotNull(panel);
+ valid = panel.isValid();
+ setMessage(panel.getMessage(), panel.getMessageType());
}
}
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 d16d199d3..ed0595345 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
@@ -44,7 +44,10 @@ public class BaseWizardConfigurationPanelControl extends BaseDialogPageControl {
private final AbstractWizardConfigurationPanel EMPTY_PANEL;
- protected class EmptySettingsPanel extends AbstractWizardConfigurationPanel {
+ /**
+ * An empty configuration panel implementation.
+ */
+ private static final class EmptySettingsPanel extends AbstractWizardConfigurationPanel {
/**
* Constructor.
@@ -184,13 +187,22 @@ public class BaseWizardConfigurationPanelControl extends BaseDialogPageControl {
* Returns the wizard configuration panel instance registered for the given configuration panel key.
*
* @param key The key to get the wizard configuration panel for. Must not be <code>null</code>!
- * @return The wizard configuration panel instance or <code>null</code> if the key is unknown.
+ * @return The wizard configuration panel instance or an empty configuration panel if the key is unknown.
*/
public IWizardConfigurationPanel getConfigurationPanel(String key) {
- if (key == null) return EMPTY_PANEL;
- IWizardConfigurationPanel panel = configurationPanels.get(key);
+ IWizardConfigurationPanel panel = key != null ? configurationPanels.get(key) : null;
+ return panel != null ? panel : EMPTY_PANEL;
+ }
- return (panel != null ? panel : EMPTY_PANEL);
+ /**
+ * Returns if or if not the given wizard configuration panel is equal to the
+ * empty configuration panel.
+ *
+ * @param panel The wizard configuration panel or <code>null</code>.
+ * @return <code>True</code> if the wizard configuration panel is equal to the empty configuration panel.
+ */
+ public final boolean isEmptyConfigurationPanel(IWizardConfigurationPanel panel) {
+ return EMPTY_PANEL == panel;
}
/**
@@ -227,7 +239,8 @@ public class BaseWizardConfigurationPanelControl extends BaseDialogPageControl {
if (configurationPanelKeys != null) {
for (int i = 0; i < configurationPanelKeys.length; i++) {
IWizardConfigurationPanel configPanel = getConfigurationPanel(configurationPanelKeys[i]);
- if (configPanel != null) configPanel.setupPanel(parent, toolkit);
+ Assert.isNotNull(configPanel);
+ configPanel.setupPanel(parent, toolkit);
}
}
}
@@ -241,7 +254,8 @@ public class BaseWizardConfigurationPanelControl extends BaseDialogPageControl {
*/
public void showConfigurationPanel(String key) {
IWizardConfigurationPanel configPanel = getConfigurationPanel(key);
- if (configPanel != null && configPanel.getControl() != null) {
+ Assert.isNotNull(configPanel);
+ if (configPanel.getControl() != null) {
activeConfigurationPanel = configPanel;
activeConfigurationPanelKey = key;
panelLayout.topControl = configPanel.getControl();
@@ -275,7 +289,7 @@ public class BaseWizardConfigurationPanelControl extends BaseDialogPageControl {
super.doSaveWidgetValues(settings, idPrefix);
if (settings != null) {
IWizardConfigurationPanel configPanel = getActiveConfigurationPanel();
- if (configPanel != null) {
+ if (configPanel != null && !isEmptyConfigurationPanel(configPanel)) {
IDialogSettings configPanelSettings = settings.getSection(activeConfigurationPanelKey);
if (configPanelSettings == null) configPanelSettings = settings.addNewSection(activeConfigurationPanelKey);
configPanel.doSaveWidgetValues(configPanelSettings, idPrefix);
@@ -292,7 +306,7 @@ public class BaseWizardConfigurationPanelControl extends BaseDialogPageControl {
if (settings != null) {
for (String key : configurationPanels.keySet()) {
IWizardConfigurationPanel configPanel = getConfigurationPanel(key);
- if (configPanel != null) {
+ if (!isEmptyConfigurationPanel(configPanel)) {
IDialogSettings configPanelSettings = settings.getSection(key);
if (configPanelSettings == null) configPanelSettings = settings.addNewSection(key);
configPanel.doRestoreWidgetValues(configPanelSettings, idPrefix);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java
index d22948d30..43ae4a5cc 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java
@@ -508,7 +508,7 @@ public class SerialLinePanel extends AbstractWizardConfigurationPanel implements
}
/**
- * Query the list of serial devices via RXTX.
+ * Query the list of serial devices.
*/
protected void queryAvailableSerialDevices() {
// Avoid printing the library version output to stdout if the platform
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 8b65268c3..128cf7895 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
@@ -26,7 +26,6 @@ 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;
@@ -39,7 +38,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
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;
@@ -53,7 +51,6 @@ import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.interfaces.tracing.ITraceIds;
import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
import org.eclipse.ui.forms.widgets.FormToolkit;
/**
@@ -106,23 +103,24 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
public void showConfigurationPanel(String key) {
// Check if we have to create the panel first
IWizardConfigurationPanel configPanel = getConfigurationPanel(key);
- if (configPanel == null) {
+ if (isEmptyConfigurationPanel(configPanel)) {
// Get the corresponding delegate
ILauncherDelegate delegate = label2delegate.get(key);
Assert.isNotNull(delegate);
- // Get the wizard configuration panel instance
+ // Create the wizard configuration panel instance
configPanel = delegate.getPanel(this);
- if (configPanel == null) configPanel = new EmptySettingsPanel(this);
- // Push the selection to the configuration panel
- ((IConfigurationPanel)configPanel).setSelection(getSelection());
- // Add it
- addConfigurationPanel(key, configPanel);
- // Create the panel controls
- configPanel.setupPanel(getPanel(), getFormToolkit());
- // Restore widget values
- IDialogSettings dialogSettings = LaunchTerminalSettingsDialog.this.settings.getDialogSettings(LaunchTerminalSettingsDialog.this.getDialogSettings());
- IDialogSettings configPanelSettings = dialogSettings != null ? dialogSettings.getSection(key) : null;
- if (configPanelSettings != null) configPanel.doRestoreWidgetValues(configPanelSettings, null);
+ if (configPanel != null) {
+ // Add it to the settings panel control
+ settings.addConfigurationPanel(key, configPanel);
+ // Push the selection to the configuration panel
+ if (configPanel instanceof IConfigurationPanel) ((IConfigurationPanel)configPanel).setSelection(getSelection());
+ // Create the panel controls
+ configPanel.setupPanel(getPanel(), getFormToolkit());
+ // Restore widget values
+ IDialogSettings dialogSettings = LaunchTerminalSettingsDialog.this.settings.getDialogSettings(LaunchTerminalSettingsDialog.this.getDialogSettings());
+ IDialogSettings configPanelSettings = dialogSettings != null ? dialogSettings.getSection(key) : null;
+ if (configPanelSettings != null) configPanel.doRestoreWidgetValues(configPanelSettings, null);
+ }
}
super.showConfigurationPanel(key);
@@ -145,69 +143,6 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
}
/**
- * An empty terminal settings panel.
- */
- protected class EmptySettingsPanel extends AbstractConfigurationPanel {
-
- /**
- * Constructor.
- *
- * @param parentControl The parent control. Must not be <code>null</code>!
- */
- public EmptySettingsPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.tcf.te.ui.controls.interfaces.FormToolkit)
- */
- @SuppressWarnings("synthetic-access")
- @Override
- public void setupPanel(Composite parent, FormToolkit toolkit) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayout(new GridLayout());
- panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Label label = new Label(panel, SWT.HORIZONTAL);
- GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- layoutData.widthHint = convertWidthInCharsToPixels(30);
- layoutData.heightHint = convertHeightInCharsToPixels(5);
- label.setLayoutData(layoutData);
-
- setControl(panel);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
- */
- @Override
- public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
- return false;
- }
-
- @Override
- protected void saveSettingsForHost(boolean add) {
- }
-
- @Override
- protected void fillSettingsForHost(String host) {
- }
-
- @Override
- protected String getHostFromSettings() {
- return null;
- }
-
- @Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- }
-
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- }
- }
-
- /**
* Constructor.
*
* @param shell The parent shell or <code>null</code>.
@@ -342,15 +277,14 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
// Get the corresponding delegate
ILauncherDelegate delegate = label2delegate.get(terminalLabel);
Assert.isNotNull(delegate);
- // Get the wizard configuration panel instance
+ // Create the wizard configuration panel instance
IConfigurationPanel configPanel = delegate.getPanel(settings);
- if (configPanel == null) configPanel = new EmptySettingsPanel(settings);
- // Push the selection to the configuration panel
- Assert.isNotNull(configPanel);
- configPanel.setSelection(getSelection());
- // Add it
- settings.addConfigurationPanel(terminalLabel, configPanel);
- // Attach the listener
+ if (configPanel != null) {
+ // Add it to the settings panel control
+ settings.addConfigurationPanel(terminalLabel, configPanel);
+ // Push the selection to the configuration panel
+ configPanel.setSelection(getSelection());
+ }
}
// Create the toolkit

Back to the top