Index: src/org/teiid/designer/runtime/ui/ServerPage.java =================================================================== --- src/org/teiid/designer/runtime/ui/ServerPage.java (revision 1188) +++ src/org/teiid/designer/runtime/ui/ServerPage.java (working copy) @@ -35,7 +35,6 @@ import org.teiid.designer.runtime.Server; import org.teiid.designer.runtime.ServerManager; import org.teiid.designer.runtime.ServerUtils; - import com.metamatrix.core.util.StringUtilities; import com.metamatrix.modeler.dqp.ui.DqpUiConstants; import com.metamatrix.modeler.dqp.ui.DqpUiPlugin; @@ -45,17 +44,22 @@ */ public final class ServerPage extends WizardPage { + /** + * The key in the wizard IDialogSettings for the auto-connect flag. + */ + private static final String AUTO_CONNECT_KEY = "autoConnect"; + // =========================================================================================================================== // Fields // =========================================================================================================================== - private boolean autoConnect = true; + private boolean autoConnect = true; - /** + /** * The button used to test the connection to the server. Should only be enabled when server properties are valid. */ private Button btnTestConnection; - + /** * The Check-box to allow auto-connect on Finish */ @@ -275,13 +279,19 @@ handleTestConnection(); } }); - + this.btnAutoConnectOnFinish = new Button(pnl, SWT.CHECK); this.btnAutoConnectOnFinish.setText(UTIL.getString("serverPageAutoConnectLabel")); //$NON-NLS-1$ this.btnAutoConnectOnFinish.setToolTipText(UTIL.getString("serverPageAutoConnectToolTip")); //$NON-NLS-1$ this.btnAutoConnectOnFinish.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); - this.btnAutoConnectOnFinish.setSelection(true); - + + // set the auto connect flag based on dialog settings + if (getDialogSettings().get(AUTO_CONNECT_KEY) != null) { + this.autoConnect = getDialogSettings().getBoolean(AUTO_CONNECT_KEY); + } + + this.btnAutoConnectOnFinish.setSelection(this.autoConnect); + this.btnAutoConnectOnFinish.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} @@ -307,12 +317,11 @@ Text txtUrl = new Text(pnl, SWT.BORDER); txtUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); txtUrl.setToolTipText(UTIL.getString("serverPageUrlToolTip")); //$NON-NLS-1$ - + Label templateUrl = new Label(pnl, SWT.LEFT); templateUrl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); templateUrl.setText(UTIL.getString("serverPageProtocolLabel") + //$NON-NLS-1$ - StringUtilities.SPACE + StringUtilities.SPACE + ServerUtils.FORMAT_SERVER); - + StringUtilities.SPACE + StringUtilities.SPACE + ServerUtils.FORMAT_SERVER); // set initial value if (this.url == null) { @@ -376,9 +385,9 @@ ServerManager getServerManager() { return ((ServerWizard)getWizard()).getServerManager(); } - + void handleAutoConnect() { - this.autoConnect = this.btnAutoConnectOnFinish.getSelection(); + this.autoConnect = this.btnAutoConnectOnFinish.getSelection(); } /** @@ -482,15 +491,13 @@ setMessage(UTIL.getString("serverPageOkStatusMsg")); //$NON-NLS-1$ } } - + /** - * * @return true if autoconnect is checked */ public boolean shouldAutoConnect() { - return autoConnect; - } - + return autoConnect; + } /** * If the initial message is being displayed do a validation. @@ -544,4 +551,12 @@ } } + /** + * Processing done after wizard 'Finish' button is clicked. Wizard was not canceled. + */ + void performFinish() { + // update dialog settings + getDialogSettings().put(AUTO_CONNECT_KEY, this.autoConnect); + } + } Index: src/org/teiid/designer/runtime/ui/ServerWizard.java =================================================================== --- src/org/teiid/designer/runtime/ui/ServerWizard.java (revision 1188) +++ src/org/teiid/designer/runtime/ui/ServerWizard.java (working copy) @@ -8,14 +8,13 @@ package org.teiid.designer.runtime.ui; import static com.metamatrix.modeler.dqp.ui.DqpUiConstants.UTIL; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.wizard.Wizard; import org.teiid.designer.runtime.Server; import org.teiid.designer.runtime.ServerManager; - import com.metamatrix.modeler.dqp.ui.DqpUiConstants; import com.metamatrix.modeler.dqp.ui.DqpUiPlugin; @@ -42,7 +41,7 @@ * The manager in charge of the server registry. */ private final ServerManager serverManager; - + private Server resultServer; // =========================================================================================================================== @@ -91,6 +90,29 @@ } /** + * {@inheritDoc} + * + * @see org.eclipse.jface.wizard.Wizard#getDialogSettings() + */ + @Override + public IDialogSettings getDialogSettings() { + IDialogSettings settings = super.getDialogSettings(); + + if (settings == null) { + IDialogSettings temp = DqpUiPlugin.getDefault().getDialogSettings(); + settings = temp.getSection(getClass().getSimpleName()); + + if (settings == null) { + settings = temp.addNewSection(getClass().getSimpleName()); + } + + setDialogSettings(settings); + } + + return super.getDialogSettings(); + } + + /** * @return the server manager (never null) */ protected ServerManager getServerManager() { @@ -104,6 +126,9 @@ */ @Override public boolean performFinish() { + // first let page know that wizard finished and was not canceled + this.page.performFinish(); + IStatus status = Status.OK_STATUS; resultServer = this.page.getServer(); @@ -132,10 +157,10 @@ } public boolean shouldAutoConnect() { - return this.page.shouldAutoConnect(); + return this.page.shouldAutoConnect(); } - + public Server getServer() { - return this.resultServer; + return this.resultServer; } }