1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 23:25:26 +02:00

[192202] Default RSE new connection wizard does not allow to query created host instance anymore

This commit is contained in:
Uwe Stieber 2007-06-13 11:59:34 +00:00
parent 9f3d3dec01
commit e2b41135e1
2 changed files with 50 additions and 5 deletions

View file

@ -13,9 +13,11 @@
* Contributors:
* Uwe Stieber (Wind River) - Set action id for identification from plugin.xml menu extensions.
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Uwe Stieber (Wind River) - [192202] Default RSE new connection wizard does not allow to query created host instance anymore
********************************************************************************/
package org.eclipse.rse.ui.actions;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
@ -33,6 +35,7 @@ import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizard;
import org.eclipse.rse.ui.wizards.newconnection.RSEMainNewConnectionWizard;
import org.eclipse.swt.widgets.Shell;
@ -107,6 +110,9 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction {
* Our default implementation is to return <code>RSEMainNewConnectionWizard</code>.
*/
protected IWizard createWizard() {
// reset the output value
setValue(null);
// create the new connection wizard instance.
RSEMainNewConnectionWizard newConnWizard = new RSEMainNewConnectionWizard();
@ -159,6 +165,30 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction {
this.restrictSystemTypesTo = systemTypes;
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.actions.SystemBaseWizardAction#postProcessWizard(org.eclipse.jface.wizard.IWizard)
*/
protected void postProcessWizard(IWizard wizard) {
if (wizard instanceof RSEDefaultNewConnectionWizard) {
setValue(((RSEDefaultNewConnectionWizard)wizard).getCreatedHost());
}
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.actions.SystemBaseWizardAction#getDialogValue(org.eclipse.jface.dialogs.Dialog)
*/
protected Object getDialogValue(Dialog dlg) {
// We have to trick the super implementation a little bit because otherwise
// we do not get access to the current wizard instance. The postProcessWizard
// implementation will use setValue() for pushing the created host instance,
// which in turn we query here again in case the super implementation does
// return null to us (which is the case if the wizard does not implement ISystemWizard,
// what is what we do not want to do in case of RSEDefaultNewConnectionWizard anymore).
Object value = super.getDialogValue(dlg);
if (value == null && getValue() != null) value = getValue();
return value;
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.actions.SystemBaseAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
*/

View file

@ -18,6 +18,7 @@
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
* Uwe Stieber (Wind River) - [192202] Default RSE new connection wizard does not allow to query created host instance anymore
********************************************************************************/
package org.eclipse.rse.ui.wizards.newconnection;
@ -69,6 +70,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
private ISystemProfile privateProfile = null;
private IHost selectedContext = null;
private static String lastProfile = null;
private IHost createdHost = null;
/**
* Constructor.
@ -119,6 +121,9 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
*/
public void addPages() {
try {
// reset the remembered created host instance
createdHost = null;
mainPage = createMainPage(getSystemType());
SystemConnectionForm form = mainPage.getSystemConnectionForm();
@ -329,7 +334,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
try {
IRSESystemType systemType = getSystemType();
SystemConnectionForm form = mainPage.getSystemConnectionForm();
IHost conn = sr.createHost(form.getProfileName(), systemType, form.getConnectionName(), form.getHostName(),
createdHost = sr.createHost(form.getProfileName(), systemType, form.getConnectionName(), form.getHostName(),
form.getConnectionDescription(), form.getDefaultUserId(), form.getUserIdLocation(),
subsystemConfigurationSuppliedWizardPages);
@ -337,15 +342,15 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
cursorSet = false;
// a tweak that is the result of UCD feedback. Phil
if ((conn != null) && SystemPerspectiveHelpers.isRSEPerspectiveActive()) {
if ((createdHost != null) && SystemPerspectiveHelpers.isRSEPerspectiveActive()) {
if (systemType.getId().equals(IRSESystemType.SYSTEMTYPE_ISERIES_ID)) {
ISubSystem[] objSubSystems = sr.getSubSystemsBySubSystemConfigurationCategory("nativefiles", conn); //$NON-NLS-1$
ISubSystem[] objSubSystems = sr.getSubSystemsBySubSystemConfigurationCategory("nativefiles", createdHost); //$NON-NLS-1$
if ((objSubSystems != null) && (objSubSystems.length > 0))// might be in product that doesn't have iSeries plugins
RSEUIPlugin.getTheSystemRegistryUI().expandSubSystem(objSubSystems[0]);
else
RSEUIPlugin.getTheSystemRegistryUI().expandHost(conn);
RSEUIPlugin.getTheSystemRegistryUI().expandHost(createdHost);
} else
RSEUIPlugin.getTheSystemRegistryUI().expandHost(conn);
RSEUIPlugin.getTheSystemRegistryUI().expandHost(createdHost);
}
lastProfile = form.getProfileName();
@ -368,6 +373,16 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
return ok;
}
/**
* Returns the create host instance once the user pressed finished. The created
* host instance will be reset to <code>null</code> once the wizard got disposed.
*
* @return The created host instance or <code>null</code>.
*/
public IHost getCreatedHost() {
return createdHost;
}
/**
* Private method to get all the wizard pages from all the subsystem factories, given a
* system type.