|
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 21-34
Link Here
|
| 21 |
import org.eclipse.jface.action.ToolBarManager; |
23 |
import org.eclipse.jface.action.ToolBarManager; |
| 22 |
import org.eclipse.jface.dialogs.Dialog; |
24 |
import org.eclipse.jface.dialogs.Dialog; |
| 23 |
import org.eclipse.jface.dialogs.IMessageProvider; |
25 |
import org.eclipse.jface.dialogs.IMessageProvider; |
| 24 |
import org.eclipse.jface.fieldassist.*; |
26 |
import org.eclipse.jface.fieldassist.AutoCompleteField; |
|
|
27 |
import org.eclipse.jface.fieldassist.ControlDecoration; |
| 28 |
import org.eclipse.jface.fieldassist.FieldDecoration; |
| 29 |
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; |
| 30 |
import org.eclipse.jface.fieldassist.TextContentAdapter; |
| 25 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
31 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
| 26 |
import org.eclipse.jface.preference.PreferenceDialog; |
32 |
import org.eclipse.jface.preference.PreferenceDialog; |
| 27 |
import org.eclipse.jface.window.Window; |
33 |
import org.eclipse.jface.window.Window; |
| 28 |
import org.eclipse.jface.wizard.WizardDialog; |
34 |
import org.eclipse.jface.wizard.WizardDialog; |
| 29 |
import org.eclipse.osgi.util.NLS; |
35 |
import org.eclipse.osgi.util.NLS; |
| 30 |
import org.eclipse.swt.SWT; |
36 |
import org.eclipse.swt.SWT; |
| 31 |
import org.eclipse.swt.events.*; |
37 |
import org.eclipse.swt.events.FocusEvent; |
|
|
38 |
import org.eclipse.swt.events.FocusListener; |
| 39 |
import org.eclipse.swt.events.ModifyEvent; |
| 40 |
import org.eclipse.swt.events.ModifyListener; |
| 41 |
import org.eclipse.swt.events.SelectionAdapter; |
| 42 |
import org.eclipse.swt.events.SelectionEvent; |
| 43 |
import org.eclipse.swt.events.SelectionListener; |
| 32 |
import org.eclipse.swt.layout.GridData; |
44 |
import org.eclipse.swt.layout.GridData; |
| 33 |
import org.eclipse.swt.layout.GridLayout; |
45 |
import org.eclipse.swt.layout.GridLayout; |
| 34 |
import org.eclipse.swt.widgets.Combo; |
46 |
import org.eclipse.swt.widgets.Combo; |
|
Lines 40-59
Link Here
|
| 40 |
import org.eclipse.ui.PlatformUI; |
52 |
import org.eclipse.ui.PlatformUI; |
| 41 |
import org.eclipse.ui.dialogs.PreferencesUtil; |
53 |
import org.eclipse.ui.dialogs.PreferencesUtil; |
| 42 |
import org.eclipse.ui.help.IWorkbenchHelpSystem; |
54 |
import org.eclipse.ui.help.IWorkbenchHelpSystem; |
| 43 |
import org.eclipse.wst.server.core.*; |
55 |
import org.eclipse.wst.server.core.IModule; |
|
|
56 |
import org.eclipse.wst.server.core.IModuleType; |
| 57 |
import org.eclipse.wst.server.core.IRuntime; |
| 58 |
import org.eclipse.wst.server.core.IRuntimeType; |
| 59 |
import org.eclipse.wst.server.core.IRuntimeWorkingCopy; |
| 60 |
import org.eclipse.wst.server.core.IServerAttributes; |
| 61 |
import org.eclipse.wst.server.core.IServerType; |
| 62 |
import org.eclipse.wst.server.core.IServerWorkingCopy; |
| 63 |
import org.eclipse.wst.server.core.ServerUtil; |
| 64 |
import org.eclipse.wst.server.core.TaskModel; |
| 44 |
import org.eclipse.wst.server.core.internal.ServerWorkingCopy; |
65 |
import org.eclipse.wst.server.core.internal.ServerWorkingCopy; |
| 45 |
import org.eclipse.wst.server.core.util.SocketUtil; |
66 |
import org.eclipse.wst.server.core.util.SocketUtil; |
| 46 |
import org.eclipse.wst.server.ui.internal.*; |
67 |
import org.eclipse.wst.server.ui.AbstractUIControl; |
|
|
68 |
import org.eclipse.wst.server.ui.AbstractUIControl.IUIControlListener; |
| 69 |
import org.eclipse.wst.server.ui.AbstractUIControl.UIControlEntry; |
| 70 |
import org.eclipse.wst.server.ui.internal.ContextIds; |
| 71 |
import org.eclipse.wst.server.ui.internal.ImageResource; |
| 72 |
import org.eclipse.wst.server.ui.internal.Messages; |
| 73 |
import org.eclipse.wst.server.ui.internal.SWTUtil; |
| 74 |
import org.eclipse.wst.server.ui.internal.ServerUIPlugin; |
| 75 |
import org.eclipse.wst.server.ui.internal.Trace; |
| 47 |
import org.eclipse.wst.server.ui.internal.viewers.ServerTypeComposite; |
76 |
import org.eclipse.wst.server.ui.internal.viewers.ServerTypeComposite; |
| 48 |
import org.eclipse.wst.server.ui.internal.wizard.TaskWizard; |
77 |
import org.eclipse.wst.server.ui.internal.wizard.TaskWizard; |
| 49 |
import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil; |
78 |
import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil; |
| 50 |
import org.eclipse.wst.server.ui.internal.wizard.page.HostnameComposite.IHostnameSelectionListener; |
79 |
import org.eclipse.wst.server.ui.internal.wizard.page.HostnameComposite.IHostnameSelectionListener; |
|
|
80 |
import org.eclipse.wst.server.ui.wizard.ServerCreationWizardPageExtension; |
| 51 |
import org.eclipse.wst.server.ui.wizard.WizardFragment; |
81 |
import org.eclipse.wst.server.ui.wizard.WizardFragment; |
| 52 |
|
82 |
|
| 53 |
/** |
83 |
/** |
| 54 |
* Wizard page used to create a server and configuration at the same time. |
84 |
* Wizard page used to create a server and configuration at the same time. |
| 55 |
*/ |
85 |
*/ |
| 56 |
public class NewManualServerComposite extends Composite { |
86 |
public class NewManualServerComposite extends Composite implements IUIControlListener { |
| 57 |
public interface ServerSelectionListener { |
87 |
public interface ServerSelectionListener { |
| 58 |
public void serverSelected(IServerAttributes server); |
88 |
public void serverSelected(IServerAttributes server); |
| 59 |
public void runtimeSelected(IRuntime runtime); |
89 |
public void runtimeSelected(IRuntime runtime); |
|
Lines 95-104
Link Here
|
| 95 |
protected String lastHostname; |
125 |
protected String lastHostname; |
| 96 |
protected HostnameComposite manualHostComp; |
126 |
protected HostnameComposite manualHostComp; |
| 97 |
IHostnameSelectionListener hostnameListener; |
127 |
IHostnameSelectionListener hostnameListener; |
|
|
128 |
protected Label hostnameLabel; |
| 98 |
protected Text hostname; |
129 |
protected Text hostname; |
| 99 |
protected ControlDecoration hostnameDecoration; |
130 |
protected ControlDecoration hostnameDecoration; |
| 100 |
|
131 |
|
| 101 |
protected ServerCreationCache cache = new ServerCreationCache(); |
132 |
protected ServerCreationCache cache = new ServerCreationCache(); |
|
|
133 |
|
| 134 |
private IServerType oldServerType = null; |
| 102 |
|
135 |
|
| 103 |
/** |
136 |
/** |
| 104 |
* Creates a new server and server configuration. If the initial |
137 |
* Creates a new server and server configuration. If the initial |
|
Lines 144-149
Link Here
|
| 144 |
IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem(); |
177 |
IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem(); |
| 145 |
whs.setHelp(this, ContextIds.NEW_SERVER_WIZARD); |
178 |
whs.setHelp(this, ContextIds.NEW_SERVER_WIZARD); |
| 146 |
|
179 |
|
|
|
180 |
List<ServerCreationWizardPageExtension> pageExtensionLst = ServerUIPlugin.getServerCreationWizardPageExtensions(); |
| 181 |
// Add the page modifier top section UI. |
| 182 |
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) { |
| 183 |
curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.TOP, this); |
| 184 |
curPageExtension.setUIControlListener(this); |
| 185 |
} |
| 186 |
|
| 147 |
serverTypeComposite = new ServerTypeComposite(this, moduleType, serverTypeId, new ServerTypeComposite.ServerTypeSelectionListener() { |
187 |
serverTypeComposite = new ServerTypeComposite(this, moduleType, serverTypeId, new ServerTypeComposite.ServerTypeSelectionListener() { |
| 148 |
public void serverTypeSelected(IServerType type2) { |
188 |
public void serverTypeSelected(IServerType type2) { |
| 149 |
handleTypeSelection(type2); |
189 |
handleTypeSelection(type2); |
|
Lines 156-168
Link Here
|
| 156 |
serverTypeComposite.setLayoutData(data); |
196 |
serverTypeComposite.setLayoutData(data); |
| 157 |
whs.setHelp(serverTypeComposite, ContextIds.NEW_SERVER_TYPE); |
197 |
whs.setHelp(serverTypeComposite, ContextIds.NEW_SERVER_TYPE); |
| 158 |
|
198 |
|
|
|
199 |
// Add the page modifier middle section UI. |
| 200 |
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) { |
| 201 |
curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.MIDDLE, this); |
| 202 |
} |
| 203 |
|
| 159 |
hostnameListener = new IHostnameSelectionListener() { |
204 |
hostnameListener = new IHostnameSelectionListener() { |
| 160 |
public void hostnameSelected(String selectedHostname) { |
205 |
public void hostnameSelected(String selectedHostname) { |
| 161 |
lastHostname = selectedHostname; |
206 |
lastHostname = selectedHostname; |
| 162 |
setHost(selectedHostname); |
207 |
setHost(selectedHostname); |
| 163 |
} |
208 |
} |
| 164 |
}; |
209 |
}; |
| 165 |
Label hostnameLabel = new Label(this, SWT.NONE); |
210 |
hostnameLabel = new Label(this, SWT.NONE); |
| 166 |
hostnameLabel.setText(Messages.hostname); |
211 |
hostnameLabel.setText(Messages.hostname); |
| 167 |
hostname = new Text(this, SWT.SINGLE | SWT.BORDER | SWT.CANCEL); |
212 |
hostname = new Text(this, SWT.SINGLE | SWT.BORDER | SWT.CANCEL); |
| 168 |
hostname.setText(HostnameComposite.LOCALHOST); |
213 |
hostname.setText(HostnameComposite.LOCALHOST); |
|
Lines 298-303
Link Here
|
| 298 |
} |
343 |
} |
| 299 |
} |
344 |
} |
| 300 |
}); |
345 |
}); |
|
|
346 |
|
| 347 |
// Add the page modifier bottom section UI. |
| 348 |
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) { |
| 349 |
curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.TOP, this); |
| 350 |
} |
| 351 |
|
| 301 |
Dialog.applyDialogFont(this); |
352 |
Dialog.applyDialogFont(this); |
| 302 |
} |
353 |
} |
| 303 |
|
354 |
|
|
Lines 344-362
Link Here
|
| 344 |
return returnValue; |
395 |
return returnValue; |
| 345 |
} |
396 |
} |
| 346 |
|
397 |
|
|
|
398 |
public String getControlStringValue(String controlId) { |
| 399 |
if (controlId != null && AbstractUIControl.PROP_HOSTNAME.equals(controlId)) { |
| 400 |
return host; |
| 401 |
} |
| 402 |
return null; |
| 403 |
} |
| 404 |
|
| 347 |
public void setHost(String host) { |
405 |
public void setHost(String host) { |
| 348 |
this.host = host; |
406 |
this.host = host; |
| 349 |
if (serverTypeComposite == null) |
407 |
if (serverTypeComposite == null) |
| 350 |
return; |
408 |
return; |
| 351 |
|
409 |
|
| 352 |
boolean changed = false; |
410 |
boolean changed = false; |
| 353 |
if (host == null) { |
411 |
if (host == null) { |
| 354 |
changed = serverTypeComposite.setHost(true); |
412 |
changed = serverTypeComposite.setHost(true); |
| 355 |
} else if (SocketUtil.isLocalhost(host)) |
413 |
} else if (SocketUtil.isLocalhost(host)) |
| 356 |
changed = serverTypeComposite.setHost(true); |
414 |
changed = serverTypeComposite.setHost(true); |
| 357 |
else |
415 |
else |
| 358 |
changed = serverTypeComposite.setHost(false); |
416 |
changed = serverTypeComposite.setHost(false); |
| 359 |
|
417 |
|
| 360 |
if (changed) |
418 |
if (changed) |
| 361 |
handleTypeSelection(serverTypeComposite.getSelectedServerType()); |
419 |
handleTypeSelection(serverTypeComposite.getSelectedServerType()); |
| 362 |
else if (server != null) { |
420 |
else if (server != null) { |
|
Lines 387-392
Link Here
|
| 387 |
((ServerWorkingCopy)server).setDefaults(null); |
445 |
((ServerWorkingCopy)server).setDefaults(null); |
| 388 |
runtime = server.getRuntime(); |
446 |
runtime = server.getRuntime(); |
| 389 |
listener.runtimeSelected(runtime); |
447 |
listener.runtimeSelected(runtime); |
|
|
448 |
fireServerWorkingCopyChanged(); |
| 390 |
return; |
449 |
return; |
| 391 |
} |
450 |
} |
| 392 |
|
451 |
|
|
Lines 412-417
Link Here
|
| 412 |
} |
471 |
} |
| 413 |
|
472 |
|
| 414 |
((ServerWorkingCopy)server).setDefaults(null); |
473 |
((ServerWorkingCopy)server).setDefaults(null); |
|
|
474 |
fireServerWorkingCopyChanged(); |
| 415 |
} |
475 |
} |
| 416 |
} catch (CoreException ce) { |
476 |
} catch (CoreException ce) { |
| 417 |
Trace.trace(Trace.SEVERE, "Error creating server", ce); |
477 |
Trace.trace(Trace.SEVERE, "Error creating server", ce); |
|
Lines 419-425
Link Here
|
| 419 |
runtime = null; |
479 |
runtime = null; |
| 420 |
wizard.setMessage(ce.getLocalizedMessage(), IMessageProvider.ERROR); |
480 |
wizard.setMessage(ce.getLocalizedMessage(), IMessageProvider.ERROR); |
| 421 |
} |
481 |
} |
| 422 |
|
482 |
|
| 423 |
if (server == null) |
483 |
if (server == null) |
| 424 |
wizard.setMessage(Messages.wizErrorServerCreationError, IMessageProvider.ERROR); |
484 |
wizard.setMessage(Messages.wizErrorServerCreationError, IMessageProvider.ERROR); |
| 425 |
} |
485 |
} |
|
Lines 550-555
Link Here
|
| 550 |
} |
610 |
} |
| 551 |
listener.runtimeSelected(runtime); |
611 |
listener.runtimeSelected(runtime); |
| 552 |
} |
612 |
} |
|
|
613 |
|
| 614 |
protected void fireServerWorkingCopyChanged() { |
| 615 |
List<ServerCreationWizardPageExtension> pageExtensionLst = ServerUIPlugin.getServerCreationWizardPageExtensions(); |
| 616 |
// Add the page modifier top section UI. |
| 617 |
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) { |
| 618 |
curPageExtension.setServerWorkingCopy(getServer()); |
| 619 |
} |
| 620 |
} |
| 553 |
|
621 |
|
| 554 |
/** |
622 |
/** |
| 555 |
* Handle the server type selection. |
623 |
* Handle the server type selection. |
|
Lines 610-615
Link Here
|
| 610 |
} |
678 |
} |
| 611 |
} |
679 |
} |
| 612 |
listener.serverSelected(server); |
680 |
listener.serverSelected(server); |
|
|
681 |
// Fire the property change event. |
| 682 |
List<ServerCreationWizardPageExtension> pageExtensionLst = ServerUIPlugin.getServerCreationWizardPageExtensions(); |
| 683 |
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) { |
| 684 |
curPageExtension.handlePropertyChanged(new PropertyChangeEvent(this, AbstractUIControl.PROP_SERVER_TYPE, oldServerType, serverType)); |
| 685 |
} |
| 686 |
// Update the old server type value. |
| 687 |
oldServerType = serverType; |
| 613 |
wizard.update(); |
688 |
wizard.update(); |
| 614 |
} |
689 |
} |
| 615 |
|
690 |
|
|
Lines 657-660
Link Here
|
| 657 |
host = newHost; |
732 |
host = newHost; |
| 658 |
hostnameListener.hostnameSelected(host); |
733 |
hostnameListener.hostnameSelected(host); |
| 659 |
} |
734 |
} |
|
|
735 |
|
| 736 |
public void handleUIControlMapChanged(Map<String, UIControlEntry> controlMap) { |
| 737 |
if (controlMap == null) { |
| 738 |
return; |
| 739 |
} |
| 740 |
|
| 741 |
for (String curControlId : controlMap.keySet()) { |
| 742 |
if (AbstractUIControl.PROP_HOSTNAME.equals(curControlId)) { |
| 743 |
UIControlEntry curControlEntry = controlMap.get(curControlId); |
| 744 |
if (hostnameLabel != null) { |
| 745 |
hostnameLabel.setEnabled(curControlEntry.isEnabled()); |
| 746 |
} |
| 747 |
if (hostname != null){ |
| 748 |
if (curControlEntry.getNewTextValue() != null) { |
| 749 |
hostname.setText(curControlEntry.getNewTextValue()); |
| 750 |
} |
| 751 |
hostname.setEnabled(curControlEntry.isEnabled()); |
| 752 |
} |
| 753 |
} |
| 754 |
} |
| 755 |
} |
| 660 |
} |
756 |
} |