1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 07:35:24 +02:00

[fix] Several issue with interoperability if creating new connections from the system connection prompt (remote systems view -> new connection items)

This commit is contained in:
Uwe Stieber 2007-02-26 20:34:55 +00:00
parent 90884afa82
commit ebf3f9c192
3 changed files with 38 additions and 18 deletions

View file

@ -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
*/

View file

@ -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 <code>null</code>.
*/
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);

View file

@ -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)