Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 296345 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.properties (+1 lines)
Lines 18-23 Link Here
18
extensionPointWizardFragments=Wizard Fragments
18
extensionPointWizardFragments=Wizard Fragments
19
extensionPointInitialSelectionProvider=Initial Selection Provider
19
extensionPointInitialSelectionProvider=Initial Selection Provider
20
extensionPointAudio=Audio
20
extensionPointAudio=Audio
21
extensionPointServerCreationWizardPageExtension=Server Creation Wizard Page Extension
21
22
22
# --------------- Wizards and Views ---------------
23
# --------------- Wizards and Views ---------------
23
24
(-)plugin.xml (+1 lines)
Lines 10-15 Link Here
10
  <extension-point id="initialSelectionProvider" name="%extensionPointInitialSelectionProvider" schema="schema/initialSelectionProvider.exsd"/>
10
  <extension-point id="initialSelectionProvider" name="%extensionPointInitialSelectionProvider" schema="schema/initialSelectionProvider.exsd"/>
11
  <extension-point id="audio" name="%extensionPointAudio" schema="schema/audio.exsd"/>
11
  <extension-point id="audio" name="%extensionPointAudio" schema="schema/audio.exsd"/>
12
  <extension-point id="serverToolTip" name="%extensionPointServerToolTip" schema="schema/serverToolTip.exsd"/>
12
  <extension-point id="serverToolTip" name="%extensionPointServerToolTip" schema="schema/serverToolTip.exsd"/>
13
  <extension-point id="serverCreationWizardPageExtension" name="%extensionPointServerCreationWizardPageExtension" schema="schema/serverCreationWizardPageExtension.exsd"/>
13
14
14
<extension point="org.eclipse.ui.newWizards">
15
<extension point="org.eclipse.ui.newWizards">
15
  <category
16
  <category
(-)serverui/org/eclipse/wst/server/ui/internal/ServerUIPlugin.java (-1 / +46 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2008 IBM Corporation and others.
2
 * Copyright (c) 2003, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 43-48 Link Here
43
import org.eclipse.wst.server.ui.internal.wizard.fragment.NewRuntimeWizardFragment;
43
import org.eclipse.wst.server.ui.internal.wizard.fragment.NewRuntimeWizardFragment;
44
import org.eclipse.wst.server.ui.internal.wizard.fragment.NewServerWizardFragment;
44
import org.eclipse.wst.server.ui.internal.wizard.fragment.NewServerWizardFragment;
45
import org.eclipse.wst.server.ui.internal.wizard.fragment.TasksWizardFragment;
45
import org.eclipse.wst.server.ui.internal.wizard.fragment.TasksWizardFragment;
46
import org.eclipse.wst.server.ui.wizard.ServerCreationWizardPageExtension;
46
import org.eclipse.wst.server.ui.wizard.WizardFragment;
47
import org.eclipse.wst.server.ui.wizard.WizardFragment;
47
48
48
import org.eclipse.osgi.util.NLS;
49
import org.eclipse.osgi.util.NLS;
Lines 87-92 Link Here
87
88
88
	// cached copy of all runtime wizards
89
	// cached copy of all runtime wizards
89
	private static Map<String, WizardFragmentData> wizardFragments;
90
	private static Map<String, WizardFragmentData> wizardFragments;
91
	
92
	// Cached copy of all server wizard GUI modifier
93
	private static List<ServerCreationWizardPageExtension> serverCreationWizardPageExtensions;
90
94
91
	// cached initial selection provider
95
	// cached initial selection provider
92
	private static InitialSelectionProvider selectionProvider;
96
	private static InitialSelectionProvider selectionProvider;
Lines 716-721 Link Here
716
	}
720
	}
717
721
718
	/**
722
	/**
723
	 * Returns the list of server creation wizard modifier.
724
	 *
725
	 * @return the list of server creation wizard modifier, or an empty list if none could be found
726
	 */
727
	public static List<ServerCreationWizardPageExtension> getServerCreationWizardPageExtensions() {
728
		if (serverCreationWizardPageExtensions == null) {
729
			loadServerCreationWizardPageExtensions();
730
		}
731
		return serverCreationWizardPageExtensions;
732
	}
733
734
	/**
735
	 * Load the Server creation wizard page modifiers.
736
	 */
737
	private static synchronized void loadServerCreationWizardPageExtensions() {
738
		if (serverCreationWizardPageExtensions != null)
739
			return;
740
		
741
		Trace.trace(Trace.CONFIG, "->- Loading .serverCreationWizardPageExtension extension point ->-");
742
		serverCreationWizardPageExtensions = new ArrayList<ServerCreationWizardPageExtension>();
743
		IExtensionRegistry registry = Platform.getExtensionRegistry();
744
		IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, "serverCreationWizardPageExtension");
745
		
746
		for (IConfigurationElement curConfigElement: cf) {
747
			try {
748
				// Create the class here already since the usage of the server wizard page will need to use all the extensions
749
				// in all the calls.  Therefore, there is no need for lazy loading here.
750
				ServerCreationWizardPageExtension curExtension = (ServerCreationWizardPageExtension)curConfigElement.createExecutableExtension("class");
751
				Trace.trace(Trace.CONFIG, "  Loaded serverCreationWizardPageExtension: " + cf[0].getAttribute("id") + ", loaded class=" + curExtension);
752
				if (curExtension != null) {
753
					serverCreationWizardPageExtensions.add(curExtension);
754
				}
755
			} catch (Throwable t) {
756
				Trace.trace(Trace.SEVERE, "  Could not load serverCreationWizardPageExtension: " + cf[0].getAttribute("id"), t);
757
			}
758
		}
759
		
760
		Trace.trace(Trace.CONFIG, "-<- Done loading .serverCreationWizardPageExtension extension point -<-");
761
	}
762
763
	/**
719
	 * Load the initial selection provider.
764
	 * Load the initial selection provider.
720
	 */
765
	 */
721
	private static synchronized void loadInitialSelectionProvider() {
766
	private static synchronized void loadInitialSelectionProvider() {
(-)serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java (-15 / +111 lines)
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
}
(-)serverui/org/eclipse/wst/server/ui/AbstractUIControl.java (+102 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - Initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.wst.server.ui;
12
13
import java.beans.PropertyChangeEvent;
14
import java.util.HashMap;
15
import java.util.Map;
16
17
/**
18
 * The Abstract UI control that allows adopter to control the UI from other provider.
19
 * AbstractUIControl
20
 */
21
public abstract class AbstractUIControl {
22
	// Control map describing the UI that needs to be controlled. 
23
	public Map<String, UIControlEntry> controlMap = new HashMap<String, UIControlEntry>();
24
	// UI Control listener that listens to changes in event on GUI provided by this UI control
25
	public IUIControlListener controlListener;
26
	
27
	// The list of properties supported by the existing UI control.
28
	public static final String PROP_HOSTNAME = "PROP_HOSTNAME";
29
	public static final String PROP_SERVER_TYPE = "PROP_SERVERTYPE";
30
31
	/**
32
	 * UI Control listener that listens to changes in event on GUI provided by this UI control
33
	 * IUIControlListener
34
	 */
35
	public interface IUIControlListener {
36
		/**
37
		 * Handle the UI control map change by the listener based on the given control map.
38
		 * @param controlMap the control map that describes the UI control.
39
		 */
40
		public void handleUIControlMapChanged(Map<String, UIControlEntry> controlMap);
41
		/**
42
		 * Get the value of a given control UI on the listener's page.
43
		 * @param controlId control ID of the UI on the listener's page.
44
		 * @return the String value of the given control ID field.
45
		 */
46
		public String getControlStringValue(String controlId);
47
	}
48
	
49
	/**
50
	 * UI control entry class that describes the behaviour of the UI control of specific fields or widget.
51
	 * UIControlEntry
52
	 */
53
	public class UIControlEntry {
54
		private boolean isEnabled;
55
		private String newTextValue;
56
		
57
		public UIControlEntry(boolean curIsEnabled, String curNewTextValue) {
58
			isEnabled = curIsEnabled;
59
			newTextValue = curNewTextValue;
60
		}
61
62
		/**
63
		 * Gives the new text value of the given field.
64
		 * @return the new text value of the given field. If the value returns <code>null</code>, then it means
65
		 * the field do not need to be modified.
66
		 */
67
		public String getNewTextValue() {
68
    	return newTextValue;
69
    }
70
71
		/**
72
		 * Return if the UI control needs to be enabled.
73
		 * @return true if value needs to be enabled; otherwise, return false.
74
		 */
75
		public boolean isEnabled() {
76
    	return isEnabled;
77
    }
78
	}
79
80
	/**
81
	 * Fire the control change event for the changed control map to take effect.
82
	 */
83
	protected void fireUIControlChangedEvent() {
84
		if (controlListener != null) {
85
			controlListener.handleUIControlMapChanged(controlMap);
86
		}
87
	}
88
	
89
	/**
90
	 * Allow UI Control to react based on a property change and change the UI control.
91
	 * @param event property change event that describes the change.
92
	 */
93
	public abstract void handlePropertyChanged(PropertyChangeEvent event);
94
	
95
	/**
96
	 * Set the UI control listener that listens to the changes initialed by this UI control. 
97
	 * @param curControlListener the UI control listener
98
	 */
99
	public void setUIControlListener(IUIControlListener curControlListener) {
100
		controlListener = curControlListener;
101
	}
102
}
(-)serverui/org/eclipse/wst/server/ui/wizard/ServerCreationWizardPageExtension.java (+45 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - Initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.wst.server.ui.wizard;
12
13
import org.eclipse.swt.widgets.Composite;
14
import org.eclipse.wst.server.core.IServerWorkingCopy;
15
import org.eclipse.wst.server.ui.AbstractUIControl;
16
17
/**
18
 * A modifier class that allow adopter to modify the behaviour of the server creation wizard page.
19
 * It also has places where adopter can inject custom GUI into the server creation wizard page.
20
 * ServerCreationWizardPageExtension
21
 */
22
public abstract class ServerCreationWizardPageExtension extends AbstractUIControl {
23
	protected IServerWorkingCopy serverWc = null;
24
	
25
	/**
26
	 * The list of position on the server creation wizard page that allows inserting custom GUI.
27
	 * UI_POSITION
28
	 */
29
	public enum UI_POSITION { TOP, MIDDLE, BOTTOM }
30
31
	/**
32
	 * Create the customer UI on the specified position.
33
	 * @param position the position on the server creation wizard page that allows inserting custom GUI.
34
	 * @param parent parent composite.
35
	 */
36
	public abstract void createControl(UI_POSITION position, Composite parent);
37
	
38
	/**
39
	 * Set the server working copy to the control to allow extension to store the extension values.
40
	 * @param curServerWc
41
	 */
42
	public void setServerWorkingCopy(IServerWorkingCopy curServerWc) {
43
		serverWc = curServerWc;
44
	}
45
}
(-)schema/serverCreationWizardPageExtension.exsd (+139 lines)
Added Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.wst.server.ui" xmlns="http://www.w3.org/2001/XMLSchema">
4
<annotation>
5
      <appinfo>
6
         <meta.schema plugin="org.eclipse.wst.server.ui" id="serverCreationWizardPageExtension" name="Server Creation Wizard Page Extension"/>
7
      </appinfo>
8
      <documentation>
9
         This extension point provides a way to for adopters to modify the first page of the server creation wizard page.  It provides mechanisms to add custom UI to different sections of the server creation wizard page.  It also allow adopter to control the display of some existing UI on the server creation wizard page.
10
      </documentation>
11
   </annotation>
12
13
   <element name="extension">
14
      <annotation>
15
         <appinfo>
16
            <meta.element />
17
         </appinfo>
18
      </annotation>
19
      <complexType>
20
         <sequence>
21
            <element ref="serverCreationWizardPageExtension"/>
22
         </sequence>
23
         <attribute name="point" type="string" use="required">
24
            <annotation>
25
               <documentation>
26
                  a fully qualified identifier of the target extension point
27
               </documentation>
28
            </annotation>
29
         </attribute>
30
         <attribute name="id" type="string">
31
            <annotation>
32
               <documentation>
33
                  an optional identifier of the extension instance
34
               </documentation>
35
            </annotation>
36
         </attribute>
37
         <attribute name="name" type="string">
38
            <annotation>
39
               <documentation>
40
                  an optional name of the extension instance
41
               </documentation>
42
            </annotation>
43
         </attribute>
44
      </complexType>
45
   </element>
46
47
   <element name="serverCreationWizardPageExtension">
48
      <annotation>
49
         <appinfo>
50
            <meta.element labelAttribute="name"/>
51
         </appinfo>
52
      </annotation>
53
      <complexType>
54
         <attribute name="id" type="string" use="required">
55
            <annotation>
56
               <documentation>
57
                  specifies a unique identifier for this extension point
58
               </documentation>
59
            </annotation>
60
         </attribute>
61
         <attribute name="class" type="string" use="required">
62
            <annotation>
63
               <documentation>
64
                  specifies the fully qualified name of the Java class that extends &lt;samp&gt;org.eclipse.wst.server.ui.editor.ServerCreationWizardPageExtension&lt;/samp&gt;. The class must have a public 0-arg constructor.
65
               </documentation>
66
               <appinfo>
67
                  <meta.attribute kind="java"/>
68
               </appinfo>
69
            </annotation>
70
         </attribute>
71
      </complexType>
72
   </element>
73
74
   <annotation>
75
      <appinfo>
76
         <meta.section type="since"/>
77
      </appinfo>
78
      <documentation>
79
         &lt;b&gt;This extension point is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.&lt;/b&gt;
80
      </documentation>
81
   </annotation>
82
83
   <annotation>
84
      <appinfo>
85
         <meta.section type="examples"/>
86
      </appinfo>
87
      <documentation>
88
         3.2
89
      </documentation>
90
   </annotation>
91
92
   <annotation>
93
      <appinfo>
94
         <meta.section type="implementation"/>
95
      </appinfo>
96
      <documentation>
97
         The following is an example of the extension point:
98
99
&lt;pre&gt;
100
   &lt;extension
101
         point=&quot;org.eclipse.wst.server.ui.serverCreationWizardPageExtension&quot;&gt;
102
      &lt;serverCreationWizardPageExtension
103
            id=&quot;org.eclipse.wst.server.ui.test.serverCreationWizardPageExtension&quot;
104
                        class=&quot;org.eclipse.wst.server.ui.test.internal.serverCreationWizardPageExtension.ServerCreationWizardPageExtensionTest&quot;/&gt;
105
   &lt;/extension&gt;
106
&lt;/pre&gt;
107
      </documentation>
108
   </annotation>
109
110
   <annotation>
111
      <appinfo>
112
         <meta.section type="copyright"/>
113
      </appinfo>
114
      <documentation>
115
         Copyright (c) 2009 IBM Corporation and others.&lt;br&gt;
116
All rights reserved. This program and the accompanying materials are made 
117
available under the terms of the Eclipse Public License v1.0 which accompanies 
118
this distribution, and is available at 
119
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
120
      </documentation>
121
   </annotation>
122
123
   <annotation>
124
      <appinfo>
125
         <meta.section type="apiInfo"/>
126
      </appinfo>
127
      <documentation>
128
         Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that extends &lt;code&gt;org.eclipse.wst.server.ui.editor.ServerCreationWizardPageExtension&lt;/code&gt;.
129
130
This extension point currently only supports the control on the following fields on the implementation of org.eclipse.wst.server.ui.AbstractUIControl.IUIControlListener.handleUIControlMapChanged(Map&lt;String, UIControlEntry&gt;):
131
Server&apos;s host name
132
133
This extension point currently only issue property change event on the following property change:
134
Server type selection change
135
136
      </documentation>
137
   </annotation>
138
139
</schema>

Return to bug 296345