diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPromptableAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPromptableAdapter.java index 11ee614d494..0686f6e3342 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPromptableAdapter.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPromptableAdapter.java @@ -105,11 +105,13 @@ public class SystemViewPromptableAdapter */ public Object[] getChildren(IProgressMonitor monitor, IAdaptable element) { + // Note: Do _not_ call promptable.run(getShell()) here. It leads only to + // senseless invocations of the new connection wizard dialog on refreshs! + // It cannot be a desirable effect of refreshing the system view to create + // new connections. We leave the invocation of the dialog to the double + // click handler and the context menu. ISystemPromptableObject promptable = (ISystemPromptableObject)element; - if (!promptable.hasChildren()) - return promptable.run(getShell()); - else - return promptable.getChildren(); + return promptable.getChildren(); } /** @@ -118,8 +120,19 @@ public class SystemViewPromptableAdapter */ public boolean hasChildren(IAdaptable element) { + ISystemPromptableObject promptable = (ISystemPromptableObject)element; + return promptable.hasChildren(); + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#handleDoubleClick(java.lang.Object) + */ + public boolean handleDoubleClick(Object element) { + ISystemPromptableObject promptable = (ISystemPromptableObject)element; + promptable.run(getShell()); return true; } + /** * Return our unique property descriptors */ diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java index a023b95bd97..5e41788e8de 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java @@ -48,7 +48,7 @@ import org.eclipse.rse.ui.messages.SystemMessageDialog; /** - * + * Standard RSE new connection wizard implementation. */ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizard { @@ -104,7 +104,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar IRSESystemType systemType = getSystemType(); mainPage.setTitle(getPageTitle()); mainPage.setSystemType(systemType); - subsystemFactorySuppliedWizardPages = getAdditionalWizardPages(systemType.getName()); + subsystemFactorySuppliedWizardPages = getAdditionalWizardPages(systemType); } } @@ -138,10 +138,12 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar * Creates the wizard's main page. This method is an override from the parent class. */ protected RSEDefaultNewConnectionWizardMainPage createMainPage(IRSESystemType systemType) { - mainPage = new RSEDefaultNewConnectionWizardMainPage(this, getPageTitle(), SystemResources.RESID_NEWCONN_PAGE1_DESCRIPTION); - mainPage.setTitle(getPageTitle()); - mainPage.setSystemType(systemType); - subsystemFactorySuppliedWizardPages = getAdditionalWizardPages(systemType.getName()); + if (mainPage == null) { + mainPage = new RSEDefaultNewConnectionWizardMainPage(this, getPageTitle(), SystemResources.RESID_NEWCONN_PAGE1_DESCRIPTION); + mainPage.setTitle(getPageTitle()); + mainPage.setSystemType(systemType); + subsystemFactorySuppliedWizardPages = systemType != null ? getAdditionalWizardPages(systemType) : null; + } return mainPage; } @@ -354,18 +356,21 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar return ok; } - /* + /** * Private method to get all the wizard pages from all the subsystem factories, given a - * system type. + * system type. + * + * @param systemType The system type to query the additional subsystem service pages for. Must be not null. */ - protected ISystemNewConnectionWizardPage[] getAdditionalWizardPages(String systemType) { + private ISystemNewConnectionWizardPage[] getAdditionalWizardPages(IRSESystemType systemType) { + assert systemType != null; // this query is expensive, so only do it once... subsystemFactorySuppliedWizardPages = (ISystemNewConnectionWizardPage[])ssfWizardPagesPerSystemType.get(systemType); if (subsystemFactorySuppliedWizardPages == null) { // query all affected subsystems for their list of additional wizard pages... Vector additionalPages = new Vector(); ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); - ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, true); + ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType.getName(), true); for (int idx = 0; idx < factories.length; idx++) { ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)factories[idx].getAdapter(ISubSystemConfigurationAdapter.class); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java index 0318c3fd4eb..e8c15a9acf4 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java @@ -87,9 +87,6 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS mainPage = new RSENewConnectionWizardSelectionPage(); initializedWizards.clear(); selectionChangedListener.clear(); - - // and finally restore the wizard state - restoreFromDialogSettings(); } /* (non-Javadoc) @@ -308,7 +305,10 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS } // Initialize the wizard pages and remember which wizard we have initialized already. - if (selectedWizard != null && !initializedWizards.contains(selectedWizard)) { + // Note: Do not call IWizard.addPages() here in case the main wizard is restricted to + // a single system type. The IWizard.addPages() method will be called from the + // enclosing wizard dialog directly instead! + if (!onlySystemType && selectedWizard != null && !initializedWizards.contains(selectedWizard)) { selectedWizard.addPages(); initializedWizards.add(selectedWizard); } @@ -330,6 +330,8 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS */ public void addPages() { addPage(mainPage); + // and restore the wizard's selection state from last session + restoreFromDialogSettings(); } /* (non-Javadoc)