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

[150112]: Remove dead code. Classes SystemNewConnectionWizard, SystemNewConnectionWizardDefaultMainPage and SystemNewConnectionWizardRenameProfilePage have been deleted.

This commit is contained in:
Kushal Munir 2007-02-13 03:51:32 +00:00
parent cfd86803bb
commit 6b04348c73
4 changed files with 1 additions and 1035 deletions

View file

@ -47,7 +47,6 @@ import org.eclipse.rse.ui.view.SystemPerspectiveHelpers;
public class RSEDefaultNewConnectionWizardDelegate extends RSENewConnectionWizardDelegate {
private RSENewConnectionWizardDefaultDelegateMainPage mainPage;
private SystemNewConnectionWizardRenameProfilePage rnmProfilePage;
private ISystemNewConnectionWizardPage[] subsystemFactorySuppliedWizardPages;
private Hashtable ssfWizardPagesPerSystemType = new Hashtable();
private String defaultUserId;
@ -500,7 +499,7 @@ public class RSEDefaultNewConnectionWizardDelegate extends RSENewConnectionWizar
*/
public IWizardPage getNextPage(IWizardPage page)
{
if (!hasAdditionalPages() || (page==rnmProfilePage))
if (!hasAdditionalPages())
return null;
else
{

View file

@ -1,520 +0,0 @@
/********************************************************************************
* 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.model.IHost;
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry;
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.SystemStartHere;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.ui.ISystemIconConstants;
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;
import org.eclipse.rse.ui.view.SystemPerspectiveHelpers;
import org.eclipse.ui.INewWizard;
/**
* Wizard for creating a new remote systems connection.
*/
public class SystemNewConnectionWizard
extends AbstractSystemWizard implements INewWizard
{
private ISystemNewConnectionWizardMainPage 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 IHost _dummyHost;
/**
* Constructor
*/
public SystemNewConnectionWizard()
{
super(SystemResources.RESID_NEWCONN_TITLE,
RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTIONWIZARD_ID));
activeProfileNames = SystemStartHere.getSystemProfileManager().getActiveSystemProfileNames();
super.setForcePreviousAndNextButtons(true);
super.setNeedsProgressMonitor(true);
}
/**
* 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);
SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile();
/* 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);
}
}
addPage((WizardPage)mainPage);
} catch (Exception exc)
{
SystemBasePlugin.logError("New connection: Error in createPages: ",exc); //$NON-NLS-1$
}
}
/**
* Creates the wizard's main page.
* This method is an override from the parent class.
*/
protected ISystemNewConnectionWizardMainPage 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); //$NON-NLS-1$
}
}
mainPage = new SystemNewConnectionWizardDefaultMainPage(this,
pageTitle,
SystemResources.RESID_NEWCONN_PAGE1_DESCRIPTION);
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)
setPageError((IWizardPage)mainPage);
else if (ok && hasAdditionalPages())
{
for (int idx=0; ok && (idx<subsystemFactorySuppliedWizardPages.length); idx++)
{
ok = subsystemFactorySuppliedWizardPages[idx].performFinish();
if (!ok)
setPageError((IWizardPage)subsystemFactorySuppliedWizardPages[idx]);
}
}
if (ok)
{
boolean cursorSet = true;
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(getShell(), exc);
ok = false;
}
catch (Exception exc)
{
setBusyCursor(false);
cursorSet = false;
String msg = "Exception renaming profile "; //$NON-NLS-1$
SystemBasePlugin.logError(msg, exc);
SystemMessageDialog.displayExceptionMessage(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);
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); //$NON-NLS-1$
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();
setOutputObject(conn);
} catch (Exception exc)
{
if (cursorSet)
setBusyCursor(false);
cursorSet = false;
String msg = "Exception creating connection "; //$NON-NLS-1$
SystemBasePlugin.logError(msg, exc);
SystemMessageDialog.displayExceptionMessage(getShell(),exc);
ok = false;
}
}
//getShell().setCursor(null);
//busyCursor.dispose();
if (cursorSet)
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 ISystemNewConnectionWizardMainPage getMainPage()
{
return mainPage;
}
/**
* Return the form of the main page of this wizard
*/
public SystemConnectionForm getMainPageForm()
{
return ((SystemNewConnectionWizardDefaultMainPage)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)
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);
ISystemNewConnectionWizardPage[] pages = adapter.getNewConnectionWizardPages(factories[idx], this);
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++)
{
((IWizardPage)subsystemFactorySuppliedWizardPages[idx]).setPreviousPage(previousPage);
previousPage = (IWizardPage)subsystemFactorySuppliedWizardPages[idx];
}
return (IWizardPage)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 super.getNextPage(page);
else
{
int index = getAdditionalPageIndex(page);
if ((index == (subsystemFactorySuppliedWizardPages.length - 1)))
// last page or page not found
return null;
return (IWizardPage)subsystemFactorySuppliedWizardPages[index + 1];
}
}
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 = super.canFinish();
if (ok && hasAdditionalPages())
{
for (int idx=0; ok && (idx<subsystemFactorySuppliedWizardPages.length); idx++)
ok = subsystemFactorySuppliedWizardPages[idx].isPageComplete();
}
return ok;
}
} // end class

View file

@ -1,355 +0,0 @@
/********************************************************************************
* 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.core.model.IHost;
import org.eclipse.rse.ui.ISystemConnectionFormCaller;
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 SystemNewConnectionWizardDefaultMainPage
//extends WizardPage
extends AbstractSystemWizardPage
implements ISystemNewConnectionWizardMainPage,
ISystemMessageLine, ISystemConnectionFormCaller
{
protected String[] restrictSystemTypesTo;
protected SystemConnectionForm form;
protected String parentHelpId;
/**
* Constructor. Use this when you want to supply your own title and
* description strings.
*/
public SystemNewConnectionWizardDefaultMainPage(Wizard wizard,
String title,
String description)
{
super(wizard, "NewConnection", title, description); //$NON-NLS-1$
parentHelpId = RSEUIPlugin.HELPPREFIX + "wncc0000"; //$NON-NLS-1$
setHelp(parentHelpId);
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 SystemNewConnectionWizard getOurWizard()
{
IWizard wizard = getWizard();
if (wizard instanceof SystemNewConnectionWizard)
return (SystemNewConnectionWizard)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.IRSEUserIdConstants
*/
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);
SystemNewConnectionWizard newConnWizard = getOurWizard();
if (newConnWizard != null)
{
return newConnWizard.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;
SystemNewConnectionWizard newConnWizard = getOurWizard();
if (newConnWizard != null)
{
return (isPageComplete() && newConnWizard.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)
{
SystemNewConnectionWizard newConnWizard = getOurWizard();
if (newConnWizard != null)
{
newConnWizard.systemTypeSelected(systemType, duringInitialization);
}
}
}

View file

@ -1,158 +0,0 @@
/********************************************************************************
* 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.Wizard;
import org.eclipse.rse.internal.model.SystemProfileManager;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemProfileForm;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.messages.ISystemMessageLine;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
/**
* First page of the New Connection wizard when creating
* the very first connection.
* <p>
* This page asks for a unique personal name for the private profile.
*/
public class SystemNewConnectionWizardRenameProfilePage
extends AbstractSystemWizardPage
implements
ISystemMessageLine
{
protected SystemProfileForm form;
/**
* Constructor.
*/
public SystemNewConnectionWizardRenameProfilePage(Wizard wizard)
{
super(wizard, "RenamePrivateProfile", //$NON-NLS-1$
SystemResources.RESID_RENAMEDEFAULTPROFILE_PAGE1_TITLE,
SystemResources.RESID_RENAMEDEFAULTPROFILE_PAGE1_DESCRIPTION);
form = getForm();
setHelp(RSEUIPlugin.HELPPREFIX + "wncp0000"); //$NON-NLS-1$
}
/**
* Return our hosting wizard
*/
protected SystemNewConnectionWizard getOurWizard()
{
return (SystemNewConnectionWizard)getWizard();
}
/**
* 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.SystemProfileForm
*/
protected SystemProfileForm getForm()
{
if (form == null)
form = new SystemProfileForm(this,this,null, true);
//SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile());
return form;
}
/**
* 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)
{
Control c = form.createContents(parent);
form.getInitialFocusControl().setFocus();
String initProfileName = SystemProfileManager.getDefaultPrivateSystemProfileName();
form.setProfileName(initProfileName);
return c;
}
/**
* 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();
}
// --------------------------------- //
// METHODS FOR EXTRACTING USER DATA ...
// --------------------------------- //
/**
* 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()
{
boolean ok = false;
if (form!=null)
{
ok = form.isPageComplete();
if (ok
&& isCurrentPage()) // defect 41831
getOurWizard().setNewPrivateProfileName(form.getProfileName());
}
return ok;
}
}