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 390695 | Differences between
and this patch

Collapse All | Expand All

(-)serverui/org/eclipse/wst/server/ui/internal/Messages.java (-1 / +2 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2011 IBM Corporation and others.
2
 * Copyright (c) 2005, 2012 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 268-273 Link Here
268
	public static String editorRenameFiles;
268
	public static String editorRenameFiles;
269
	public static String errorEditorCantSave;
269
	public static String errorEditorCantSave;
270
	public static String errorDuplicateName;
270
	public static String errorDuplicateName;
271
	public static String errorDuplicateServerName;
271
	public static String editorReadOnly;
272
	public static String editorReadOnly;
272
	public static String editorWritable;
273
	public static String editorWritable;
273
	public static String editorResourceModifiedTitle;
274
	public static String editorResourceModifiedTitle;
(-)serverui/org/eclipse/wst/server/ui/internal/Messages.properties (-1 / +2 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2004, 2011 IBM Corporation and others.
2
# Copyright (c) 2004, 2012 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 401-406 Link Here
401
errorConfigurationNotAccessible=The server configuration is not accessible. The {0} project is closed.
401
errorConfigurationNotAccessible=The server configuration is not accessible. The {0} project is closed.
402
errorRootModule=Could not find a valid parent module to add to the server.
402
errorRootModule=Could not find a valid parent module to add to the server.
403
errorDuplicateName=The name is already in use. Specify a different name.
403
errorDuplicateName=The name is already in use. Specify a different name.
404
errorDuplicateServerName=The server name is already in use. Specify a different name.
404
405
405
# Info messages
406
# Info messages
406
infoNoRuntimesFound=No new server runtime environments were found.
407
infoNoRuntimesFound=No new server runtime environments were found.
(-)serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewServerWizardFragment.java (-3 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2011 IBM Corporation and others.
2
 * Copyright (c) 2003, 2012 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 149-158 Link Here
149
		if(getServer().getServerType() == null)
149
		if(getServer().getServerType() == null)
150
			return false;
150
			return false;
151
		
151
		
152
		return checkHostAndServerType();
152
		return checkValidInput();
153
	}
153
	}
154
	
154
	
155
	private boolean checkHostAndServerType(){
155
	/*
156
	 * Checks for valid host name, server type, and server name
157
	 * 
158
	 * @return true if input is valid, false otherwise
159
	 */
160
	private boolean checkValidInput(){
156
		boolean isComplete = false;
161
		boolean isComplete = false;
157
162
158
		boolean supportsRemote = getServer().getServerType().supportsRemoteHosts();
163
		boolean supportsRemote = getServer().getServerType().supportsRemoteHosts();
Lines 165-170 Link Here
165
					return false;
170
					return false;
166
				}
171
				}
167
				
172
				
173
				if (manualComp.isServerNameInUse()){
174
					return false;
175
				}
176
				
168
				if (manualComp.getCurrentHostname().trim().length() == 0){
177
				if (manualComp.getCurrentHostname().trim().length() == 0){
169
					isComplete = false;
178
					isComplete = false;
170
				} else if(!supportsRemote && !SocketUtil.isLocalhost(manualComp.getCurrentHostname())){
179
				} else if(!supportsRemote && !SocketUtil.isLocalhost(manualComp.getCurrentHostname())){
(-)serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java (-4 / +53 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2011 IBM Corporation and others.
2
 * Copyright (c) 2003, 2012 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 40-45 Link Here
40
import org.eclipse.ui.dialogs.PreferencesUtil;
40
import org.eclipse.ui.dialogs.PreferencesUtil;
41
import org.eclipse.ui.help.IWorkbenchHelpSystem;
41
import org.eclipse.ui.help.IWorkbenchHelpSystem;
42
import org.eclipse.wst.server.core.*;
42
import org.eclipse.wst.server.core.*;
43
import org.eclipse.wst.server.core.internal.ServerPlugin;
43
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
44
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
44
import org.eclipse.wst.server.core.util.SocketUtil;
45
import org.eclipse.wst.server.core.util.SocketUtil;
45
import org.eclipse.wst.server.ui.AbstractUIControl;
46
import org.eclipse.wst.server.ui.AbstractUIControl;
Lines 110-115 Link Here
110
	
111
	
111
	private boolean canSupportModule=true;
112
	private boolean canSupportModule=true;
112
113
114
	// These variables deal with caching server name checks
115
	private boolean isServerNameInUse=false;
116
	private String cacheServerNameCheck="";
117
	
113
	/**
118
	/**
114
	 * Creates a new server and server configuration.  If the initial
119
	 * Creates a new server and server configuration.  If the initial
115
	 * resource selection contains exactly one container resource then it will be
120
	 * resource selection contains exactly one container resource then it will be
Lines 236-241 Link Here
236
					return;
241
					return;
237
				
242
				
238
				String name = serverName.getText();
243
				String name = serverName.getText();
244
								
245
				IServerType selectedServerType = serverTypeComposite.getSelectedServerType();
246
				if (validate(selectedServerType)) {
247
					// Do not set the server name if it is invalid
248
					return;			
249
				}
250
				
239
				if (server != null) {
251
				if (server != null) {
240
					server.setName(name);
252
					server.setName(name);
241
					IRuntime runtime2 = server.getRuntime();
253
					IRuntime runtime2 = server.getRuntime();
Lines 392-398 Link Here
392
	protected void handleHostnameChange(IServerType serverType) {
404
	protected void handleHostnameChange(IServerType serverType) {
393
405
394
		wizard.setMessage(null, IMessageProvider.NONE);
406
		wizard.setMessage(null, IMessageProvider.NONE);
395
		if (!checkHostAndServerType(serverType)) {
407
		if (!validate(serverType)) {
396
			return;// Host name validation failed, so there is no need to continue handling hostname change event			
408
			return;// Host name validation failed, so there is no need to continue handling hostname change event			
397
		}
409
		}
398
		loadServerImpl(serverType);
410
		loadServerImpl(serverType);
Lines 438-447 Link Here
438
			wizard.setMessage(NLS.bind(Messages.wizCheckRemoteSupport, new Object[0]), IMessageProvider.ERROR);
450
			wizard.setMessage(NLS.bind(Messages.wizCheckRemoteSupport, new Object[0]), IMessageProvider.ERROR);
439
			return false;
451
			return false;
440
		}
452
		}
441
		
453
454
		return true;
455
	}
456
	
457
	protected boolean checkServerName(){		
458
		if (isServerNameInUse()){
459
			wizard.setMessage(Messages.errorDuplicateServerName, IMessageProvider.ERROR);
460
			return false;			
461
		}
442
		return true;
462
		return true;
443
	}
463
	}
444
	
464
	
465
	protected boolean validate(IServerType selectedServerType){
466
		wizard.setMessage(null, IMessageProvider.NONE);
467
		return (checkHostAndServerType(selectedServerType) & checkServerName());
468
	}
469
	
445
	/**
470
	/**
446
	 * Load a server of the given type.
471
	 * Load a server of the given type.
447
	 */
472
	 */
Lines 723-729 Link Here
723
		// Update the old server type value.
748
		// Update the old server type value.
724
		oldServerType = serverType;
749
		oldServerType = serverType;
725
750
726
		checkHostAndServerType(serverType);
751
		validate(serverType);
727
		wizard.update();
752
		wizard.update();
728
	}
753
	}
729
754
Lines 883-886 Link Here
883
			hostName = host;
908
			hostName = host;
884
		}
909
		}
885
	}
910
	}
911
	
912
	/**
913
	 * Determines if the server name is in use. The server name that is checked
914
	 * is cached to increase performance on multiple calls. 
915
	 * 
916
	 * @return true if name is in use, false otherwise
917
	 */
918
	public boolean isServerNameInUse(){
919
		String myServerName="";
920
		if (serverName != null){
921
			myServerName = serverName.getText().trim();
922
			// If the server name is equal to the cached server name, then return the
923
			// previously cached value. If the server name is not equal to the cached
924
			// server name, check to see if the name is in use
925
			if (!cacheServerNameCheck.equals(myServerName)){
926
				cacheServerNameCheck = myServerName;
927
				isServerNameInUse = ServerPlugin.isNameInUse(server, serverName.getText().trim());				
928
			}
929
			return isServerNameInUse;			
930
		}
931
932
		// If the widget is null, return false
933
		return false;
934
	}	
886
}
935
}

Return to bug 390695