diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java
index 9ae654520ad..9c77d0268b6 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java
@@ -18,6 +18,7 @@
package org.eclipse.rse.ui;
import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.Vector;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -36,6 +37,7 @@ import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.dialogs.ISystemPromptDialog;
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
import org.eclipse.rse.ui.messages.ISystemMessageLine;
import org.eclipse.rse.ui.validators.ISystemValidator;
@@ -56,6 +58,7 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPropertyPage;
import org.eclipse.ui.dialogs.PropertyPage;
@@ -140,9 +143,9 @@ public class SystemConnectionForm
this.msgLine = msgLine;
this.caller = caller;
this.defaultProfileNames = RSEUIPlugin.getTheSystemRegistry().getActiveSystemProfileNames();
- callerInstanceOfWizardPage = (caller instanceof WizardPage);
- callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
- callerInstanceOfPropertyPage = (caller instanceof PropertyPage);
+ callerInstanceOfWizardPage = caller instanceof IWizardPage;
+ callerInstanceOfSystemPromptDialog = caller instanceof ISystemPromptDialog;
+ callerInstanceOfPropertyPage = caller instanceof IWorkbenchPropertyPage;
userIdValidator = new ValidatorUserId(true); // false => allow empty? Yes.
defaultUserId = ""; //$NON-NLS-1$
@@ -1135,32 +1138,35 @@ public class SystemConnectionForm
* in the Dialog's message line.
* @see #setHostNameValidator(ISystemValidator)
*/
- protected SystemMessage validateHostNameInput()
- {
- String hostName = textHostName.getText().trim();
- if (connectionNameEmpty) // d43191
- internalSetConnectionName(hostName);
- errorMessage= null;
+ protected SystemMessage validateHostNameInput() {
+ final String hostName = textHostName.getText().trim();
+
+ // d43191
+ if (connectionNameEmpty) internalSetConnectionName(hostName);
+
+ errorMessage = null;
+
if (hostValidator != null)
- errorMessage= hostValidator.validate(hostName);
- else if (getHostName().length() == 0)
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_HOSTNAME_EMPTY);
- if (updateMode && !userPickedVerifyHostnameCB)
- {
+ errorMessage = hostValidator.validate(hostName);
+ else if (getHostName().length() == 0)
+ errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_HOSTNAME_EMPTY);
+
+ if (updateMode && !userPickedVerifyHostnameCB) {
boolean hostNameChanged = !hostName.equals(defaultHostName);
verifyHostNameCB.setSelection(hostNameChanged);
}
+
showErrorMessage(errorMessage);
- setPageComplete();
- return errorMessage;
+ setPageComplete();
+ return errorMessage;
}
+
/**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an ISystemValidator
object.
- * If the ISystemValidator
reports an error the error message is displayed
- * in the Dialog's message line.
- * @see #setUserIdValidator(ISystemValidator)
- */
+ * This hook method is called whenever the text changes in the input field. The default implementation delegates the
+ * request to an ISystemValidator
object. If the ISystemValidator
reports an error the
+ * error message is displayed in the Dialog's message line.
+ * @see #setUserIdValidator(ISystemValidator)
+ */
protected SystemMessage validateUserIdInput()
{
errorMessage= null;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java
index 3fd7c783330..1c78dc538ce 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java
@@ -85,7 +85,7 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)getSubSystemConfiguration();
- IRSESystemType systemType = getMainPage() != null ? getMainPage().getSystemType() : null;
+ IRSESystemType systemType = getMainPage() != null && getMainPage().getWizard() instanceof RSEDefaultNewConnectionWizard ? ((RSEDefaultNewConnectionWizard)getMainPage().getWizard()).getSystemType() : null;
String systemTypeName = systemType != null ? systemType.getName() : null;
IServiceSubSystemConfiguration[] factories = getServiceSubSystemFactories(systemTypeName, currentFactory.getServiceType());
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java
index 8825e2a7c45..004229c9b2b 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java
@@ -93,9 +93,10 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
public void selectionChanged(SelectionChangedEvent event) {
super.selectionChanged(event);
if (mainPage != null && getSystemType() != null) {
- mainPage.restrictSystemType(getSystemType().getName());
+ IRSESystemType systemType = getSystemType();
mainPage.setTitle(getPageTitle());
- systemTypeSelected(getSystemType().getName(), true);
+ mainPage.setSystemType(systemType);
+ subsystemFactorySuppliedWizardPages = getAdditionalWizardPages(systemType.getName());
}
}
@@ -116,7 +117,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
mainPage.setHostName(defaultHostName);
if (mainPage != null && getSystemType() != null)
- mainPage.restrictSystemType(getSystemType().getName());
+ mainPage.setSystemType(getSystemType());
String defaultProfileName = RSEUIPlugin.getDefault().getSystemRegistry().getSystemProfileManager().getDefaultPrivateSystemProfile().getName();
@@ -337,25 +338,6 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
return mainPage;
}
- /**
- * Return the form of the main page of this wizard
- */
- // public SystemConnectionForm getMainPageForm()
- // {
- // return (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.
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java
index 4c7bb934aa3..b66a61b5c29 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java
@@ -42,7 +42,6 @@ import org.eclipse.swt.widgets.Control;
public class RSEDefaultNewConnectionWizardMainPage extends AbstractSystemWizardPage implements ISystemConnectionFormCaller {
- private String[] restrictSystemTypesTo;
private SystemConnectionForm form;
private String parentHelpId;
@@ -58,16 +57,18 @@ public class RSEDefaultNewConnectionWizardMainPage extends AbstractSystemWizardP
}
/**
- * Call this to restrict the system type that the user is allowed to choose
+ * Set the system type the page is working with.
*
- * @param systemType The system type to restrict the page to. Must be not null
.
+ * @param systemType The system type.
*/
- public void restrictSystemType(String systemType) {
- assert systemType != null;
- restrictSystemTypesTo = new String[] { systemType };
- getForm().restrictSystemTypes(restrictSystemTypesTo);
+ public void setSystemType(IRSESystemType systemType) {
+ if (systemType != null) {
+ // The page _always_ restrict the system connection form
+ // to only one system type.
+ getForm().restrictSystemType(systemType.getName());
+ }
}
-
+
/**
* 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
@@ -271,34 +272,17 @@ public class RSEDefaultNewConnectionWizardMainPage extends AbstractSystemWizardP
RSEDefaultNewConnectionWizard newConnWizard = getWizard() instanceof RSEDefaultNewConnectionWizard ? (RSEDefaultNewConnectionWizard)getWizard() : null;
if (newConnWizard != null) {
- return (isPageComplete() && newConnWizard.hasAdditionalPages() && getForm().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) {
- RSEDefaultNewConnectionWizard newConnWizard = getWizard() instanceof RSEDefaultNewConnectionWizard ? (RSEDefaultNewConnectionWizard)getWizard() : null;
- if (newConnWizard != null) {
- newConnWizard.systemTypeSelected(systemType, duringInitialization);
+ return (isPageComplete() && newConnWizard.hasAdditionalPages());
}
+
+ return super.canFlipToNextPage();
}
/* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.ISystemNewConnectionWizardMainPage#getSystemType()
+ * @see org.eclipse.rse.ui.ISystemConnectionFormCaller#systemTypeSelected(java.lang.String, boolean)
*/
- public IRSESystemType getSystemType() {
- if (getWizard() instanceof RSEDefaultNewConnectionWizard) {
- RSEDefaultNewConnectionWizard wizard = (RSEDefaultNewConnectionWizard)getWizard();
- return wizard.getSystemType();
- }
-
- return null;
+ public void systemTypeSelected(String systemType, boolean duringInitialization) {
+ // Not applicable: The Page is driving the system connection form and not the way around!!!
}
}
\ No newline at end of file