From 6266ffaa3ea7335223d3b31340ab884d95d1788a Mon Sep 17 00:00:00 2001 From: Kushal Munir < kmunir@ca.ibm.com> Date: Fri, 27 Oct 2006 14:45:57 +0000 Subject: [PATCH] Bug 149151 - New Connection: 1st page should use a Listbox for systemtype --- .../eclipse/rse/ui/SystemWidgetHelpers.java | 42 ++++++++++++++++++- .../RSENewConnectionWizardMainPage.java | 23 ++++++---- 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java index 47282acfc8d..4932ccb7f78 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Javier Montalvo Orús (Symbian) - Bug 149151: New Connection first page should use a Listbox for systemtype ********************************************************************************/ package org.eclipse.rse.ui; @@ -747,6 +747,46 @@ public class SystemWidgetHelpers { return createPushButton(group, label, listener, tooltip); } + /** + * Creates a readonly system type listbox. + * Does NOT create the leading prompt or anything except the listbox. + * @param group composite to put the listbox into. + * @param listener object to listen for events. Can be null. + * @return empty listbox + */ + public static List createSystemTypeListBox(Composite group, Listener listener) { + return createSystemTypeListBox(group, listener, null); + } + + /** + * Creates a readonly system type listbox with the given system types. + * Does NOT create the leading prompt or anything except the listbox. + * @param group composite to put the listbox into. + * @param listener object to listen for events. Can be null. + * @param systemTypes array of system types to add to the listbox + * @return listbox containing the given system types + + */ + public static List createSystemTypeListBox(Composite group, Listener listener, String[] systemTypes) { + List list = createListBox(group, listener, false, null, SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP); + String[] typeItems = ((systemTypes == null) ? RSECorePlugin.getDefault().getRegistry().getSystemTypeNames() : systemTypes); + + if (systemTypes == null) { + for (int i = 0; i < typeItems.length; i++) { + ISubSystemConfiguration[] configurations = RSEUIPlugin.getTheSystemRegistry().getSubSystemConfigurationsBySystemType(typeItems[i]); + + if (configurations != null && configurations.length > 0) { + list.add(typeItems[i]); + } + } + } + + list.select(0); + + return list; + } + + /** * Creates a new listbox instance and sets the default * layout data. diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSENewConnectionWizardMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSENewConnectionWizardMainPage.java index d745dc67597..120cde62754 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSENewConnectionWizardMainPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSENewConnectionWizardMainPage.java @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Javier Montalvo Orús (Symbian) - Bug 149151: New Connection first page should use a Listbox for systemtype ********************************************************************************/ package org.eclipse.rse.ui.wizards; @@ -24,12 +24,13 @@ import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.SystemResources; import org.eclipse.rse.ui.SystemWidgetHelpers; import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; /** * The New Connection Wizard main page that allows selection of system type. @@ -37,7 +38,8 @@ import org.eclipse.swt.widgets.Listener; public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage implements Listener { protected String parentHelpId; - protected Combo textSystemType; + protected List textSystemType; + protected Text descriptionSystemType; protected IWizardPage nextPage; protected IRSESystemType[] restrictedSystemTypes; @@ -68,7 +70,7 @@ public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage imp labelSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP); if (restrictedSystemTypes == null) { - textSystemType = SystemWidgetHelpers.createSystemTypeCombo(parent, null); + textSystemType = SystemWidgetHelpers.createSystemTypeListBox(parent, null); } else { String[] systemTypeNames = new String[restrictedSystemTypes.length]; @@ -77,7 +79,7 @@ public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage imp systemTypeNames[i] = restrictedSystemTypes[i].getName(); } - textSystemType = SystemWidgetHelpers.createSystemTypeCombo(parent, null, systemTypeNames); + textSystemType = SystemWidgetHelpers.createSystemTypeListBox(parent, null, systemTypeNames); } textSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP); @@ -85,6 +87,10 @@ public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage imp textSystemType.addListener(SWT.Selection, this); + descriptionSystemType = SystemWidgetHelpers.createMultiLineTextField(parent,null,30); + descriptionSystemType.setEditable(false); + + return composite_prompts; } @@ -123,7 +129,7 @@ public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage imp // get the new connection wizard delegate for the selected system type and // ask for the main page if (wizard instanceof IRSENewConnectionWizard) { - String systemTypeStr = textSystemType.getText(); + String systemTypeStr = textSystemType.getSelection()[0]; IRSENewConnectionWizard newConnWizard = (IRSENewConnectionWizard)wizard; newConnWizard.setSelectedSystemType(RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeStr)); return newConnWizard.getDelegate().getMainPage(); @@ -139,10 +145,13 @@ public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage imp public void handleEvent(Event event) { if (event.type == SWT.Selection && event.widget == textSystemType) { + + descriptionSystemType.setText(RSEUIPlugin.getTheSystemRegistry().getSubSystemConfigurationsBySystemType(textSystemType.getSelection()[0])[0].getDescription()); + IWizard wizard = getWizard(); if (wizard instanceof IRSENewConnectionWizard) { - String systemTypeStr = textSystemType.getText(); + String systemTypeStr = textSystemType.getSelection()[0]; IRSENewConnectionWizard newConnWizard = (IRSENewConnectionWizard)wizard; newConnWizard.setSelectedSystemType(RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeStr)); }