[171559] Autorefresh editor
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java
index 4b8b8e2..c8c5f8a 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java
@@ -22,7 +22,6 @@
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.commands.operations.IUndoableOperation;
 import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.wst.server.core.*;
@@ -202,9 +201,8 @@
 	 * Reload the command manager for a given id.
 	 * 
 	 * @param id an id
-	 * @param monitor a progress monitor
 	 */
-	public void reload(String id, IProgressMonitor monitor) {
+	public void reload(String id) {
 		try {
 			CommandManagerInfo info = getExistingCommandManagerInfo(id);
 			if (info != null) {
@@ -213,15 +211,18 @@
 					server = ServerCore.findServer(id);
 				if (server != null)
 					info.wc = server.createWorkingCopy();
-				//info.serverElement = ServerCore.getResourceManager().getServer()
-				//info.serverElement = ServerCore.getEditManager().reloadEditModel(info.file, monitor);
 				firePropertyChangeEvent(PROP_RELOAD, id, null);
 			}
+			clearUndoList(id);
+			clearRedoList(id);
+			undoSaveIndex = undoList.size();
+			setDirtyState(id, false);
+			updateTimestamps(id);
 		} catch (Exception e) {
 			Trace.trace(Trace.SEVERE, "Could not release command manager", e);
 		}
 	}
-	
+
 	/**
 	 * 
 	 */
@@ -637,7 +638,7 @@
 		IFile[] files = getServerResourceFiles(id);
 		if (files != null) {
 			int size = files.length;
-		
+			
 			for (int i = 0; i < size; i++) {
 				if (files[i] != null) {
 					File f = files[i].getLocation().toFile();
@@ -650,10 +651,10 @@
 		}
 		info.timestamp = getTimestamp(info);
 	}
-	
+
 	protected static int getTimestamp(CommandManagerInfo info) {
 		IServer server = info.wc.getOriginal();
-
+		
 		if (server != null)
 			return ((Server)server).getTimestamp();
 		return -1;
@@ -668,7 +669,7 @@
 			return false;
 		IFile[] files = getServerResourceFiles(id);
 		int size = files.length;
-
+		
 		int count = 0;
 		for (int i = 0; i < size; i++) {
 			count++;
@@ -685,7 +686,7 @@
 		int timestamp = getTimestamp(info);
 		if (info.timestamp != timestamp)
 			return true;
-
+		
 		if (count != info.fileMap.size())
 			return true;
 		return false;
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java
index dc32124..89f861f 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java
@@ -73,6 +73,7 @@
 	protected Text serverConfigurationName;
 	protected Text hostname;
 	protected Combo runtimeCombo;
+	protected Button browse;
 	protected Button autoPublishDefault;
 	protected Button autoPublishDisable;
 	protected Button autoPublishOverride;
@@ -403,7 +404,7 @@
 			whs.setHelp(serverConfigurationName, ContextIds.EDITOR_CONFIGURATION);
 			
 			final IFolder currentFolder = server.getServerConfiguration();
-			Button browse = toolkit.createButton(composite, Messages.serverEditorOverviewServerConfigurationBrowse, SWT.PUSH);
+			browse = toolkit.createButton(composite, Messages.serverEditorOverviewServerConfigurationBrowse, SWT.PUSH);
 			browse.addSelectionListener(new SelectionAdapter() {
 				public void widgetSelected(SelectionEvent e) {
 					ContainerSelectionDialog dialog = new ContainerSelectionDialog(serverConfigurationName.getShell(),
@@ -692,6 +693,54 @@
 				serverName.setEditable(false);
 			else
 				serverName.setEditable(true);
+			
+			hostname.setText(server.getHost());
+			if (readOnly)
+				hostname.setEditable(false);
+			else
+				hostname.setEditable(true);
+			
+			if (runtimeCombo != null) {
+				updateRuntimeCombo();
+				if (readOnly)
+					runtimeCombo.setEnabled(false);
+				else
+					runtimeCombo.setEnabled(true);
+			}
+			
+			if (serverConfigurationName != null) {
+				IFolder folder = server.getServerConfiguration();
+				if (folder == null)
+					serverConfigurationName.setText(Messages.elementUnknownName);
+				else
+					serverConfigurationName.setText("" + server.getServerConfiguration().getFullPath());
+				if (readOnly) {
+					serverConfigurationName.setEditable(false);
+					browse.setEnabled(false);
+				} else {
+					serverConfigurationName.setEditable(true);
+					browse.setEnabled(true);
+				}
+			}
+			
+			Server svr = (Server) server;
+			int publishSetting = svr.getAutoPublishSetting();
+			autoPublishDefault.setSelection(publishSetting == Server.AUTO_PUBLISH_DEFAULT);
+			autoPublishDisable.setSelection(publishSetting == Server.AUTO_PUBLISH_DISABLE);
+			autoPublishOverride.setSelection(publishSetting == Server.AUTO_PUBLISH_OVERRIDE);
+			autoPublishTime.setSelection(svr.getAutoPublishTime());
+			
+			if (readOnly) {
+				autoPublishDefault.setEnabled(false);
+				autoPublishDisable.setEnabled(false);
+				autoPublishOverride.setEnabled(false);
+				autoPublishTime.setEnabled(false);
+			} else {
+				autoPublishDefault.setEnabled(true);
+				autoPublishDisable.setEnabled(true);
+				autoPublishOverride.setEnabled(true);
+				autoPublishTime.setEnabled(true);
+			}
 		}
 		
 		updating = false;
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java
index 8060de4..c98b76c 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java
@@ -507,14 +507,14 @@
 				status.setMessage("");
 		}
 	}
-	
+
 	/**
 	 * 
 	 */
 	public void updateStatusError() {
 		if (status == null)
 			return;
-
+		
 		String error = null;
 		IEditorPart part = getActiveEditor();
 		if (part instanceof ServerEditorPart)
@@ -533,7 +533,7 @@
 		}
 		status.setErrorMessage(error);
 	}
-	
+
 	/**
 	 * 
 	 */
@@ -875,18 +875,18 @@
 	/**
 	 * 
 	 */
-	protected void promptReloadServerFile(String id, IServerWorkingCopy wc) {
+	protected void promptReloadServerFile(String id) {
 		String title = Messages.editorResourceModifiedTitle;
 		String message = Messages.editorServerModifiedMessage;
-
+		
 		if (MessageDialog.openQuestion(getEditorSite().getShell(), title, message)) {
-			try {
+			/*try {
 				//wc.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
 				//TODO: refresh local server
 			} catch (Exception e) {
 				Trace.trace(Trace.SEVERE, "Error refreshing server", e);
-			}
-			commandManager.reload(id, new NullProgressMonitor());
+			}*/
+			commandManager.reload(id);
 		}
 	}
 
@@ -927,11 +927,16 @@
 		// check for server changes
 		if (serverId != null) {
 			if (!commandManager.isDirty(serverId)) {
-				if (commandManager.hasChanged(serverId))
-					promptReloadServerFile(serverId, server);
+				if (commandManager.hasChanged(serverId)) {
+					IServer newServer = ServerCore.findServer(serverId);
+					if (newServer != null && ((Server)newServer).getTimestamp() > ((Server)server).getTimestamp())
+						commandManager.reload(serverId);
+					else
+						promptReloadServerFile(serverId);
+				}
 			} else {
 				if (commandManager.hasChanged(serverId) && !commandManager.areFilesReadOnly(serverId))
-					promptReloadServerFile(serverId, server);
+					promptReloadServerFile(serverId);
 				else if (commandManager.areFilesReadOnly(serverId) && !commandManager.isReadOnly(serverId))
 					promptReadOnlyServerFile(serverId);
 			}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java
index 8f56608..52dfe03 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java
@@ -67,7 +67,7 @@
 	protected boolean validateEdit() {
 		if (commandManager.isDirty(id))
 			return true;
-
+		
 		IFile[] files = commandManager.getReadOnlyFiles(id);
 		if (files.length == 0)
 			return true;
@@ -89,7 +89,7 @@
 		IServerAttributes serverfile = commandManager.getServerResource(id);
 		if (commandManager.hasChanged(id)) {
 			if (serverfile instanceof IServer)
-				editor.promptReloadServerFile(id, (IServerWorkingCopy) serverfile);
+				editor.promptReloadServerFile(id);
 		}
 		
 		// allow edit
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/extension/ExtensionUtility.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/extension/ExtensionUtility.java
index fcee137..1e08df1 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/extension/ExtensionUtility.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/extension/ExtensionUtility.java
@@ -63,7 +63,7 @@
 		}
 		
 		if (in == null)
-			throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, "Could not load extensions", null));
+			throw new CoreException(new Status(IStatus.ERROR, ServerUIPlugin.PLUGIN_ID, 0, "Could not load extensions", null));
 		
 		try {
 			IMemento memento = XMLMemento.loadMemento(in);
@@ -79,7 +79,7 @@
 			list.toArray(items);
 			return items;
 		} catch (Exception e) {
-			throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, e.getMessage(), e));
+			throw new CoreException(new Status(IStatus.ERROR, ServerUIPlugin.PLUGIN_ID, 0, e.getMessage(), e));
 		}
 	}