1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-14 03:35:37 +02:00

[fix] minor cleanups to initial new connection wizard selection handling + removed deprecates where possible

This commit is contained in:
Uwe Stieber 2007-03-01 10:30:58 +00:00
parent 61f760dc96
commit 474843d022
2 changed files with 22 additions and 10 deletions

View file

@ -370,7 +370,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
// query all affected subsystems for their list of additional wizard pages... // query all affected subsystems for their list of additional wizard pages...
Vector additionalPages = new Vector(); Vector additionalPages = new Vector();
ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry();
ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType.getName(), true); ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, true);
for (int idx = 0; idx < factories.length; idx++) { for (int idx = 0; idx < factories.length; idx++) {
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)factories[idx].getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)factories[idx].getAdapter(ISubSystemConfigurationAdapter.class);

View file

@ -323,6 +323,9 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
container.updateTitleBar(); container.updateTitleBar();
container.updateButtons(); container.updateButtons();
} }
// Save the current selection to the dialog settings
saveWidgetValues();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -331,7 +334,7 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
public void addPages() { public void addPages() {
addPage(mainPage); addPage(mainPage);
// and restore the wizard's selection state from last session // and restore the wizard's selection state from last session
restoreFromDialogSettings(); restoreWidgetValues();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -363,24 +366,33 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
*/ */
public boolean performFinish() { public boolean performFinish() {
// Save the current selection to the dialog settings // Save the current selection to the dialog settings
IDialogSettings dialogSettings = getDialogSettings(); saveWidgetValues();
if (dialogSettings != null && getSelection() instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection)getSelection();
if (selection.getFirstElement() instanceof IRSESystemType) {
dialogSettings.put(LAST_SELECTED_SYSTEM_TYPE_ID, ((IRSESystemType)selection.getFirstElement()).getId());
}
}
if (mainPage != null) mainPage.saveWidgetValues(); if (mainPage != null) mainPage.saveWidgetValues();
return true; return true;
} }
/**
* Save the last selected system type id to the dialog settings.
* Called from <code>onSelectedSystemTypeChanged</code> and <code>
* performFinish</code>.
*/
protected void saveWidgetValues() {
IDialogSettings dialogSettings = getDialogSettings();
if (dialogSettings != null && getSelection() instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection)getSelection();
if (selection.getFirstElement() instanceof IRSESystemType) {
dialogSettings.put(LAST_SELECTED_SYSTEM_TYPE_ID, ((IRSESystemType)selection.getFirstElement()).getId());
}
}
}
/** /**
* Restore the persistent saved wizard state. This method * Restore the persistent saved wizard state. This method
* is called from the wizards constructor. * is called from the wizards constructor.
*/ */
protected void restoreFromDialogSettings() { protected void restoreWidgetValues() {
IDialogSettings dialogSettings = getDialogSettings(); IDialogSettings dialogSettings = getDialogSettings();
if (dialogSettings != null) { if (dialogSettings != null) {
String systemTypeId = dialogSettings.get(LAST_SELECTED_SYSTEM_TYPE_ID); String systemTypeId = dialogSettings.get(LAST_SELECTED_SYSTEM_TYPE_ID);