mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-16 05:25:21 +02:00
Extension point for New Connection wizard delegate and implementation
This commit is contained in:
parent
080693364e
commit
5e8dfb9cf8
14 changed files with 1513 additions and 32 deletions
|
@ -43,7 +43,7 @@ import org.eclipse.rse.ui.validators.ValidatorConnectionName;
|
||||||
import org.eclipse.rse.ui.validators.ValidatorUserId;
|
import org.eclipse.rse.ui.validators.ValidatorUserId;
|
||||||
import org.eclipse.rse.ui.widgets.InheritableEntryField;
|
import org.eclipse.rse.ui.widgets.InheritableEntryField;
|
||||||
import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
|
import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
|
||||||
import org.eclipse.rse.ui.wizards.SystemNewConnectionWizard;
|
import org.eclipse.rse.ui.wizards.RSENewConnectionWizard;
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -892,9 +892,9 @@ public class SystemConnectionForm
|
||||||
|
|
||||||
IWizardPage[] pages = null;
|
IWizardPage[] pages = null;
|
||||||
|
|
||||||
if (wizard instanceof SystemNewConnectionWizard) {
|
if (wizard instanceof RSENewConnectionWizard) {
|
||||||
SystemNewConnectionWizard connWizard = (SystemNewConnectionWizard)wizard;
|
RSENewConnectionWizard connWizard = (RSENewConnectionWizard)wizard;
|
||||||
AbstractSystemWizardPage mainPage = (AbstractSystemWizardPage)(connWizard.getMainPage());
|
AbstractSystemWizardPage mainPage = (AbstractSystemWizardPage)(connWizard.getStartingPage());
|
||||||
|
|
||||||
Vector pageList = new Vector();
|
Vector pageList = new Vector();
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.eclipse.rse.ui.ISystemContextMenuConstants;
|
||||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
import org.eclipse.rse.ui.ISystemIconConstants;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
import org.eclipse.rse.ui.SystemResources;
|
import org.eclipse.rse.ui.SystemResources;
|
||||||
import org.eclipse.rse.ui.wizards.SystemNewConnectionWizard;
|
import org.eclipse.rse.ui.wizards.RSENewConnectionWizard;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,19 +102,19 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction
|
||||||
*/
|
*/
|
||||||
protected IWizard createWizard()
|
protected IWizard createWizard()
|
||||||
{
|
{
|
||||||
SystemNewConnectionWizard newConnWizard = new SystemNewConnectionWizard();
|
RSENewConnectionWizard newConnWizard = new RSENewConnectionWizard();
|
||||||
if (!fromPopupMenu && (sp!=null))
|
if (!fromPopupMenu && (sp!=null))
|
||||||
{
|
{
|
||||||
setSelection(sp.getSelection());
|
setSelection(sp.getSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
newConnWizard.setCurrentlySelectedConnection(currConn);
|
// newConnWizard.setCurrentlySelectedConnection(currConn);
|
||||||
if (restrictSystemTypesTo != null)
|
// if (restrictSystemTypesTo != null)
|
||||||
newConnWizard.restrictSystemTypes(restrictSystemTypesTo);
|
// newConnWizard.restrictSystemTypes(restrictSystemTypesTo);
|
||||||
if (defaultHostName != null)
|
// if (defaultHostName != null)
|
||||||
newConnWizard.setHostName(defaultHostName);
|
// newConnWizard.setHostName(defaultHostName);
|
||||||
if (defaultConnectionName != null)
|
// if (defaultConnectionName != null)
|
||||||
newConnWizard.setConnectionName(defaultConnectionName);
|
// newConnWizard.setConnectionName(defaultConnectionName);
|
||||||
return newConnWizard;
|
return newConnWizard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
package org.eclipse.rse.ui.wizards;
|
package org.eclipse.rse.ui.wizards;
|
||||||
import org.eclipse.jface.wizard.IWizard;
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||||
import org.eclipse.rse.ui.SystemConnectionForm;
|
import org.eclipse.rse.ui.SystemConnectionForm;
|
||||||
import org.eclipse.rse.ui.SystemResources;
|
import org.eclipse.rse.ui.SystemResources;
|
||||||
|
@ -98,9 +101,9 @@ public abstract class AbstractSystemNewConnectionWizardPage extends AbstractSyst
|
||||||
/**
|
/**
|
||||||
* Get the parent wizard typed as the SystemNewConnectionWizard
|
* Get the parent wizard typed as the SystemNewConnectionWizard
|
||||||
*/
|
*/
|
||||||
public SystemNewConnectionWizard getNewConnectionWizard()
|
public RSENewConnectionWizard getNewConnectionWizard()
|
||||||
{
|
{
|
||||||
return (SystemNewConnectionWizard)getWizard();
|
return (RSENewConnectionWizard)getWizard();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,11 +111,22 @@ public abstract class AbstractSystemNewConnectionWizardPage extends AbstractSyst
|
||||||
*/
|
*/
|
||||||
public ISystemNewConnectionWizardMainPage getMainPage()
|
public ISystemNewConnectionWizardMainPage getMainPage()
|
||||||
{
|
{
|
||||||
SystemNewConnectionWizard ourWizard = getNewConnectionWizard();
|
RSENewConnectionWizard ourWizard = getNewConnectionWizard();
|
||||||
if (ourWizard != null)
|
if (ourWizard != null) {
|
||||||
return ourWizard.getMainPage();
|
String[] systemTypes = parentFactory.getSystemTypes();
|
||||||
else
|
IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypes[0]);
|
||||||
|
IWizardPage wizardPage = ourWizard.getDelegate(systemType).getMainPage();
|
||||||
|
|
||||||
|
if (wizardPage instanceof ISystemNewConnectionWizardMainPage) {
|
||||||
|
return (ISystemNewConnectionWizardMainPage)wizardPage;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,11 +135,21 @@ public abstract class AbstractSystemNewConnectionWizardPage extends AbstractSyst
|
||||||
*/
|
*/
|
||||||
public SystemConnectionForm getMainPageForm()
|
public SystemConnectionForm getMainPageForm()
|
||||||
{
|
{
|
||||||
SystemNewConnectionWizard ourWizard = getNewConnectionWizard();
|
RSENewConnectionWizard ourWizard = getNewConnectionWizard();
|
||||||
if (ourWizard != null)
|
if (ourWizard != null) {
|
||||||
return ourWizard.getMainPageForm();
|
String[] systemTypes = parentFactory.getSystemTypes();
|
||||||
else
|
IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypes[0]);
|
||||||
return null;
|
IWizardPage wizardPage = ourWizard.getDelegate(systemType).getMainPage();
|
||||||
}
|
|
||||||
|
|
||||||
|
if (wizardPage instanceof RSENewConnectionWizardDefaultDelegateMainPage) {
|
||||||
|
return ((RSENewConnectionWizardDefaultDelegateMainPage)wizardPage).getForm();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -289,7 +289,7 @@ public abstract class AbstractSystemWizard
|
||||||
* For explicitly setting output object after wizard is dismissed. Called in the
|
* For explicitly setting output object after wizard is dismissed. Called in the
|
||||||
* wizard's processFinish method, typically.
|
* wizard's processFinish method, typically.
|
||||||
*/
|
*/
|
||||||
protected void setOutputObject(Object outputObject)
|
public void setOutputObject(Object outputObject)
|
||||||
{
|
{
|
||||||
output = outputObject;
|
output = outputObject;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ public abstract class AbstractSystemWizard
|
||||||
* page's performFinish returned false. Pass the failing page. If it is not the current
|
* page's performFinish returned false. Pass the failing page. If it is not the current
|
||||||
* page, this code will issue msg RSEG1240 "Error on another page" to the user.
|
* page, this code will issue msg RSEG1240 "Error on another page" to the user.
|
||||||
*/
|
*/
|
||||||
protected void setPageError(IWizardPage pageInError)
|
public void setPageError(IWizardPage pageInError)
|
||||||
{
|
{
|
||||||
IWizardPage currentPage = getContainer().getCurrentPage();
|
IWizardPage currentPage = getContainer().getCurrentPage();
|
||||||
if (currentPage != pageInError)
|
if (currentPage != pageInError)
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
|
||||||
|
* This program and the accompanying materials are made available under the terms
|
||||||
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* {Name} (company) - description of contribution.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.rse.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
|
import org.eclipse.ui.INewWizard;
|
||||||
|
|
||||||
|
public interface IRSENewConnectionWizard extends INewWizard {
|
||||||
|
|
||||||
|
public static final String NEW_CONNECTION_WIZARD_DELEGATE_EXTENSION_POINT_ID = "org.eclipse.rse.ui.newConnectionWizardDelegate";
|
||||||
|
|
||||||
|
public IRSENewConnectionWizardDelegate getDelegate(IRSESystemType systemType);
|
||||||
|
|
||||||
|
public void setSystemType(IRSESystemType systemType);
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
|
||||||
|
* This program and the accompanying materials are made available under the terms
|
||||||
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* {Name} (company) - description of contribution.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.rse.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
|
import org.eclipse.rse.model.IHost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for RSE new connection wizard delegate.
|
||||||
|
*/
|
||||||
|
public interface IRSENewConnectionWizardDelegate {
|
||||||
|
|
||||||
|
public void init(RSENewConnectionWizard wizard, IRSESystemType systemType);
|
||||||
|
|
||||||
|
public RSENewConnectionWizard getWizard();
|
||||||
|
|
||||||
|
public IRSESystemType getSystemType();
|
||||||
|
|
||||||
|
public void addPages();
|
||||||
|
|
||||||
|
public boolean performFinish();
|
||||||
|
|
||||||
|
public boolean canFinish();
|
||||||
|
|
||||||
|
public IWizardPage getMainPage();
|
||||||
|
|
||||||
|
public IWizardPage getNextPage(IWizardPage page);
|
||||||
|
|
||||||
|
public IWizardPage getPreviousPage(IWizardPage page);
|
||||||
|
|
||||||
|
public IHost getDummyHost();
|
||||||
|
}
|
|
@ -0,0 +1,532 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
|
||||||
|
* This program and the accompanying materials are made available under the terms
|
||||||
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* {Name} (company) - description of contribution.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.rse.ui.wizards;
|
||||||
|
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
import org.eclipse.jface.wizard.WizardPage;
|
||||||
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
|
import org.eclipse.rse.core.SystemBasePlugin;
|
||||||
|
import org.eclipse.rse.core.SystemPerspectiveHelpers;
|
||||||
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
|
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||||
|
import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
|
||||||
|
import org.eclipse.rse.model.DummyHost;
|
||||||
|
import org.eclipse.rse.model.IHost;
|
||||||
|
import org.eclipse.rse.model.ISystemProfile;
|
||||||
|
import org.eclipse.rse.model.ISystemRegistry;
|
||||||
|
import org.eclipse.rse.model.SystemStartHere;
|
||||||
|
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||||
|
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||||
|
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||||
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
import org.eclipse.rse.ui.SystemConnectionForm;
|
||||||
|
import org.eclipse.rse.ui.SystemResources;
|
||||||
|
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RSEDefaultNewConnectionWizardDelegate extends RSENewConnectionWizardDelegate {
|
||||||
|
|
||||||
|
private RSENewConnectionWizardDefaultDelegateMainPage mainPage;
|
||||||
|
private SystemNewConnectionWizardRenameProfilePage rnmProfilePage;
|
||||||
|
private ISystemNewConnectionWizardPage[] subsystemFactorySuppliedWizardPages;
|
||||||
|
private Hashtable ssfWizardPagesPerSystemType = new Hashtable();
|
||||||
|
private String defaultUserId;
|
||||||
|
private String defaultConnectionName;
|
||||||
|
private String defaultHostName;
|
||||||
|
private String[] activeProfileNames = null;
|
||||||
|
private int privateProfileIndex = -1;
|
||||||
|
private ISystemProfile privateProfile = null;
|
||||||
|
private IHost currentlySelectedConnection = null;
|
||||||
|
private String[] restrictSystemTypesTo;
|
||||||
|
private static String lastProfile = null;
|
||||||
|
private boolean showProfilePageInitially = true;
|
||||||
|
private IHost _dummyHost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public RSEDefaultNewConnectionWizardDelegate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.RSENewConnectionWizardDelegate#init(org.eclipse.rse.ui.wizards.RSENewConnectionWizard, org.eclipse.rse.core.IRSESystemType)
|
||||||
|
*/
|
||||||
|
public void init(RSENewConnectionWizard wizard, IRSESystemType systemType) {
|
||||||
|
super.init(wizard, systemType);
|
||||||
|
restrictSystemType(systemType.getName());
|
||||||
|
activeProfileNames = SystemStartHere.getSystemProfileManager().getActiveSystemProfileNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this to restrict the system type that the user is allowed to choose
|
||||||
|
*/
|
||||||
|
public void restrictSystemType(String systemType)
|
||||||
|
{
|
||||||
|
restrictSystemTypesTo = new String[1];
|
||||||
|
restrictSystemTypesTo[0] = systemType;
|
||||||
|
if (mainPage != null)
|
||||||
|
mainPage.restrictSystemTypes(restrictSystemTypesTo);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Call this to restrict the system types that the user is allowed to choose
|
||||||
|
*/
|
||||||
|
public void restrictSystemTypes(String[] systemTypes)
|
||||||
|
{
|
||||||
|
this.restrictSystemTypesTo = systemTypes;
|
||||||
|
if (mainPage != null)
|
||||||
|
mainPage.restrictSystemTypes(systemTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IHost getDummyHost()
|
||||||
|
{
|
||||||
|
if (_dummyHost == null)
|
||||||
|
{
|
||||||
|
_dummyHost = new DummyHost(mainPage.getHostName(), mainPage.getSystemType());
|
||||||
|
}
|
||||||
|
return _dummyHost;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the wizard pages.
|
||||||
|
* This method is an override from the parent Wizard class.
|
||||||
|
*/
|
||||||
|
public void addPages()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
mainPage = createMainPage(restrictSystemTypesTo);
|
||||||
|
mainPage.setConnectionNameValidators(SystemConnectionForm.getConnectionNameValidators());
|
||||||
|
mainPage.setCurrentlySelectedConnection(currentlySelectedConnection);
|
||||||
|
if (defaultUserId != null)
|
||||||
|
mainPage.setUserId(defaultUserId);
|
||||||
|
if (defaultConnectionName != null)
|
||||||
|
mainPage.setConnectionName(defaultConnectionName);
|
||||||
|
if (defaultHostName != null)
|
||||||
|
mainPage.setHostName(defaultHostName);
|
||||||
|
|
||||||
|
if (restrictSystemTypesTo != null)
|
||||||
|
mainPage.restrictSystemTypes(restrictSystemTypesTo);
|
||||||
|
|
||||||
|
ISystemProfile defaultProfile = SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile();
|
||||||
|
|
||||||
|
showProfilePageInitially = RSEUIPlugin.getDefault().getShowProfilePageInitially();
|
||||||
|
/* DKM - I don't think we should force profiles into the faces of users
|
||||||
|
* we no longer default to "private" so hopefully this would never be
|
||||||
|
* desirable
|
||||||
|
*
|
||||||
|
// if there is a default private profile, we might want to show the rename profile page
|
||||||
|
if (defaultProfile != null)
|
||||||
|
{
|
||||||
|
// make private profile equal to default profile
|
||||||
|
privateProfile = defaultProfile;
|
||||||
|
|
||||||
|
// get the private profile index in the list of active profiles
|
||||||
|
for (int idx=0; (privateProfileIndex<0) && (idx<activeProfileNames.length); idx++)
|
||||||
|
if (activeProfileNames[idx].equals(defaultProfile.getName()))
|
||||||
|
privateProfileIndex = idx;
|
||||||
|
|
||||||
|
// if profile page is to be shown initially, then add the page
|
||||||
|
if (showProfilePageInitially) {
|
||||||
|
rnmProfilePage = new SystemNewConnectionWizardRenameProfilePage(this) ;
|
||||||
|
addPage(rnmProfilePage);
|
||||||
|
}
|
||||||
|
// otherwise, do not add profile page
|
||||||
|
// and set the new private profile name to be the local machine name
|
||||||
|
else {
|
||||||
|
rnmProfilePage = null;
|
||||||
|
|
||||||
|
String initProfileName = RSEUIPlugin.getLocalMachineName();
|
||||||
|
int dotIndex = initProfileName.indexOf('.');
|
||||||
|
|
||||||
|
if (dotIndex != -1) {
|
||||||
|
initProfileName = initProfileName.substring(0, dotIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
setNewPrivateProfileName(initProfileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
mainPage.setProfileNames(activeProfileNames);
|
||||||
|
// if there is no connection currently selected, default the profile to
|
||||||
|
// place the new connection into to be the first of:
|
||||||
|
// 1. the profile the last connection was created in, in this session
|
||||||
|
// 2. the team profile.
|
||||||
|
if (currentlySelectedConnection == null)
|
||||||
|
{
|
||||||
|
if ((lastProfile == null) && (activeProfileNames!=null))
|
||||||
|
{
|
||||||
|
String defaultTeamName = ISystemPreferencesConstants.DEFAULT_TEAMPROFILE;
|
||||||
|
for (int idx=0; (lastProfile==null)&&(idx<activeProfileNames.length); idx++)
|
||||||
|
{
|
||||||
|
if (!activeProfileNames[idx].equals(defaultTeamName))
|
||||||
|
lastProfile = activeProfileNames[idx];
|
||||||
|
}
|
||||||
|
if ((lastProfile == null) && (activeProfileNames.length>0))
|
||||||
|
lastProfile = activeProfileNames[0];
|
||||||
|
}
|
||||||
|
if (lastProfile != null)
|
||||||
|
mainPage.setProfileNamePreSelection(lastProfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// getWizard().addPage((WizardPage)mainPage);
|
||||||
|
|
||||||
|
} catch (Exception exc)
|
||||||
|
{
|
||||||
|
SystemBasePlugin.logError("New connection: Error in createPages: ",exc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the wizard's main page.
|
||||||
|
* This method is an override from the parent class.
|
||||||
|
*/
|
||||||
|
protected RSENewConnectionWizardDefaultDelegateMainPage createMainPage(String[] restrictSystemTypesTo)
|
||||||
|
{
|
||||||
|
String pageTitle = null;
|
||||||
|
if ((restrictSystemTypesTo==null) || (restrictSystemTypesTo.length != 1))
|
||||||
|
pageTitle = SystemResources.RESID_NEWCONN_PAGE1_TITLE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String onlySystemType = restrictSystemTypesTo[0];
|
||||||
|
if (onlySystemType.equals(IRSESystemType.SYSTEMTYPE_LOCAL))
|
||||||
|
pageTitle =SystemResources.RESID_NEWCONN_PAGE1_LOCAL_TITLE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pageTitle =SystemResources.RESID_NEWCONN_PAGE1_REMOTE_TITLE;
|
||||||
|
pageTitle = SystemMessage.sub(pageTitle, "&1", onlySystemType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mainPage = new RSENewConnectionWizardDefaultDelegateMainPage(getWizard(),
|
||||||
|
pageTitle,
|
||||||
|
SystemResources.RESID_NEWCONN_PAGE1_DESCRIPTION);
|
||||||
|
getWizard().setOutputObject(null);
|
||||||
|
return mainPage;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Set the currently selected connection. Used to better default entry fields.
|
||||||
|
*/
|
||||||
|
public void setCurrentlySelectedConnection(IHost conn)
|
||||||
|
{
|
||||||
|
this.currentlySelectedConnection = conn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For "new" mode, allows setting of the initial user Id. Sometimes subsystems
|
||||||
|
* like to have their own default userId preference page option. If so, query
|
||||||
|
* it and set it here by calling this.
|
||||||
|
*/
|
||||||
|
public void setUserId(String userId)
|
||||||
|
{
|
||||||
|
defaultUserId = userId;
|
||||||
|
if (mainPage != null)
|
||||||
|
mainPage.setUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preset the connection name
|
||||||
|
*/
|
||||||
|
public void setConnectionName(String name)
|
||||||
|
{
|
||||||
|
defaultConnectionName = name;
|
||||||
|
if (mainPage != null)
|
||||||
|
mainPage.setConnectionName(name);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Preset the host name
|
||||||
|
*/
|
||||||
|
public void setHostName(String name)
|
||||||
|
{
|
||||||
|
defaultHostName = name;
|
||||||
|
if (mainPage != null)
|
||||||
|
mainPage.setHostName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Completes processing of the wizard. If this
|
||||||
|
* method returns true, the wizard will close;
|
||||||
|
* otherwise, it will stay active.
|
||||||
|
* This method is an override from the parent Wizard class.
|
||||||
|
*
|
||||||
|
* @return whether the wizard finished successfully
|
||||||
|
*/
|
||||||
|
public boolean performFinish()
|
||||||
|
{
|
||||||
|
boolean ok = mainPage.performFinish();
|
||||||
|
if (!ok)
|
||||||
|
getWizard().setPageError((IWizardPage)mainPage);
|
||||||
|
else if (ok && hasAdditionalPages())
|
||||||
|
{
|
||||||
|
for (int idx=0; ok && (idx<subsystemFactorySuppliedWizardPages.length); idx++)
|
||||||
|
{
|
||||||
|
ok = subsystemFactorySuppliedWizardPages[idx].performFinish();
|
||||||
|
if (!ok)
|
||||||
|
getWizard().setPageError(subsystemFactorySuppliedWizardPages[idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
boolean cursorSet = true;
|
||||||
|
getWizard().setBusyCursor(true);
|
||||||
|
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||||
|
|
||||||
|
// if private profile is not null, then we have to rename the private profile
|
||||||
|
// with the new profile name
|
||||||
|
if (privateProfile != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String newName = activeProfileNames[privateProfileIndex];
|
||||||
|
sr.renameSystemProfile(privateProfile, newName);
|
||||||
|
}
|
||||||
|
catch (SystemMessageException exc)
|
||||||
|
{
|
||||||
|
SystemMessageDialog.displayMessage(getWizard().getShell(), exc);
|
||||||
|
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
getWizard().setBusyCursor(false);
|
||||||
|
cursorSet = false;
|
||||||
|
String msg = "Exception renaming profile ";
|
||||||
|
SystemBasePlugin.logError(msg, exc);
|
||||||
|
SystemMessageDialog.displayExceptionMessage(getWizard().getShell(),exc);
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String sysType = mainPage.getSystemType();
|
||||||
|
IHost conn =
|
||||||
|
sr.createHost(mainPage.getProfileName(), sysType,
|
||||||
|
mainPage.getConnectionName(), mainPage.getHostName(),
|
||||||
|
mainPage.getConnectionDescription(), mainPage.getDefaultUserId(),
|
||||||
|
mainPage.getDefaultUserIdLocation(), subsystemFactorySuppliedWizardPages);
|
||||||
|
|
||||||
|
getWizard().setBusyCursor(false);
|
||||||
|
cursorSet = false;
|
||||||
|
|
||||||
|
// a tweak that is the result of UCD feedback. Phil
|
||||||
|
if ((conn!=null) && SystemPerspectiveHelpers.isRSEPerspectiveActive())
|
||||||
|
{
|
||||||
|
if (sysType.equals(IRSESystemType.SYSTEMTYPE_ISERIES))
|
||||||
|
{
|
||||||
|
ISubSystem[] objSubSystems = sr.getSubSystemsBySubSystemConfigurationCategory("nativefiles", conn);
|
||||||
|
if ((objSubSystems != null)
|
||||||
|
&& (objSubSystems.length>0))// might be in product that doesn't have iSeries plugins
|
||||||
|
sr.expandSubSystem(objSubSystems[0]);
|
||||||
|
else
|
||||||
|
sr.expandHost(conn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sr.expandHost(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastProfile = mainPage.getProfileName();
|
||||||
|
getWizard().setOutputObject(conn);
|
||||||
|
} catch (Exception exc)
|
||||||
|
{
|
||||||
|
if (cursorSet)
|
||||||
|
getWizard().setBusyCursor(false);
|
||||||
|
cursorSet = false;
|
||||||
|
String msg = "Exception creating connection ";
|
||||||
|
SystemBasePlugin.logError(msg, exc);
|
||||||
|
SystemMessageDialog.displayExceptionMessage(getWizard().getShell(),exc);
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//getShell().setCursor(null);
|
||||||
|
//busyCursor.dispose();
|
||||||
|
if (cursorSet)
|
||||||
|
getWizard().setBusyCursor(false);
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
// callbacks from rename page
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the new profile name specified on the rename profile page...
|
||||||
|
*/
|
||||||
|
protected void setNewPrivateProfileName(String newName)
|
||||||
|
{
|
||||||
|
activeProfileNames[privateProfileIndex] = newName;
|
||||||
|
if (mainPage != null)
|
||||||
|
{
|
||||||
|
mainPage.setProfileNames(activeProfileNames);
|
||||||
|
mainPage.setProfileNamePreSelection(newName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the main page of this wizard
|
||||||
|
*/
|
||||||
|
public IWizardPage getMainPage()
|
||||||
|
{
|
||||||
|
addPages();
|
||||||
|
return mainPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the form of the main page of this wizard
|
||||||
|
*/
|
||||||
|
public SystemConnectionForm getMainPageForm()
|
||||||
|
{
|
||||||
|
return ((RSENewConnectionWizardDefaultDelegateMainPage)mainPage).getForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// CALLBACKS FROM SYSTEM CONNECTION PAGE...
|
||||||
|
// ----------------------------------------
|
||||||
|
/**
|
||||||
|
* Event: the user has selected a system type.
|
||||||
|
*/
|
||||||
|
public void systemTypeSelected(String systemType, boolean duringInitialization)
|
||||||
|
{
|
||||||
|
subsystemFactorySuppliedWizardPages = getAdditionalWizardPages(systemType);
|
||||||
|
if (!duringInitialization)
|
||||||
|
getWizard().getContainer().updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Private method to get all the wizard pages from all the subsystem factories, given a
|
||||||
|
* system type.
|
||||||
|
*/
|
||||||
|
protected ISystemNewConnectionWizardPage[] getAdditionalWizardPages(String systemType)
|
||||||
|
{
|
||||||
|
// 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);
|
||||||
|
for (int idx=0; idx<factories.length; idx++)
|
||||||
|
{
|
||||||
|
ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)factories[idx].getAdapter(ISubsystemConfigurationAdapter.class);
|
||||||
|
|
||||||
|
IWizardPage[] pages = adapter.getNewConnectionWizardPages(factories[idx], getWizard());
|
||||||
|
if (pages != null)
|
||||||
|
{
|
||||||
|
for (int widx=0; widx<pages.length; widx++)
|
||||||
|
additionalPages.addElement(pages[widx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
subsystemFactorySuppliedWizardPages = new ISystemNewConnectionWizardPage[additionalPages.size()];
|
||||||
|
for (int idx=0; idx<subsystemFactorySuppliedWizardPages.length; idx++)
|
||||||
|
subsystemFactorySuppliedWizardPages[idx] = (ISystemNewConnectionWizardPage)additionalPages.elementAt(idx);
|
||||||
|
ssfWizardPagesPerSystemType.put(systemType, subsystemFactorySuppliedWizardPages);
|
||||||
|
}
|
||||||
|
return subsystemFactorySuppliedWizardPages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if there are additional pages. This decides whether to enable the Next button
|
||||||
|
* on the main page
|
||||||
|
*/
|
||||||
|
protected boolean hasAdditionalPages()
|
||||||
|
{
|
||||||
|
return (subsystemFactorySuppliedWizardPages != null) && (subsystemFactorySuppliedWizardPages.length>0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the first additional page to show when user presses Next on the main page
|
||||||
|
*/
|
||||||
|
protected IWizardPage getFirstAdditionalPage()
|
||||||
|
{
|
||||||
|
if ((subsystemFactorySuppliedWizardPages != null) && (subsystemFactorySuppliedWizardPages.length>0))
|
||||||
|
{
|
||||||
|
IWizardPage previousPage = (IWizardPage)mainPage;
|
||||||
|
for (int idx=0; idx<subsystemFactorySuppliedWizardPages.length; idx++)
|
||||||
|
{
|
||||||
|
subsystemFactorySuppliedWizardPages[idx].setPreviousPage(previousPage);
|
||||||
|
previousPage = subsystemFactorySuppliedWizardPages[idx];
|
||||||
|
}
|
||||||
|
return subsystemFactorySuppliedWizardPages[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------
|
||||||
|
// PARENT INTERCEPTS...
|
||||||
|
// --------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intercept of Wizard method so we can get the Next button behaviour to work right for the
|
||||||
|
* dynamically managed additional wizard pages.
|
||||||
|
*/
|
||||||
|
public IWizardPage getNextPage(IWizardPage page)
|
||||||
|
{
|
||||||
|
if (!hasAdditionalPages() || (page==rnmProfilePage))
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int index = getAdditionalPageIndex(page);
|
||||||
|
if ((index == (subsystemFactorySuppliedWizardPages.length - 1)))
|
||||||
|
// last page or page not found
|
||||||
|
return null;
|
||||||
|
return subsystemFactorySuppliedWizardPages[index + 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.RSENewConnectionWizardDelegate#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
|
||||||
|
*/
|
||||||
|
public IWizardPage getPreviousPage(IWizardPage page) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getAdditionalPageIndex(IWizardPage page)
|
||||||
|
{
|
||||||
|
for (int idx=0; idx<subsystemFactorySuppliedWizardPages.length; idx++)
|
||||||
|
{
|
||||||
|
if (page == subsystemFactorySuppliedWizardPages[idx])
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intercept of Wizard method so we can take into account our additional pages
|
||||||
|
*/
|
||||||
|
public boolean canFinish()
|
||||||
|
{
|
||||||
|
boolean ok = true;
|
||||||
|
if (ok && hasAdditionalPages())
|
||||||
|
{
|
||||||
|
for (int idx=0; ok && (idx<subsystemFactorySuppliedWizardPages.length); idx++)
|
||||||
|
ok = subsystemFactorySuppliedWizardPages[idx].isPageComplete();
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,184 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
|
||||||
|
* This program and the accompanying materials are made available under the terms
|
||||||
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* {Name} (company) - description of contribution.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.rse.ui.wizards;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
|
import org.eclipse.rse.ui.ISystemIconConstants;
|
||||||
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
import org.eclipse.rse.ui.SystemResources;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RSENewConnectionWizard extends AbstractSystemWizard implements IRSENewConnectionWizard {
|
||||||
|
|
||||||
|
private HashMap map;
|
||||||
|
private IRSESystemType systemType;
|
||||||
|
private IRSENewConnectionWizardDelegate delegate;
|
||||||
|
private RSENewConnectionWizardMainPage mainPage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public RSENewConnectionWizard() {
|
||||||
|
super(SystemResources.RESID_NEWCONN_TITLE, RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTIONWIZARD_ID));
|
||||||
|
readWizardDelegateExtensions();
|
||||||
|
setForcePreviousAndNextButtons(true);
|
||||||
|
setNeedsProgressMonitor(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.IRSENewConnectionWizard#setSystemType(org.eclipse.rse.core.IRSESystemType)
|
||||||
|
*/
|
||||||
|
public void setSystemType(IRSESystemType systemType) {
|
||||||
|
this.systemType = systemType;
|
||||||
|
getDelegate(systemType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void readWizardDelegateExtensions() {
|
||||||
|
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||||
|
IConfigurationElement[] elements = registry.getConfigurationElementsFor(NEW_CONNECTION_WIZARD_DELEGATE_EXTENSION_POINT_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the new connection wizard delegate for the system type.
|
||||||
|
* @param systemType the system type for which we need the delegate.
|
||||||
|
*/
|
||||||
|
public IRSENewConnectionWizardDelegate getDelegate(IRSESystemType systemType) {
|
||||||
|
|
||||||
|
if (map != null) {
|
||||||
|
delegate = (IRSENewConnectionWizardDelegate)(map.get(systemType.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delegate == null) {
|
||||||
|
delegate = new RSEDefaultNewConnectionWizardDelegate();
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the wizard
|
||||||
|
delegate.init(this, systemType);
|
||||||
|
|
||||||
|
return delegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.jface.wizard.Wizard#addPages()
|
||||||
|
*/
|
||||||
|
public void addPages() {
|
||||||
|
mainPage = new RSENewConnectionWizardMainPage(this, "Select System Type", "Select a system type");
|
||||||
|
addPage(mainPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.jface.wizard.Wizard#canFinish()
|
||||||
|
*/
|
||||||
|
public boolean canFinish() {
|
||||||
|
|
||||||
|
boolean result = mainPage.isPageComplete();
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
|
||||||
|
if (delegate != null) {
|
||||||
|
result = delegate.canFinish();
|
||||||
|
}
|
||||||
|
// we do not allow wizard to complete if the delegate is not yet available
|
||||||
|
else {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
|
||||||
|
*/
|
||||||
|
public IWizardPage getNextPage(IWizardPage page) {
|
||||||
|
|
||||||
|
if (page == mainPage) {
|
||||||
|
return super.getNextPage(page);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
if (delegate != null) {
|
||||||
|
|
||||||
|
IWizardPage nextPage = delegate.getNextPage(page);
|
||||||
|
|
||||||
|
if (nextPage == null) {
|
||||||
|
return super.getNextPage(page);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nextPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return super.getNextPage(page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.jface.wizard.Wizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
|
||||||
|
*/
|
||||||
|
public IWizardPage getPreviousPage(IWizardPage page) {
|
||||||
|
|
||||||
|
if (page == mainPage) {
|
||||||
|
return super.getPreviousPage(page);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
if (delegate != null) {
|
||||||
|
IWizardPage prevPage = delegate.getPreviousPage(page);
|
||||||
|
|
||||||
|
if (prevPage == null) {
|
||||||
|
return super.getPreviousPage(page);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return prevPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return super.getPreviousPage(page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.jface.wizard.Wizard#performFinish()
|
||||||
|
*/
|
||||||
|
public boolean performFinish() {
|
||||||
|
|
||||||
|
boolean result = mainPage.performFinish();
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
|
||||||
|
if (delegate != null) {
|
||||||
|
result = delegate.performFinish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,358 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
|
||||||
|
* This program and the accompanying materials are made available under the terms
|
||||||
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* {Name} (company) - description of contribution.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.rse.ui.wizards;
|
||||||
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
import org.eclipse.jface.wizard.Wizard;
|
||||||
|
import org.eclipse.rse.model.IHost;
|
||||||
|
import org.eclipse.rse.ui.ISystemConnectionFormCaller;
|
||||||
|
import org.eclipse.rse.ui.ISystemMessages;
|
||||||
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
import org.eclipse.rse.ui.SystemConnectionForm;
|
||||||
|
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
||||||
|
import org.eclipse.rse.ui.validators.ISystemValidator;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default main page of the "New Connection" wizard.
|
||||||
|
* This page asks for the primary information, including:
|
||||||
|
* <ul>
|
||||||
|
* <li>Connection Name
|
||||||
|
* <li>Hostname/IP-address
|
||||||
|
* <li>UserId
|
||||||
|
* <li>Description
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RSENewConnectionWizardDefaultDelegateMainPage
|
||||||
|
//extends WizardPage
|
||||||
|
extends AbstractSystemWizardPage
|
||||||
|
implements ISystemMessages, ISystemNewConnectionWizardMainPage,
|
||||||
|
ISystemMessageLine, ISystemConnectionFormCaller
|
||||||
|
{
|
||||||
|
protected String[] restrictSystemTypesTo;
|
||||||
|
protected SystemConnectionForm form;
|
||||||
|
protected String parentHelpId;
|
||||||
|
protected RSEDefaultNewConnectionWizardDelegate delegate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Use this when you want to supply your own title and
|
||||||
|
* description strings.
|
||||||
|
*/
|
||||||
|
public RSENewConnectionWizardDefaultDelegateMainPage(Wizard wizard,
|
||||||
|
String title,
|
||||||
|
String description)
|
||||||
|
{
|
||||||
|
super(wizard, "NewConnection", title, description);
|
||||||
|
parentHelpId = RSEUIPlugin.HELPPREFIX + "wncc0000";
|
||||||
|
setHelp(parentHelpId);
|
||||||
|
this.delegate = delegate;
|
||||||
|
form = getForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this to restrict the system type that the user is allowed to choose
|
||||||
|
*/
|
||||||
|
public void restrictSystemType(String systemType)
|
||||||
|
{
|
||||||
|
restrictSystemTypesTo = new String[1];
|
||||||
|
restrictSystemTypesTo[0] = systemType;
|
||||||
|
form.restrictSystemTypes(restrictSystemTypesTo);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Call this to restrict the system types that the user is allowed to choose
|
||||||
|
*/
|
||||||
|
public void restrictSystemTypes(String[] systemTypes)
|
||||||
|
{
|
||||||
|
restrictSystemTypesTo = systemTypes;
|
||||||
|
form.restrictSystemTypes(restrictSystemTypesTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the main wizard typed
|
||||||
|
*/
|
||||||
|
private RSEDefaultNewConnectionWizardDelegate getOurWizardDelegate()
|
||||||
|
{
|
||||||
|
IWizard wizard = getWizard();
|
||||||
|
if (wizard instanceof RSEDefaultNewConnectionWizardDelegate)
|
||||||
|
return (RSEDefaultNewConnectionWizardDelegate)wizard;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrride this if you want to supply your own form. This may be called
|
||||||
|
* multiple times so please only instantatiate if the form instance variable
|
||||||
|
* is null, and then return the form instance variable.
|
||||||
|
* @see org.eclipse.rse.ui.SystemConnectionForm
|
||||||
|
*/
|
||||||
|
protected SystemConnectionForm getForm()
|
||||||
|
{
|
||||||
|
if (form == null)
|
||||||
|
form = new SystemConnectionForm(this,this);
|
||||||
|
return form;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Call this to specify a validator for the connection name. It will be called per keystroke.
|
||||||
|
*/
|
||||||
|
public void setConnectionNameValidators(ISystemValidator[] v)
|
||||||
|
{
|
||||||
|
form.setConnectionNameValidators(v);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Call this to specify a validator for the hostname. It will be called per keystroke.
|
||||||
|
*/
|
||||||
|
public void setHostNameValidator(ISystemValidator v)
|
||||||
|
{
|
||||||
|
form.setHostNameValidator(v);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Call this to specify a validator for the userId. It will be called per keystroke.
|
||||||
|
*/
|
||||||
|
public void setUserIdValidator(ISystemValidator v)
|
||||||
|
{
|
||||||
|
form.setUserIdValidator(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method allows setting of the initial user Id. Sometimes subsystems
|
||||||
|
* like to have their own default userId preference page option. If so, query
|
||||||
|
* it and set it here by calling this.
|
||||||
|
*/
|
||||||
|
public void setUserId(String userId)
|
||||||
|
{
|
||||||
|
form.setUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the profile names to show in the combo
|
||||||
|
*/
|
||||||
|
public void setProfileNames(String[] names)
|
||||||
|
{
|
||||||
|
form.setProfileNames(names);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Set the profile name to preselect
|
||||||
|
*/
|
||||||
|
public void setProfileNamePreSelection(String name)
|
||||||
|
{
|
||||||
|
form.setProfileNamePreSelection(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the currently selected connection so as to better initialize input fields
|
||||||
|
*/
|
||||||
|
public void setCurrentlySelectedConnection(IHost connection)
|
||||||
|
{
|
||||||
|
form.setCurrentlySelectedConnection(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preset the connection name
|
||||||
|
*/
|
||||||
|
public void setConnectionName(String name)
|
||||||
|
{
|
||||||
|
form.setConnectionName(name);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Preset the host name
|
||||||
|
*/
|
||||||
|
public void setHostName(String name)
|
||||||
|
{
|
||||||
|
form.setHostName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CreateContents is the one method that must be overridden from the parent class.
|
||||||
|
* In this method, we populate an SWT container with widgets and return the container
|
||||||
|
* to the caller (JFace). This is used as the contents of this page.
|
||||||
|
*/
|
||||||
|
public Control createContents(Composite parent)
|
||||||
|
{
|
||||||
|
return form.createContents(parent, SystemConnectionForm.CREATE_MODE, parentHelpId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return the Control to be given initial focus.
|
||||||
|
* Override from parent. Return control to be given initial focus.
|
||||||
|
*/
|
||||||
|
protected Control getInitialFocusControl()
|
||||||
|
{
|
||||||
|
return form.getInitialFocusControl();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Completes processing of the wizard. If this
|
||||||
|
* method returns true, the wizard will close;
|
||||||
|
* otherwise, it will stay active.
|
||||||
|
* This method is an override from the parent Wizard class.
|
||||||
|
*
|
||||||
|
* @return whether the wizard finished successfully
|
||||||
|
*/
|
||||||
|
public boolean performFinish()
|
||||||
|
{
|
||||||
|
return form.verify(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------- //
|
||||||
|
// METHODS FOR EXTRACTING USER DATA ...
|
||||||
|
// --------------------------------- //
|
||||||
|
/**
|
||||||
|
* Return user-entered System Type.
|
||||||
|
* Call this after finish ends successfully.
|
||||||
|
*/
|
||||||
|
public String getSystemType()
|
||||||
|
{
|
||||||
|
return form.getSystemType();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return user-entered Connection Name.
|
||||||
|
* Call this after finish ends successfully.
|
||||||
|
*/
|
||||||
|
public String getConnectionName()
|
||||||
|
{
|
||||||
|
return form.getConnectionName();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return user-entered Host Name.
|
||||||
|
* Call this after finish ends successfully.
|
||||||
|
*/
|
||||||
|
public String getHostName()
|
||||||
|
{
|
||||||
|
return form.getHostName();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return user-entered Default User Id.
|
||||||
|
* Call this after finish ends successfully.
|
||||||
|
*/
|
||||||
|
public String getDefaultUserId()
|
||||||
|
{
|
||||||
|
return form.getDefaultUserId();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return location where default user id is to be set.
|
||||||
|
* @see org.eclipse.rse.core.ISystemUserIdConstants
|
||||||
|
*/
|
||||||
|
public int getDefaultUserIdLocation()
|
||||||
|
{
|
||||||
|
return form.getUserIdLocation();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return user-entered Description.
|
||||||
|
* Call this after finish ends successfully.
|
||||||
|
*/
|
||||||
|
public String getConnectionDescription()
|
||||||
|
{
|
||||||
|
return form.getConnectionDescription();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return name of profile to contain new connection.
|
||||||
|
* Call this after finish ends successfully.
|
||||||
|
*/
|
||||||
|
public String getProfileName()
|
||||||
|
{
|
||||||
|
return form.getProfileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ISystemMessageLine methods
|
||||||
|
// public void clearMessage()
|
||||||
|
// {
|
||||||
|
// setMessage(null);
|
||||||
|
// }
|
||||||
|
//public void clearErrorMessage()
|
||||||
|
//{
|
||||||
|
//setErrorMessage(null);
|
||||||
|
//}
|
||||||
|
|
||||||
|
public Object getLayoutData()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayoutData(Object gridData)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the page is complete, so to enable Finish.
|
||||||
|
* Called by wizard framework.
|
||||||
|
*/
|
||||||
|
public boolean isPageComplete()
|
||||||
|
{
|
||||||
|
//System.out.println("Inside isPageComplete. " + form.isPageComplete());
|
||||||
|
if (form!=null)
|
||||||
|
return form.isPageComplete() && form.isConnectionUnique();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intercept of WizardPage so we know when Next is pressed
|
||||||
|
*/
|
||||||
|
public IWizardPage getNextPage()
|
||||||
|
{
|
||||||
|
//if (wizard == null)
|
||||||
|
//return null;
|
||||||
|
//return wizard.getNextPage(this);
|
||||||
|
|
||||||
|
RSEDefaultNewConnectionWizardDelegate newConnWizardDelegate = getOurWizardDelegate();
|
||||||
|
if (newConnWizardDelegate != null)
|
||||||
|
{
|
||||||
|
return newConnWizardDelegate.getFirstAdditionalPage();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return super.getNextPage();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Intercept of WizardPge so we know when the wizard framework is deciding whether
|
||||||
|
* to enable next or not.
|
||||||
|
*/
|
||||||
|
public boolean canFlipToNextPage()
|
||||||
|
{
|
||||||
|
//return isPageComplete() && getNextPage() != null;
|
||||||
|
|
||||||
|
RSEDefaultNewConnectionWizardDelegate newConnWizardDelegate = getOurWizardDelegate();
|
||||||
|
if (newConnWizardDelegate != null)
|
||||||
|
{
|
||||||
|
return (isPageComplete() && newConnWizardDelegate.hasAdditionalPages() && form.isConnectionUnique());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return super.canFlipToNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// CALLBACKS FROM SYSTEM CONNECTION FORM...
|
||||||
|
// ----------------------------------------
|
||||||
|
/**
|
||||||
|
* Event: the user has selected a system type.
|
||||||
|
*/
|
||||||
|
public void systemTypeSelected(String systemType, boolean duringInitialization)
|
||||||
|
{
|
||||||
|
RSEDefaultNewConnectionWizardDelegate newConnWizardDelegate = getOurWizardDelegate();
|
||||||
|
if (newConnWizardDelegate != null)
|
||||||
|
{
|
||||||
|
newConnWizardDelegate.systemTypeSelected(systemType, duringInitialization);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
|
||||||
|
* This program and the accompanying materials are made available under the terms
|
||||||
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* {Name} (company) - description of contribution.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.rse.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class RSENewConnectionWizardDelegate implements IRSENewConnectionWizardDelegate {
|
||||||
|
|
||||||
|
private RSENewConnectionWizard wizard;
|
||||||
|
private IRSESystemType systemType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.IRSENewConnectionWizardDelegate#init(org.eclipse.rse.ui.wizards.RSENewConnectionWizard, org.eclipse.rse.core.IRSESystemType)
|
||||||
|
*/
|
||||||
|
public void init(RSENewConnectionWizard wizard, IRSESystemType systemType) {
|
||||||
|
this.wizard = wizard;
|
||||||
|
this.systemType = systemType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.IRSENewConnectionWizardDelegate#getWizard()
|
||||||
|
*/
|
||||||
|
public RSENewConnectionWizard getWizard() {
|
||||||
|
return wizard;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.IRSENewConnectionWizardDelegate#getSystemType()
|
||||||
|
*/
|
||||||
|
public IRSESystemType getSystemType() {
|
||||||
|
return systemType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.IRSENewConnectionWizardDelegate#addPages()
|
||||||
|
*/
|
||||||
|
public void addPages() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.IRSENewConnectionWizardDelegate#canFinish()
|
||||||
|
*/
|
||||||
|
public boolean canFinish() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.IRSENewConnectionWizardDelegate#getNextPage(org.eclipse.jface.wizard.IWizardPage)
|
||||||
|
*/
|
||||||
|
public IWizardPage getNextPage(IWizardPage page) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.IRSENewConnectionWizardDelegate#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
|
||||||
|
*/
|
||||||
|
public IWizardPage getPreviousPage(IWizardPage page) {
|
||||||
|
return wizard.getStartingPage();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
|
||||||
|
* This program and the accompanying materials are made available under the terms
|
||||||
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* {Name} (company) - description of contribution.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.rse.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
import org.eclipse.rse.ui.SystemResources;
|
||||||
|
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RSENewConnectionWizardMainPage extends AbstractSystemWizardPage {
|
||||||
|
|
||||||
|
protected String parentHelpId;
|
||||||
|
protected Combo textSystemType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
* @param wizard the wizard.
|
||||||
|
* @param title the title of the wizard page.
|
||||||
|
* @param description the description of the wizard page.
|
||||||
|
*/
|
||||||
|
public RSENewConnectionWizardMainPage(IRSENewConnectionWizard wizard, String title, String description) {
|
||||||
|
super(wizard, "NewConnectionSystemType", title, description);
|
||||||
|
parentHelpId = RSEUIPlugin.HELPPREFIX + "wncc0000";
|
||||||
|
setHelp(parentHelpId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.AbstractSystemWizardPage#createContents(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
public Control createContents(Composite parent) {
|
||||||
|
|
||||||
|
int nbrColumns = 2;
|
||||||
|
Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
|
||||||
|
SystemWidgetHelpers.setCompositeHelp(composite_prompts, parentHelpId);
|
||||||
|
|
||||||
|
String temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_SYSTEMTYPE_LABEL);
|
||||||
|
|
||||||
|
Label labelSystemType = SystemWidgetHelpers.createLabel(composite_prompts, temp);
|
||||||
|
labelSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
|
||||||
|
|
||||||
|
textSystemType = SystemWidgetHelpers.createSystemTypeCombo(parent, null);
|
||||||
|
textSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
|
||||||
|
SystemWidgetHelpers.setHelp(textSystemType, RSEUIPlugin.HELPPREFIX + "ccon0003");
|
||||||
|
|
||||||
|
return composite_prompts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.AbstractSystemWizardPage#getInitialFocusControl()
|
||||||
|
*/
|
||||||
|
protected Control getInitialFocusControl() {
|
||||||
|
|
||||||
|
if (textSystemType != null) {
|
||||||
|
return textSystemType;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.rse.ui.wizards.AbstractSystemWizardPage#performFinish()
|
||||||
|
*/
|
||||||
|
public boolean performFinish() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.jface.wizard.WizardPage#getNextPage()
|
||||||
|
*/
|
||||||
|
public IWizardPage getNextPage() {
|
||||||
|
|
||||||
|
IWizard wizard = getWizard();
|
||||||
|
|
||||||
|
// if the wizard is a new connection wizard, which should always be the case,
|
||||||
|
// get the new connection wizard delegate for the selected system type and
|
||||||
|
// ask for the main page
|
||||||
|
if (wizard instanceof IRSENewConnectionWizard) {
|
||||||
|
String systemTypeStr = textSystemType.getText();
|
||||||
|
IRSENewConnectionWizardDelegate delegate = ((IRSENewConnectionWizard)wizard).getDelegate(RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeStr));
|
||||||
|
return delegate.getMainPage();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return super.getNextPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jface.wizard.IWizard;
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
import org.eclipse.rse.core.servicesubsystem.IServiceSubSystem;
|
import org.eclipse.rse.core.servicesubsystem.IServiceSubSystem;
|
||||||
import org.eclipse.rse.core.servicesubsystem.IServiceSubSystemConfiguration;
|
import org.eclipse.rse.core.servicesubsystem.IServiceSubSystemConfiguration;
|
||||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||||
|
@ -78,12 +80,16 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
|
||||||
|
|
||||||
|
|
||||||
IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)getSubSystemFactory();
|
IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)getSubSystemFactory();
|
||||||
IServiceSubSystemConfiguration[] factories = getServiceSubSystemFactories(getMainPage().getSystemType(), currentFactory.getServiceType());
|
|
||||||
|
String systemTypeStr = getMainPage().getSystemType();
|
||||||
|
IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeStr);
|
||||||
|
|
||||||
|
IServiceSubSystemConfiguration[] factories = getServiceSubSystemFactories(systemTypeStr, currentFactory.getServiceType());
|
||||||
|
|
||||||
IHost dummyHost = null;
|
IHost dummyHost = null;
|
||||||
if (getWizard() instanceof SystemNewConnectionWizard)
|
if (getWizard() instanceof RSENewConnectionWizard)
|
||||||
{
|
{
|
||||||
dummyHost = ((SystemNewConnectionWizard)getWizard()).getDummyHost();
|
dummyHost = ((RSENewConnectionWizard)getWizard()).getDelegate(systemType).getDummyHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
// create elements for each
|
// create elements for each
|
||||||
|
|
|
@ -840,6 +840,7 @@ Contributors:
|
||||||
<!-- Define Persistence Provider extension point -->
|
<!-- Define Persistence Provider extension point -->
|
||||||
<!-- ================================================================= -->
|
<!-- ================================================================= -->
|
||||||
<extension-point id="persistenceProviders" name="%extPoint.persistenceProviders" schema="schema/persistenceProviders.exsd"/>
|
<extension-point id="persistenceProviders" name="%extPoint.persistenceProviders" schema="schema/persistenceProviders.exsd"/>
|
||||||
|
<extension-point id="newConnectionWizardDelegate" name="RSE New Connection Wizard Delegate" schema="schema/newConnectionWizardDelegate.exsd"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1051,7 +1052,7 @@ Contributors:
|
||||||
name="%Creation.connection.name"
|
name="%Creation.connection.name"
|
||||||
icon="icons/full/etool16/newconnection_wiz.gif"
|
icon="icons/full/etool16/newconnection_wiz.gif"
|
||||||
category="org.eclipse.rse.ui.newWizards.rseCategory"
|
category="org.eclipse.rse.ui.newWizards.rseCategory"
|
||||||
class="org.eclipse.rse.ui.wizards.SystemNewConnectionWizard"
|
class="org.eclipse.rse.ui.wizards.RSENewConnectionWizard"
|
||||||
preferredPerspectives="org.eclipse.rse.ui.view.SystemPerspective"
|
preferredPerspectives="org.eclipse.rse.ui.view.SystemPerspective"
|
||||||
canFinishEarly="false"
|
canFinishEarly="false"
|
||||||
hasPages="true">
|
hasPages="true">
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!-- Schema file written by PDE -->
|
||||||
|
<schema targetNamespace="org.eclipse.rse.ui">
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.schema plugin="org.eclipse.rse.ui" id="newConnectionWizardDelegate" name="RSE New Connection Wizard Delegate"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
This extension point allows a New Connection wizard delegate to be provided for a certain system type. This is useful for those system types that need New Connection wizard pages which are different from the default pages supplied by RSE.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<element name="extension">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="point" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="newConnectionWizardDelegate">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="systemType" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
The system type ID.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="class" type="string" use="default" value="org.eclipse.rse.ui.wizards.RSENewConnectionWizardDelegate">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
A class that implements
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="since"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="examples"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="apiInfo"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
The provider of a new connection delegate for a certain system type must implement <samp>org.eclipse.rse.ui.wizards.IRSENewConnectionWizardDelegate</samp>. Instead of extending the interface, it is recommended that the abstract class <samp>org.eclipse.rse.ui.wizards.RSENewConnectionWizardDelegate</samp> be extended.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="implementation"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="copyright"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
Copyright (c) 2006 IBM Corporation. All Rights Reserved.
|
||||||
|
This program and the accompanying materials are made available under the terms
|
||||||
|
of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
|
available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
IBM Corporation - initial API and implementation
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
</schema>
|
Loading…
Add table
Reference in a new issue