|
Lines 10-18
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.wst.server.ui.internal.wizard.page; |
11 |
package org.eclipse.wst.server.ui.internal.wizard.page; |
| 12 |
|
12 |
|
|
|
13 |
import java.beans.PropertyChangeEvent; |
| 13 |
import java.lang.reflect.InvocationTargetException; |
14 |
import java.lang.reflect.InvocationTargetException; |
| 14 |
import java.util.ArrayList; |
15 |
import java.util.ArrayList; |
| 15 |
import java.util.List; |
16 |
import java.util.List; |
|
|
17 |
import java.util.Map; |
| 16 |
|
18 |
|
| 17 |
import org.eclipse.core.runtime.CoreException; |
19 |
import org.eclipse.core.runtime.CoreException; |
| 18 |
import org.eclipse.core.runtime.IStatus; |
20 |
import org.eclipse.core.runtime.IStatus; |
|
Lines 43-59
Link Here
|
| 43 |
import org.eclipse.wst.server.core.*; |
45 |
import org.eclipse.wst.server.core.*; |
| 44 |
import org.eclipse.wst.server.core.internal.ServerWorkingCopy; |
46 |
import org.eclipse.wst.server.core.internal.ServerWorkingCopy; |
| 45 |
import org.eclipse.wst.server.core.util.SocketUtil; |
47 |
import org.eclipse.wst.server.core.util.SocketUtil; |
|
|
48 |
import org.eclipse.wst.server.ui.*; |
| 46 |
import org.eclipse.wst.server.ui.internal.*; |
49 |
import org.eclipse.wst.server.ui.internal.*; |
|
|
50 |
import org.eclipse.wst.server.ui.AbstractUIControl.IUIControlListener; |
| 51 |
import org.eclipse.wst.server.ui.AbstractUIControl.UIControlEntry; |
| 47 |
import org.eclipse.wst.server.ui.internal.viewers.ServerTypeComposite; |
52 |
import org.eclipse.wst.server.ui.internal.viewers.ServerTypeComposite; |
| 48 |
import org.eclipse.wst.server.ui.internal.wizard.TaskWizard; |
53 |
import org.eclipse.wst.server.ui.internal.wizard.TaskWizard; |
| 49 |
import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil; |
54 |
import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil; |
| 50 |
import org.eclipse.wst.server.ui.internal.wizard.page.HostnameComposite.IHostnameSelectionListener; |
55 |
import org.eclipse.wst.server.ui.internal.wizard.page.HostnameComposite.IHostnameSelectionListener; |
|
|
56 |
import org.eclipse.wst.server.ui.wizard.ServerCreationWizardPageExtension; |
| 51 |
import org.eclipse.wst.server.ui.wizard.WizardFragment; |
57 |
import org.eclipse.wst.server.ui.wizard.WizardFragment; |
| 52 |
|
58 |
|
| 53 |
/** |
59 |
/** |
| 54 |
* Wizard page used to create a server and configuration at the same time. |
60 |
* Wizard page used to create a server and configuration at the same time. |
| 55 |
*/ |
61 |
*/ |
| 56 |
public class NewManualServerComposite extends Composite { |
62 |
public class NewManualServerComposite extends Composite implements IUIControlListener { |
| 57 |
public interface ServerSelectionListener { |
63 |
public interface ServerSelectionListener { |
| 58 |
public void serverSelected(IServerAttributes server); |
64 |
public void serverSelected(IServerAttributes server); |
| 59 |
public void runtimeSelected(IRuntime runtime); |
65 |
public void runtimeSelected(IRuntime runtime); |
|
Lines 95-104
Link Here
|
| 95 |
protected String lastHostname; |
101 |
protected String lastHostname; |
| 96 |
protected HostnameComposite manualHostComp; |
102 |
protected HostnameComposite manualHostComp; |
| 97 |
IHostnameSelectionListener hostnameListener; |
103 |
IHostnameSelectionListener hostnameListener; |
|
|
104 |
protected Label hostnameLabel; |
| 98 |
protected Text hostname; |
105 |
protected Text hostname; |
| 99 |
protected ControlDecoration hostnameDecoration; |
106 |
protected ControlDecoration hostnameDecoration; |
| 100 |
|
107 |
|
| 101 |
protected ServerCreationCache cache = new ServerCreationCache(); |
108 |
protected ServerCreationCache cache = new ServerCreationCache(); |
|
|
109 |
|
| 110 |
private IServerType oldServerType; |
| 102 |
|
111 |
|
| 103 |
/** |
112 |
/** |
| 104 |
* Creates a new server and server configuration. If the initial |
113 |
* Creates a new server and server configuration. If the initial |
|
Lines 144-149
Link Here
|
| 144 |
IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem(); |
153 |
IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem(); |
| 145 |
whs.setHelp(this, ContextIds.NEW_SERVER_WIZARD); |
154 |
whs.setHelp(this, ContextIds.NEW_SERVER_WIZARD); |
| 146 |
|
155 |
|
|
|
156 |
List<ServerCreationWizardPageExtension> pageExtensionLst = ServerUIPlugin.getServerCreationWizardPageExtensions(); |
| 157 |
// Add the page modifier top section UI. |
| 158 |
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) { |
| 159 |
curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.TOP, this); |
| 160 |
curPageExtension.setUIControlListener(this); |
| 161 |
} |
| 162 |
|
| 147 |
serverTypeComposite = new ServerTypeComposite(this, moduleType, serverTypeId, new ServerTypeComposite.ServerTypeSelectionListener() { |
163 |
serverTypeComposite = new ServerTypeComposite(this, moduleType, serverTypeId, new ServerTypeComposite.ServerTypeSelectionListener() { |
| 148 |
public void serverTypeSelected(IServerType type2) { |
164 |
public void serverTypeSelected(IServerType type2) { |
| 149 |
handleTypeSelection(type2); |
165 |
handleTypeSelection(type2); |
|
Lines 156-168
Link Here
|
| 156 |
serverTypeComposite.setLayoutData(data); |
172 |
serverTypeComposite.setLayoutData(data); |
| 157 |
whs.setHelp(serverTypeComposite, ContextIds.NEW_SERVER_TYPE); |
173 |
whs.setHelp(serverTypeComposite, ContextIds.NEW_SERVER_TYPE); |
| 158 |
|
174 |
|
|
|
175 |
// Add the page modifier middle section UI. |
| 176 |
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) { |
| 177 |
curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.MIDDLE, this); |
| 178 |
} |
| 179 |
|
| 159 |
hostnameListener = new IHostnameSelectionListener() { |
180 |
hostnameListener = new IHostnameSelectionListener() { |
| 160 |
public void hostnameSelected(String selectedHostname) { |
181 |
public void hostnameSelected(String selectedHostname) { |
| 161 |
lastHostname = selectedHostname; |
182 |
lastHostname = selectedHostname; |
| 162 |
setHost(selectedHostname); |
183 |
setHost(selectedHostname); |
| 163 |
} |
184 |
} |
| 164 |
}; |
185 |
}; |
| 165 |
Label hostnameLabel = new Label(this, SWT.NONE); |
186 |
hostnameLabel = new Label(this, SWT.NONE); |
| 166 |
hostnameLabel.setText(Messages.hostname); |
187 |
hostnameLabel.setText(Messages.hostname); |
| 167 |
hostname = new Text(this, SWT.SINGLE | SWT.BORDER | SWT.CANCEL); |
188 |
hostname = new Text(this, SWT.SINGLE | SWT.BORDER | SWT.CANCEL); |
| 168 |
hostname.setText(HostnameComposite.LOCALHOST); |
189 |
hostname.setText(HostnameComposite.LOCALHOST); |
|
Lines 298-303
Link Here
|
| 298 |
} |
319 |
} |
| 299 |
} |
320 |
} |
| 300 |
}); |
321 |
}); |
|
|
322 |
|
| 323 |
// Add the page modifier bottom section UI. |
| 324 |
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) { |
| 325 |
curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.TOP, this); |
| 326 |
} |
| 327 |
|
| 301 |
Dialog.applyDialogFont(this); |
328 |
Dialog.applyDialogFont(this); |
| 302 |
} |
329 |
} |
| 303 |
|
330 |
|
|
Lines 344-349
Link Here
|
| 344 |
return returnValue; |
371 |
return returnValue; |
| 345 |
} |
372 |
} |
| 346 |
|
373 |
|
|
|
374 |
public String getControlStringValue(String controlId) { |
| 375 |
if (controlId != null && AbstractUIControl.PROP_HOSTNAME.equals(controlId)) { |
| 376 |
return host; |
| 377 |
} |
| 378 |
return null; |
| 379 |
} |
| 380 |
|
| 347 |
public void setHost(String host) { |
381 |
public void setHost(String host) { |
| 348 |
this.host = host; |
382 |
this.host = host; |
| 349 |
if (serverTypeComposite == null) |
383 |
if (serverTypeComposite == null) |
|
Lines 387-392
Link Here
|
| 387 |
((ServerWorkingCopy)server).setDefaults(null); |
421 |
((ServerWorkingCopy)server).setDefaults(null); |
| 388 |
runtime = server.getRuntime(); |
422 |
runtime = server.getRuntime(); |
| 389 |
listener.runtimeSelected(runtime); |
423 |
listener.runtimeSelected(runtime); |
|
|
424 |
fireServerWorkingCopyChanged(); |
| 390 |
return; |
425 |
return; |
| 391 |
} |
426 |
} |
| 392 |
|
427 |
|
|
Lines 412-417
Link Here
|
| 412 |
} |
447 |
} |
| 413 |
|
448 |
|
| 414 |
((ServerWorkingCopy)server).setDefaults(null); |
449 |
((ServerWorkingCopy)server).setDefaults(null); |
|
|
450 |
fireServerWorkingCopyChanged(); |
| 415 |
} |
451 |
} |
| 416 |
} catch (CoreException ce) { |
452 |
} catch (CoreException ce) { |
| 417 |
Trace.trace(Trace.SEVERE, "Error creating server", ce); |
453 |
Trace.trace(Trace.SEVERE, "Error creating server", ce); |
|
Lines 419-425
Link Here
|
| 419 |
runtime = null; |
455 |
runtime = null; |
| 420 |
wizard.setMessage(ce.getLocalizedMessage(), IMessageProvider.ERROR); |
456 |
wizard.setMessage(ce.getLocalizedMessage(), IMessageProvider.ERROR); |
| 421 |
} |
457 |
} |
| 422 |
|
458 |
|
| 423 |
if (server == null) |
459 |
if (server == null) |
| 424 |
wizard.setMessage(Messages.wizErrorServerCreationError, IMessageProvider.ERROR); |
460 |
wizard.setMessage(Messages.wizErrorServerCreationError, IMessageProvider.ERROR); |
| 425 |
} |
461 |
} |
|
Lines 550-555
Link Here
|
| 550 |
} |
586 |
} |
| 551 |
listener.runtimeSelected(runtime); |
587 |
listener.runtimeSelected(runtime); |
| 552 |
} |
588 |
} |
|
|
589 |
|
| 590 |
protected void fireServerWorkingCopyChanged() { |
| 591 |
List<ServerCreationWizardPageExtension> pageExtensionLst = ServerUIPlugin.getServerCreationWizardPageExtensions(); |
| 592 |
// Add the page modifier top section UI. |
| 593 |
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) { |
| 594 |
curPageExtension.setServerWorkingCopy(getServer()); |
| 595 |
} |
| 596 |
} |
| 553 |
|
597 |
|
| 554 |
/** |
598 |
/** |
| 555 |
* Handle the server type selection. |
599 |
* Handle the server type selection. |
|
Lines 610-615
Link Here
|
| 610 |
} |
654 |
} |
| 611 |
} |
655 |
} |
| 612 |
listener.serverSelected(server); |
656 |
listener.serverSelected(server); |
|
|
657 |
// Fire the property change event. |
| 658 |
List<ServerCreationWizardPageExtension> pageExtensionLst = ServerUIPlugin.getServerCreationWizardPageExtensions(); |
| 659 |
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) { |
| 660 |
curPageExtension.handlePropertyChanged(new PropertyChangeEvent(this, AbstractUIControl.PROP_SERVER_TYPE, oldServerType, serverType)); |
| 661 |
} |
| 662 |
// Update the old server type value. |
| 663 |
oldServerType = serverType; |
| 613 |
wizard.update(); |
664 |
wizard.update(); |
| 614 |
} |
665 |
} |
| 615 |
|
666 |
|
|
Lines 657-660
Link Here
|
| 657 |
host = newHost; |
708 |
host = newHost; |
| 658 |
hostnameListener.hostnameSelected(host); |
709 |
hostnameListener.hostnameSelected(host); |
| 659 |
} |
710 |
} |
|
|
711 |
|
| 712 |
public void handleUIControlMapChanged(Map<String, UIControlEntry> controlMap) { |
| 713 |
if (controlMap == null) { |
| 714 |
return; |
| 715 |
} |
| 716 |
|
| 717 |
for (String curControlId : controlMap.keySet()) { |
| 718 |
if (AbstractUIControl.PROP_HOSTNAME.equals(curControlId)) { |
| 719 |
UIControlEntry curControlEntry = controlMap.get(curControlId); |
| 720 |
if (hostnameLabel != null) |
| 721 |
hostnameLabel.setEnabled(curControlEntry.isEnabled()); |
| 722 |
|
| 723 |
if (hostname != null){ |
| 724 |
if (curControlEntry.getNewTextValue() != null) |
| 725 |
hostname.setText(curControlEntry.getNewTextValue()); |
| 726 |
|
| 727 |
hostname.setEnabled(curControlEntry.isEnabled()); |
| 728 |
} |
| 729 |
} |
| 730 |
} |
| 731 |
} |
| 660 |
} |
732 |
} |