mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-09 10:05:24 +02:00
Bug 149151 - New Connection: 1st page should use a Listbox for systemtype
This commit is contained in:
parent
71ec46bac5
commit
6266ffaa3e
2 changed files with 57 additions and 8 deletions
|
@ -11,7 +11,7 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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;
|
package org.eclipse.rse.ui;
|
||||||
|
@ -747,6 +747,46 @@ public class SystemWidgetHelpers {
|
||||||
return createPushButton(group, label, listener, tooltip);
|
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
|
* Creates a new listbox instance and sets the default
|
||||||
* layout data.
|
* layout data.
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* 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;
|
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.SystemResources;
|
||||||
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.widgets.Combo;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.List;
|
||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The New Connection Wizard main page that allows selection of system type.
|
* 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 {
|
public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage implements Listener {
|
||||||
|
|
||||||
protected String parentHelpId;
|
protected String parentHelpId;
|
||||||
protected Combo textSystemType;
|
protected List textSystemType;
|
||||||
|
protected Text descriptionSystemType;
|
||||||
protected IWizardPage nextPage;
|
protected IWizardPage nextPage;
|
||||||
protected IRSESystemType[] restrictedSystemTypes;
|
protected IRSESystemType[] restrictedSystemTypes;
|
||||||
|
|
||||||
|
@ -68,7 +70,7 @@ public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage imp
|
||||||
labelSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
|
labelSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
|
||||||
|
|
||||||
if (restrictedSystemTypes == null) {
|
if (restrictedSystemTypes == null) {
|
||||||
textSystemType = SystemWidgetHelpers.createSystemTypeCombo(parent, null);
|
textSystemType = SystemWidgetHelpers.createSystemTypeListBox(parent, null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String[] systemTypeNames = new String[restrictedSystemTypes.length];
|
String[] systemTypeNames = new String[restrictedSystemTypes.length];
|
||||||
|
@ -77,7 +79,7 @@ public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage imp
|
||||||
systemTypeNames[i] = restrictedSystemTypes[i].getName();
|
systemTypeNames[i] = restrictedSystemTypes[i].getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
textSystemType = SystemWidgetHelpers.createSystemTypeCombo(parent, null, systemTypeNames);
|
textSystemType = SystemWidgetHelpers.createSystemTypeListBox(parent, null, systemTypeNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
textSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
|
textSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
|
||||||
|
@ -85,6 +87,10 @@ public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage imp
|
||||||
|
|
||||||
textSystemType.addListener(SWT.Selection, this);
|
textSystemType.addListener(SWT.Selection, this);
|
||||||
|
|
||||||
|
descriptionSystemType = SystemWidgetHelpers.createMultiLineTextField(parent,null,30);
|
||||||
|
descriptionSystemType.setEditable(false);
|
||||||
|
|
||||||
|
|
||||||
return composite_prompts;
|
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
|
// get the new connection wizard delegate for the selected system type and
|
||||||
// ask for the main page
|
// ask for the main page
|
||||||
if (wizard instanceof IRSENewConnectionWizard) {
|
if (wizard instanceof IRSENewConnectionWizard) {
|
||||||
String systemTypeStr = textSystemType.getText();
|
String systemTypeStr = textSystemType.getSelection()[0];
|
||||||
IRSENewConnectionWizard newConnWizard = (IRSENewConnectionWizard)wizard;
|
IRSENewConnectionWizard newConnWizard = (IRSENewConnectionWizard)wizard;
|
||||||
newConnWizard.setSelectedSystemType(RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeStr));
|
newConnWizard.setSelectedSystemType(RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeStr));
|
||||||
return newConnWizard.getDelegate().getMainPage();
|
return newConnWizard.getDelegate().getMainPage();
|
||||||
|
@ -139,10 +145,13 @@ public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage imp
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
|
|
||||||
if (event.type == SWT.Selection && event.widget == textSystemType) {
|
if (event.type == SWT.Selection && event.widget == textSystemType) {
|
||||||
|
|
||||||
|
descriptionSystemType.setText(RSEUIPlugin.getTheSystemRegistry().getSubSystemConfigurationsBySystemType(textSystemType.getSelection()[0])[0].getDescription());
|
||||||
|
|
||||||
IWizard wizard = getWizard();
|
IWizard wizard = getWizard();
|
||||||
|
|
||||||
if (wizard instanceof IRSENewConnectionWizard) {
|
if (wizard instanceof IRSENewConnectionWizard) {
|
||||||
String systemTypeStr = textSystemType.getText();
|
String systemTypeStr = textSystemType.getSelection()[0];
|
||||||
IRSENewConnectionWizard newConnWizard = (IRSENewConnectionWizard)wizard;
|
IRSENewConnectionWizard newConnWizard = (IRSENewConnectionWizard)wizard;
|
||||||
newConnWizard.setSelectedSystemType(RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeStr));
|
newConnWizard.setSelectedSystemType(RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeStr));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue