Bug 246156 - Clicking "add" for runtimes in the new server wizard should change combo selection
Summary: Clicking "add" for runtimes in the new server wizard should change combo sele...
Status: CLOSED FIXED
Alias: None
Product: WTP ServerTools
Classification: WebTools
Component: wst.server (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Tim deBoer CLA
QA Contact: Tim deBoer CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-09-03 17:10 EDT by Rob Stryker CLA
Modified: 2017-10-11 16:25 EDT (History)
1 user (show)

See Also:


Attachments
When a new runtime is created, it is automatically selected (2.51 KB, patch)
2008-09-11 15:57 EDT, Rob Stryker CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Stryker CLA 2008-09-03 17:10:33 EDT
In the new Server Wizard, adding a new runtime (which opens the runtime wizard) should automatically select the new runtime.  Patch pasted below:

### Eclipse Workspace Patch 1.0
#P org.eclipse.wst.server.ui
Index: serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
===================================================================
RCS file: /cvsroot/webtools/servertools/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java,v
retrieving revision 1.41
diff -u -r1.41 NewManualServerComposite.java
--- serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java	21 Jul 2008 14:50:08 -0000	1.41
+++ serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java	3 Sep 2008 21:09:09 -0000
@@ -234,8 +234,7 @@
 		addRuntime.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent e) {
 				IServerType serverType = serverTypeComposite.getSelectedServerType();
-				if (showRuntimeWizard(serverType) != Window.CANCEL)
-					updateRuntimeCombo(serverType);
+				showRuntimeWizard(serverType);
 			}
 		});
 		
@@ -263,20 +262,20 @@
 		return (dialog.open() == Window.OK);
 	}
 
-	protected int showRuntimeWizard(IServerType serverType) {
+	protected void showRuntimeWizard(IServerType serverType) {
 		WizardFragment fragment = null;
 		TaskModel taskModel = new TaskModel();
 		IRuntimeType runtimeType = serverType.getRuntimeType();
 		final WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(runtimeType.getId());
 		if (fragment2 == null)
-			return Window.CANCEL;
+			return;
 		
 		try {
 			IRuntimeWorkingCopy runtimeWorkingCopy = runtimeType.createRuntime(null, null);
 			taskModel.putObject(TaskModel.TASK_RUNTIME, runtimeWorkingCopy);
 		} catch (CoreException ce) {
 			Trace.trace(Trace.SEVERE, "Error creating runtime", ce);
-			return Window.CANCEL;
+			return;
 		}
 		fragment = new WizardFragment() {
 			protected void createChildFragments(List<WizardFragment> list) {
@@ -287,7 +286,13 @@
 		TaskWizard wizard2 = new TaskWizard(Messages.wizNewRuntimeWizardTitle, fragment, taskModel);
 		wizard2.setForcePreviousAndNextButtons(true);
 		WizardDialog dialog = new WizardDialog(getShell(), wizard2);
-		return dialog.open();
+		if( dialog.open() != Window.CANCEL ) {
+			updateRuntimeCombo(serverType);
+			IRuntime rt = (IRuntime)taskModel.getObject(TaskModel.TASK_RUNTIME);
+			if( rt != null && rt.getName() != null && runtimeCombo.indexOf(rt.getName()) != -1) {
+				runtimeCombo.select(runtimeCombo.indexOf(rt.getName()));
+			}
+		}
 	}
 
 	public void setHost(String host) {
Comment 1 Rob Stryker CLA 2008-09-11 15:57:08 EDT
Created attachment 112350 [details]
When a new runtime is created, it is automatically selected

Ignore the pasted patch above and use the new attached one. 
The difference between the two is that the first correctly selected the right place in the combo but did not setRuntime(etc) properly.
Comment 2 Tim deBoer CLA 2008-09-23 12:52:30 EDT
Thanks for attaching the patch, I will release to 3.1 M3. I'm going to leave the return value of the method intact (personal preference, I prefer to leave a return value so a potential caller can still tell if the dialog was canceled) but otherwise directly apply the patch.
Comment 3 Tim deBoer CLA 2008-10-07 10:06:03 EDT
Fix released to 3.1 builds.
Comment 4 Tim deBoer CLA 2011-01-20 10:23:40 EST
Closing old bugs.
Comment 5 Eclipse Genie CLA 2017-10-11 16:25:16 EDT
New Gerrit change created: https://git.eclipse.org/r/108673