name.forceFocus();
}
protected void init() {
Server server = getServer();
if (name == null || server == null)
return;
originalValuesCache.url = server.getBaseURL();
originalValuesCache.serverName = server.getName();
originalValuesCache.host = server.getHost();
originalValuesCache.webroot = server.getDocumentRoot();
originalValuesCache.debuggerId = server.getDebuggerId();
// Clone the cache
modifiedValuesCache = new ValuesCache(originalValuesCache);
if (originalValuesCache.serverName != null) {
boolean nameSet = false;
String serverName = originalValuesCache.serverName;
String orgName = serverName;
if (!isForEditing()) {
for (int i = 0; i < 10; i++) {
boolean ok = checkServerName(serverName);
if (ok) {
name.setText(serverName);
// workingCopy.setName(serverName);
modifiedValuesCache.serverName = serverName;
nameSet = true;
break;
}
serverName = orgName + " (" + Integer.toString(i + 2) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
if (!nameSet) {
name.setText(""); //$NON-NLS-1$
// workingCopy.setName("");
modifiedValuesCache.serverName = ""; //$NON-NLS-1$
}
} else {
name.setText(serverName);
}
} else {
name.setText(""); //$NON-NLS-1$
}
if (originalValuesCache.webroot != null) {
webroot.setText(originalValuesCache.webroot);
}
if (originalValuesCache.debuggerId != null) {
String name = PHPDebuggersRegistry
.getDebuggerName(originalValuesCache.debuggerId);
String[] values = debuggerCombo.getItems();
for (int i = 0; i < values.length; i++) {
if (values[i].equals(name)) {
debuggerCombo.select(i);
break;
}
}
}
String baseURL = originalValuesCache.url;
if (!baseURL.equals("")) { //$NON-NLS-1$
url.setText(baseURL);
try {
URL originalURL = new URL(baseURL);
int port = originalURL.getPort();
originalValuesCache.port = port;
modifiedValuesCache.port = port;
} catch (Exception e) {
setMessage(
PHPServerUIMessages
.getString("ServerCompositeFragment.enterValidURL"), IMessageProvider.ERROR); //$NON-NLS-1$
}
} else {
baseURL = "http://" + server.getHost(); //$NON-NLS-1$
url.setText(baseURL);
modifiedValuesCache.url = baseURL;
try {
URL createdURL = new URL(baseURL);
int port = createdURL.getPort();