Merged HEAD
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
index f55682c..92e846f 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
@@ -14,6 +14,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InterruptedIOException;
+import org.eclipse.team.internal.core.Policy;
 
 /**
  * Wraps an input stream that blocks indefinitely to simulate timeouts on read(),
@@ -41,6 +42,8 @@
 	private int length = 0;  // number of remaining unread bytes
 	private IOException ioe = null; // if non-null, contains a pending exception
 	private boolean waitingForClose = false; // if true, thread is waiting for close()
+	
+	private boolean growWhenFull = false; // if true, buffer will grow when it is full
 
 	/**
 	 * Creates a timeout wrapper for an input stream.
@@ -65,6 +68,11 @@
 		thread.setDaemon(true);
 		thread.start();
 	}
+	
+	public TimeoutInputStream(InputStream in, int bufferSize, long readTimeout, long closeTimeout, boolean growWhenFull) {
+		this(in, bufferSize, readTimeout, closeTimeout);
+		this.growWhenFull = growWhenFull;
+	}
 
 	/**
 	 * Wraps the underlying stream's method.
@@ -247,14 +255,9 @@
 		for (;;) {
 			int off, len;
 			synchronized (this) {
-				for (;;) {
+				while (isBufferFull()) {
 					if (closeRequested) return; // quit signal
-					if (length != iobuffer.length) break;
-					try {
-						wait();
-					} catch (InterruptedException e) {
-						closeRequested = true; // alternate quit signal
-					}
+					waitForRead();
 				}
 				off = (head + length) % iobuffer.length;
 				len = ((head > off) ? head : iobuffer.length) - off;
@@ -274,4 +277,49 @@
 			}
 		}				
 	}
+	
+	/*
+	 * Wait for a read when the buffer is full (with the implication
+	 * that space will become available in the buffer after the read 
+	 * takes place).
+	 */
+	private synchronized void waitForRead() {
+		try {
+			if (growWhenFull) {
+				// wait a second before growing to let reads catch up
+				wait(readTimeout);
+			} else {
+				wait();
+			}
+		} catch (InterruptedException e) {
+			closeRequested = true; // alternate quit signal
+		}
+		// If the buffer is still full, give it a chance to grow
+		if (growWhenFull && isBufferFull()) {
+			growBuffer();
+		}
+	}
+
+	private synchronized void growBuffer() {
+		int newSize = 2 * iobuffer.length;
+		if (newSize > iobuffer.length) {
+			if (Policy.DEBUG_STREAMS) {
+				System.out.println("InputStream growing to " + newSize + " bytes"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+			byte[] newBuffer = new byte[newSize];
+			int pos = 0;
+			int len = length;
+			while (len-- > 0) {
+				newBuffer[pos++] = iobuffer[head++];
+				if (head == iobuffer.length) head = 0;
+			}
+			iobuffer = newBuffer;
+			head = 0;
+			// length instance variable was not changed by this method
+		}
+	}
+
+	private boolean isBufferFull() {
+		return length == iobuffer.length;
+	}
 }
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
index 4c9c923..28c49ae 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
@@ -10,31 +10,15 @@
  *******************************************************************************/
 package org.eclipse.team.internal.ccvs.core;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
+import java.util.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
 import org.eclipse.team.core.RepositoryProvider;
 import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ISubscriberChangeEvent;
-import org.eclipse.team.core.subscribers.ISubscriberChangeListener;
-import org.eclipse.team.core.subscribers.SubscriberChangeEvent;
+import org.eclipse.team.core.subscribers.*;
 import org.eclipse.team.core.synchronize.SyncInfo;
 import org.eclipse.team.core.synchronize.SyncInfoFilter;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.core.variants.IResourceVariantTree;
-import org.eclipse.team.core.variants.PersistantResourceVariantByteStore;
+import org.eclipse.team.core.variants.*;
 import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
 import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
 import org.eclipse.team.internal.ccvs.core.syncinfo.CVSResourceVariantTree;
@@ -58,14 +42,79 @@
  */
 public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResourceChangeListener, ISubscriberChangeListener {
 
+	private final class MergeBaseTree extends CVSResourceVariantTree {
+		// The merge synchronizer has been kept so that those upgrading
+		// from 3.0 M8 to 3.0 M9 so not lose there ongoing merge state
+		private PersistantResourceVariantByteStore mergedSynchronizer;
+		private MergeBaseTree(ResourceVariantByteStore cache, CVSTag tag, boolean cacheFileContentsHint, String syncKeyPrefix) {
+			super(cache, tag, cacheFileContentsHint);
+			mergedSynchronizer = new PersistantResourceVariantByteStore(new QualifiedName(SYNC_KEY_QUALIFIER, syncKeyPrefix + "0merged")); //$NON-NLS-1$
+		}
+		public IResource[] refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
+			// Only refresh the base of a resource once as it should not change
+			List unrefreshed = new ArrayList();
+			for (int i = 0; i < resources.length; i++) {
+				IResource resource = resources[i];
+				if (!hasResourceVariant(resource)) {
+					unrefreshed.add(resource);
+				}
+			}
+			if (unrefreshed.isEmpty()) {
+				monitor.done();
+				return new IResource[0];
+			}
+			IResource[] refreshed = super.refresh((IResource[]) unrefreshed.toArray(new IResource[unrefreshed.size()]), depth, monitor);
+			return refreshed;
+		}
+		public IResourceVariant getResourceVariant(IResource resource) throws TeamException {
+			// Use the merged bytes for the base if there are some
+			byte[] mergedBytes = mergedSynchronizer.getBytes(resource);
+			if (mergedBytes != null) {
+				byte[] parentBytes = getByteStore().getBytes(resource.getParent());
+				if (parentBytes != null) {
+					return RemoteFile.fromBytes(resource, mergedBytes, parentBytes);
+				}
+			}
+			return super.getResourceVariant(resource);
+		}
+		
+		/**
+		 * Mark the resource as merged by making it's base equal the remote
+		 */
+		public void merged(IResource resource, byte[] remoteBytes) throws TeamException {
+			if (remoteBytes == null) {
+				getByteStore().deleteBytes(resource);
+			} else {
+				getByteStore().setBytes(resource, remoteBytes);
+			}
+		}
+		
+		/**
+		 * Return true if the remote has already been merged
+		 * (i.e. the base equals the remote).
+		 */
+		public boolean isMerged(IResource resource, byte[] remoteBytes) throws TeamException {
+			byte[] mergedBytes = getByteStore().getBytes(resource);
+			return Util.equals(mergedBytes, remoteBytes);
+		}
+		
+		/* (non-Javadoc)
+		 * @see org.eclipse.team.internal.ccvs.core.syncinfo.CVSResourceVariantTree#dispose()
+		 */
+		public void dispose() {
+			mergedSynchronizer.dispose();
+			super.dispose();
+		}
+	}
+
 	public static final String ID = "org.eclipse.team.cvs.ui.cvsmerge-participant"; //$NON-NLS-1$
 	public static final String ID_MODAL = "org.eclipse.team.cvs.ui.cvsmerge-participant-modal"; //$NON-NLS-1$
 	private static final String UNIQUE_ID_PREFIX = "merge-"; //$NON-NLS-1$
 	
 	private CVSTag start, end;
 	private List roots;
-	private PersistantResourceVariantByteStore mergedSynchronizer;
-	private CVSResourceVariantTree baseTree, remoteTree;
+	private CVSResourceVariantTree remoteTree;
+	private MergeBaseTree baseTree;
 	
 	public CVSMergeSubscriber(IResource[] roots, CVSTag start, CVSTag end) {		
 		this(getUniqueId(), roots, start, end);
@@ -105,41 +154,7 @@
 			}
 		};
 		PersistantResourceVariantByteStore baseSynchronizer = new PersistantResourceVariantByteStore(new QualifiedName(SYNC_KEY_QUALIFIER, syncKeyPrefix + start.getName()));
-		baseTree = new CVSResourceVariantTree(baseSynchronizer, getStartTag(), getCacheFileContentsHint()) {
-			public IResource[] refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
-				// Only refresh the base of a resource once as it should not change
-				List unrefreshed = new ArrayList();
-				for (int i = 0; i < resources.length; i++) {
-					IResource resource = resources[i];
-					if (!getBaseByteStore().isVariantKnown(resource)) {
-						unrefreshed.add(resource);
-					}
-				}
-				if (unrefreshed.isEmpty()) {
-					monitor.done();
-					return new IResource[0];
-				}
-				IResource[] refreshed = super.refresh((IResource[]) unrefreshed.toArray(new IResource[unrefreshed.size()]), depth, monitor);
-				return refreshed;
-			}
-			public IResourceVariant getResourceVariant(IResource resource) throws TeamException {
-				// Use the merged bytes for the base if there are some
-				byte[] mergedBytes = mergedSynchronizer.getBytes(resource);
-				if (mergedBytes != null) {
-					byte[] parentBytes = getBaseByteStore().getBytes(resource.getParent());
-					if (parentBytes != null) {
-						return RemoteFile.fromBytes(resource, mergedBytes, parentBytes);
-					}
-				} else {
-					// A deletion was merged so return null for the base
-					if (mergedSynchronizer.isVariantKnown(resource)) {
-						return null;
-					}
-				}
-				return super.getResourceVariant(resource);
-			}
-		};
-		mergedSynchronizer = new PersistantResourceVariantByteStore(new QualifiedName(SYNC_KEY_QUALIFIER, syncKeyPrefix + "0merged")); //$NON-NLS-1$
+		baseTree = new MergeBaseTree(baseSynchronizer, getStartTag(), getCacheFileContentsHint(), syncKeyPrefix);
 		
 		ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
 		CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().addListener(this);
@@ -161,11 +176,7 @@
 	
 	private void internalMerged(IResource resource) throws TeamException {
 		byte[] remoteBytes = getRemoteByteStore().getBytes(resource);
-		if (remoteBytes == null) {
-			mergedSynchronizer.deleteBytes(resource);
-		} else {
-			mergedSynchronizer.setBytes(resource, remoteBytes);
-		}
+		baseTree.merged(resource, remoteBytes);
 	}
 
 	/* (non-Javadoc)
@@ -174,8 +185,7 @@
 	public void cancel() {	
 		ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);		
 		remoteTree.dispose();
-		baseTree.dispose();
-		mergedSynchronizer.dispose();		
+		baseTree.dispose();	
 	}
 
 	/* (non-Javadoc)
@@ -248,19 +258,13 @@
 	/**
 	 * Return whether the given resource has been merged with its 
 	 * corresponding remote.
-	 * @param resource tghe loca resource
+	 * @param resource the local resource
 	 * @return boolean
 	 * @throws TeamException
 	 */
 	public boolean isMerged(IResource resource) throws TeamException {
-		byte[] mergedBytes = mergedSynchronizer.getBytes(resource);
 		byte[] remoteBytes = getRemoteByteStore().getBytes(resource);
-		if (mergedBytes == null) {
-			return (remoteBytes == null 
-					&& mergedSynchronizer.isVariantKnown(resource)
-					&& getRemoteByteStore().isVariantKnown(resource));
-		}
-		return Util.equals(mergedBytes, remoteBytes);
+		return baseTree.isMerged(resource, remoteBytes);
 	}
 
 	/* 
@@ -329,19 +333,10 @@
 		monitor.done();
 	}
 	
-	/*
-	 * TODO: Should not need to access this here
-	 */
+	
 	private PersistantResourceVariantByteStore getRemoteByteStore() {
 		return (PersistantResourceVariantByteStore)((CVSResourceVariantTree)getRemoteTree()).getByteStore();
 	}
-
-	/*
-	 * TODO: Should not need to access this here
-	 */
-	private PersistantResourceVariantByteStore getBaseByteStore() {
-		return (PersistantResourceVariantByteStore)((CVSResourceVariantTree)getBaseTree()).getByteStore();
-	}
 	
 	/* (non-Javadoc)
 	 * @see java.lang.Object#equals(java.lang.Object)
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
index 11026cf..c22daab 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
@@ -16,6 +16,7 @@
 import java.net.URL;
 import java.util.*;
 
+import org.eclipse.core.internal.preferences.EclipsePreferences;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.*;
 import org.eclipse.core.runtime.Status;
@@ -123,6 +124,21 @@
 	}
 	
 	/**
+	 * Return a preferences node that contains suitabel defaults for a
+	 * repository location.
+	 * @return  a preferences node
+	 */
+	public static Preferences getDefaultPreferences() {
+		Preferences defaults = new EclipsePreferences();
+		defaults.put(PREF_SERVER_ENCODING, getDefaultEncoding());
+		return defaults;
+	}
+	
+	private static String getDefaultEncoding() {
+		return System.getProperty("file.encoding", "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	/**
 	 * Validate whether the given string is a valid registered connection method
 	 * name.
 	 * @param methodName the method name
@@ -480,7 +496,9 @@
 		// The password can only be fixed if the username is and a password is provided
 		if (userFixed && passwordFixed && (password != null))
 			this.passwordFixed = true;
-		setEncoding(encoding);
+		if (encoding != null) {
+			setEncoding(encoding);
+		}
 	}
 	
 	/*
@@ -503,7 +521,7 @@
 		flushCache();
 		try {
 			if (hasPreferences()) {
-				getPreferences().removeNode();
+				internalGetPreferences().removeNode();
 				getParentPreferences().flush();
 			}
 		} catch (BackingStoreException e) {
@@ -580,7 +598,7 @@
 	 */
 	public String getEncoding() {
 		if (hasPreferences()) {
-			return getPreferences().get(PREF_SERVER_ENCODING, getDefaultEncoding());
+			return internalGetPreferences().get(PREF_SERVER_ENCODING, getDefaultEncoding());
 		} else {
 			return getDefaultEncoding();
 		}
@@ -592,11 +610,11 @@
 	public void setEncoding(String encoding) {
 		if (encoding == null || encoding == getDefaultEncoding()) {
 			if (hasPreferences()) {
-				getPreferences().remove(PREF_SERVER_ENCODING);
+				internalGetPreferences().remove(PREF_SERVER_ENCODING);
 			}
 		} else {
 			ensurePreferencesStored();
-			getPreferences().put(PREF_SERVER_ENCODING, encoding);
+			internalGetPreferences().put(PREF_SERVER_ENCODING, encoding);
 			flushPreferences();
 		}
 	}	
@@ -1054,7 +1072,7 @@
 	 */
 	public String getReadLocation() {
 		if (hasPreferences()) {
-			return getPreferences().get(PREF_READ_LOCATION, null);
+			return internalGetPreferences().get(PREF_READ_LOCATION, null);
 		} else {
 			return null;
 		}
@@ -1070,11 +1088,11 @@
 	public void setReadLocation(String readLocation) {
 		if (readLocation == null || readLocation.equals(getLocation())) {
 			if (hasPreferences()) {
-				getPreferences().remove(PREF_READ_LOCATION);
+				internalGetPreferences().remove(PREF_READ_LOCATION);
 			}
 		} else {
 			ensurePreferencesStored();
-			getPreferences().put(PREF_READ_LOCATION, readLocation);
+			internalGetPreferences().put(PREF_READ_LOCATION, readLocation);
 			flushPreferences();
 		}
 	}
@@ -1087,7 +1105,7 @@
 	 */
 	public String getWriteLocation() {
 		if (hasPreferences()) {
-			return getPreferences().get(PREF_WRITE_LOCATION, null);
+			return internalGetPreferences().get(PREF_WRITE_LOCATION, null);
 		} else {
 			return null;
 		}
@@ -1103,11 +1121,11 @@
 	public void setWriteLocation(String writeLocation) {
 		if (writeLocation == null || writeLocation.equals(getLocation())) {
 			if (hasPreferences()) {
-				getPreferences().remove(PREF_WRITE_LOCATION);
+				internalGetPreferences().remove(PREF_WRITE_LOCATION);
 			}
 		} else {
 			ensurePreferencesStored();
-			getPreferences().put(PREF_WRITE_LOCATION, writeLocation);
+			internalGetPreferences().put(PREF_WRITE_LOCATION, writeLocation);
 			flushPreferences();
 		}
 	}
@@ -1129,7 +1147,14 @@
 	/*
 	 * Return the preferences node for this repository
 	 */
-	private Preferences getPreferences() {
+	public Preferences getPreferences() {
+		if (!hasPreferences()) {
+			ensurePreferencesStored();
+		}
+		return internalGetPreferences();
+	}
+	
+	private Preferences internalGetPreferences() {
 		return getParentPreferences().node(getPreferenceName());
 	}
 	
@@ -1153,7 +1178,7 @@
 	}
 
 	public void storePreferences() {
-		Preferences prefs = getPreferences();
+		Preferences prefs = internalGetPreferences();
 		// Must store at least one preference in the node
 		prefs.put(PREF_LOCATION, getLocation());
 		flushPreferences();
@@ -1161,7 +1186,7 @@
 	
 	private void flushPreferences() {
 		try {
-			getPreferences().flush();
+			internalGetPreferences().flush();
 		} catch (BackingStoreException e) {
 			CVSProviderPlugin.log(IStatus.ERROR, Policy.bind("CVSRepositoryLocation.75", getLocation(true)), e); //$NON-NLS-1$
 		}
@@ -1172,8 +1197,4 @@
 			storePreferences();
 		}
 	}
-	
-	private String getDefaultEncoding() {
-		return System.getProperty("file.encoding"); //$NON-NLS-1$
-	}
 }
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties
index eb95820..3d44aa3 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.properties
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.properties
@@ -12,6 +12,7 @@
 pluginName=CVS Team Provider UI
 
 CVS=CVS
+ServerEncoding=Server Encoding
 
 CVSRepositoryExploring=CVS Repository Exploring
 
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 340884b..ed9946f 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -126,6 +126,13 @@
             class="org.eclipse.team.internal.ccvs.ui.repo.CVSRepositoryPropertiesPage"
             id="org.eclipse.team.ccvs.ui.propertyPages.CVSRepositoryPropertiesPage">
       </page>
+      
+      <page
+            objectClass="org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot"
+            name="%ServerEncoding"
+            class="org.eclipse.team.internal.ccvs.ui.repo.RepositoryEncodingPropertyPage"
+            id="org.eclipse.team.ccvs.ui.propertyPages.RepositoryEncodingPage">
+      </page>
    </extension>
 <!-- ******************* Action Definitions ******************** -->
    <extension
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
index 0ff2d81..790b836 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
@@ -17,6 +17,7 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.*;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.ProgressMonitorDialog;
@@ -29,6 +30,8 @@
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -55,6 +58,7 @@
 import org.eclipse.ui.help.WorkbenchHelp;
 import org.eclipse.ui.model.WorkbenchContentProvider;
 import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.team.internal.ccvs.ui.Policy;
 
 public class CVSProjectPropertiesPage extends CVSPropertiesPage {
 	IProject project;
@@ -80,14 +84,36 @@
 	private boolean fetch;
 	private boolean watchEdit;
 
+	public static boolean isCompatible(ICVSRepositoryLocation location, ICVSRepositoryLocation oldLocation) {
+		if (!location.getHost().equals(oldLocation.getHost())) return false;
+		if (!location.getRootDirectory().equals(oldLocation.getRootDirectory())) return false;
+		if (location.equals(oldLocation)) return false;
+		return true;
+	}
+	
 	private class RepositorySelectionDialog extends Dialog {
-		ICVSRepositoryLocation[] locations;
-		ICVSRepositoryLocation location;
+		ICVSRepositoryLocation[] allLocations;
+		ICVSRepositoryLocation[] compatibleLocatons;
+		ICVSRepositoryLocation selectedLocation;
 		
 		TableViewer viewer;
 		Button okButton;
-		public RepositorySelectionDialog(Shell shell) {
+		boolean showCompatible = true;
+		
+		public RepositorySelectionDialog(Shell shell, ICVSRepositoryLocation oldLocation) {
 			super(shell);
+			initialize(oldLocation);
+		}
+		private void initialize(ICVSRepositoryLocation oldLocation) {
+			allLocations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
+			List locations = new ArrayList();
+			for (int i = 0; i < allLocations.length; i++) {
+				ICVSRepositoryLocation location = allLocations[i];
+				if (isCompatible(location, oldLocation)) {
+					locations.add(location);
+				}
+			}
+			compatibleLocatons = (ICVSRepositoryLocation[]) locations.toArray(new ICVSRepositoryLocation[locations.size()]);
 		}
 		protected void createButtonsForButtonBar(Composite parent) {
 			// create OK and Cancel buttons by default
@@ -111,17 +137,21 @@
 			viewer.setLabelProvider(new WorkbenchLabelProvider());
 			viewer.setContentProvider(new WorkbenchContentProvider() {
 				public Object[] getElements(Object inputElement) {
-					return locations;
+					if (showCompatible) {
+						return compatibleLocatons;
+					} else {
+						return allLocations;
+					}
 				}
 			});
 			viewer.addSelectionChangedListener(new ISelectionChangedListener() {
 				public void selectionChanged(SelectionChangedEvent event) {
 					IStructuredSelection selection = (IStructuredSelection)event.getSelection();
 					if (selection.isEmpty()) {
-						location = null;
+						selectedLocation = null;
 						okButton.setEnabled(false);
 					} else {
-						location = (ICVSRepositoryLocation)selection.getFirstElement();
+						selectedLocation = (ICVSRepositoryLocation)selection.getFirstElement();
 						okButton.setEnabled(true);
 					}
 				}
@@ -131,20 +161,26 @@
 					okPressed();
 				}
 			});
-			viewer.setInput(locations);
+			viewer.setInput(compatibleLocatons);
+			
+			final Button compatibleButton = createCheckBox(composite, Policy.bind("CVSProjectPropertiesPage.31")); //$NON-NLS-1$
+			compatibleButton.setSelection(showCompatible);
+			compatibleButton.addSelectionListener(new SelectionAdapter() {
+				public void widgetSelected(SelectionEvent e) {
+					showCompatible = compatibleButton.getSelection();
+					viewer.refresh();
+				}
+			});
 			return composite;
 		}
 		protected void cancelPressed() {
-			location = null;
+			selectedLocation = null;
 			super.cancelPressed();
 		}
-		public void setLocations(ICVSRepositoryLocation[] locations) {
-			this.locations = locations;
-		}
 		public ICVSRepositoryLocation getLocation() {
-			return location;
+			return selectedLocation;
 		}
-	};
+	}
 	
 	/*
 	 * @see PreferencesPage#createContents
@@ -219,19 +255,7 @@
 		changeButton.setLayoutData(data);
 		changeButton.addListener(SWT.Selection, new Listener() {
 			public void handleEvent(Event e) {
-				// Find out which repo locations are appropriate
-				ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
-				List compatibleLocations = new ArrayList();
-				for (int i = 0; i < locations.length; i++) {
-					ICVSRepositoryLocation location = locations[i];
-					// Only locations with the same host and root are eligible
-					if (!location.getHost().equals(hostLabel.getText())) continue;
-					if (!location.getRootDirectory().equals(pathLabel.getText())) continue;
-					if (location.equals(oldLocation)) continue;
-					compatibleLocations.add(location);
-				}
-				RepositorySelectionDialog dialog = new RepositorySelectionDialog(getShell());
-				dialog.setLocations((ICVSRepositoryLocation[])compatibleLocations.toArray(new ICVSRepositoryLocation[compatibleLocations.size()]));
+				RepositorySelectionDialog dialog = new RepositorySelectionDialog(getShell(), oldLocation);
 				dialog.open();
 				ICVSRepositoryLocation location = dialog.getLocation();
 				if (location == null) return;
@@ -373,7 +397,12 @@
 			return true;
 		}
 		try {
-			new ProgressMonitorDialog(getShell()).run(true, false, new IRunnableWithProgress() {
+			if (newLocation != null && !isCompatible(newLocation, oldLocation)) {
+				if (!MessageDialog.openQuestion(getShell(), Policy.bind("CVSProjectPropertiesPage.32"), Policy.bind("CVSProjectPropertiesPage.33"))) { //$NON-NLS-1$ //$NON-NLS-2$
+					return false;
+				}
+			}
+			new ProgressMonitorDialog(getShell()).run(true, true, new IRunnableWithProgress() {
 				public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
 					try {
 						monitor.beginTask(Policy.bind("CVSProjectPropertiesPage.progressTaskName"),  //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
index 6bf107d..a7c7b9d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
@@ -14,11 +14,10 @@
 
 import org.eclipse.core.resources.IResource;
 import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.team.internal.ccvs.core.CVSException;
 import org.eclipse.team.internal.ccvs.core.ICVSResource;
 import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.Policy;
 import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
 
 /**
@@ -32,9 +31,7 @@
 		
 		WorkspaceSynchronizeParticipant participant = CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeParticipant();
 		if(participant != null) {
-			IWizard wizard = participant.createSynchronizeWizard();
-			WizardDialog dialog = new WizardDialog(getShell(), wizard);
-			dialog.open();
+				participant.refresh(resources, participant.getRefreshListeners().createSynchronizeViewListener(participant), Policy.bind("Participant.synchronizing"), getTargetPart().getSite()); //$NON-NLS-1$
 		}
 	}
 	
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java
index 052cac2..860eb5e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java
@@ -22,6 +22,7 @@
 import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
 import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
 import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.Policy;
 import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
 import org.eclipse.ui.IWorkbenchPart;
 
@@ -176,4 +177,11 @@
 		}
 		return (IResource[]) shared.toArray(new IResource[shared.size()]);
 	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#isServerModificationOperation()
+	 */
+	protected boolean isServerModificationOperation() {
+		return true;
+	}
 }
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index 5483234..b87461e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -417,3 +417,4 @@
 GlobalRefreshSchedulePage.1=Synchronize Schedule
 GlobalRefreshSchedulePage.2=Set the interval at which the resources associated with {0} will be synchronized in the background.
 SynchronizeManager.18=Could not cast {0} as ISynchronizeView
+GlobalSynchronizeWizard.11=Synchronize
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
index 41ed487..7298703 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
@@ -8,6 +8,8 @@
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.team.core.synchronize.SyncInfo;
 import org.eclipse.team.internal.ui.*;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
 import org.eclipse.team.ui.synchronize.SyncInfoCompareInput;
 import org.eclipse.team.ui.synchronize.subscribers.*;
 import org.eclipse.ui.PlatformUI;
@@ -31,6 +33,14 @@
 	 * @see org.eclipse.team.internal.ui.jobs.IRefreshSubscriberListener#refreshStarted(org.eclipse.team.internal.ui.jobs.IRefreshEvent)
 	 */
 	public void refreshStarted(IRefreshEvent event) {
+		TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+			public void run() {			
+				ISynchronizeView view = TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage();
+				if(view != null) {
+					view.display(participant);
+				}
+			}
+		});
 	}
 
 	/*
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java
index b6e587d..110d4da 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantPage.java
@@ -108,13 +108,12 @@
 			refreshAllAction = new Action() {
 				public void run() {
 					// Prime the refresh wizard with an appropriate initial selection
-					SubscriberRefreshWizard wizard = new SubscriberRefreshWizard(participant);
-					int scopeHint = SubscriberRefreshWizard.SCOPE_PARTICIPANT_ROOTS;
+					final SubscriberRefreshWizard wizard = new SubscriberRefreshWizard(participant);
 					IWorkingSet set = participant.getWorkingSet();
 					if(set != null) {
-						scopeHint = SubscriberRefreshWizard.SCOPE_WORKING_SET;
-					}
-					wizard.setScopeHint(scopeHint);
+						int scopeHint = SubscriberRefreshWizard.SCOPE_WORKING_SET;
+						wizard.setScopeHint(scopeHint);
+					}					
 					WizardDialog dialog = new WizardDialog(getShell(), wizard);
 					dialog.open();
 				}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
index 84e442a..efb00ce 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
@@ -10,13 +10,20 @@
  *******************************************************************************/
 package org.eclipse.team.internal.ui.synchronize.actions;
 
-import org.eclipse.jface.action.*;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuCreator;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.wizard.IWizard;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.*;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.team.internal.ui.IPreferenceIds;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
 import org.eclipse.team.internal.ui.wizards.GlobalSynchronizeWizard;
 import org.eclipse.team.ui.TeamUI;
 import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
@@ -40,14 +47,6 @@
 	private Action synchronizeAction;
 	private IWorkbenchWindow window;
 
-	static class SynchronizeWizardDialog extends WizardDialog {
-		SynchronizeWizardDialog(Shell parent, IWizard wizard) {
-			super(parent, wizard);
-			setShellStyle(getShellStyle());
-			//setMinimumPageSize(500, 300);
-		}
-	}
-	
 	class RefreshParticipantAction extends Action {
 		private ISynchronizeParticipant participant;
 
@@ -157,9 +156,11 @@
 				wizard = participants[0].createSynchronizeWizard();
 			}
 		}
-		WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
-		dialog.open();
-		updateTooltipMessage();
+		if(wizard != null) {
+			WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
+			dialog.open();
+			updateTooltipMessage();
+		}
 	}
 
 	/*
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
index 63ba14e..dd4569a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
@@ -10,7 +10,9 @@
  *******************************************************************************/
 package org.eclipse.team.internal.ui.synchronize.actions;
 
+import java.util.*;
 import java.util.Iterator;
+import java.util.List;
 
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IAdaptable;
@@ -32,12 +34,12 @@
  */
 public class RefactorActionGroup extends ActionGroup {
 
-	private DeleteResourceAction deleteAction;
 	private MoveResourceAction moveAction;
 	private RenameResourceAction renameAction;
 	private TextActionHandler textActionHandler;
 	private ISynchronizeView view;
-
+	private DeleteResourceAction deleteAction;
+	
 	public RefactorActionGroup(ISynchronizeView view) {
 		this.view = view;
 		makeActions();
@@ -74,6 +76,7 @@
 		textActionHandler = new TextActionHandler(actionBars); // hooks handlers
 		textActionHandler.setDeleteAction(deleteAction);
 		renameAction.setTextActionHandler(textActionHandler);		
+		deleteAction.selectionChanged(getSelection());
 	}
 
 	protected void makeActions() {
@@ -87,14 +90,12 @@
 		moveAction = new MoveResourceAction(shell);
 		renameAction = new RenameResourceAction(shell);
 		
-		deleteAction = new DeleteResourceAction(shell);
-		deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
-		deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));		
-		deleteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_HOVER));
-		/* NOTE: This is defined in "plugin.xml" in "org.eclipse.ui".  It is
-		 * only publicly declared in code in IWorkbenchActionDefinitionIds in
-		 * "org.eclipse.ui.workbench.texteditor".
-		 */
+		deleteAction = new DeleteResourceAction(shell) {
+			protected List getSelectedResources() {
+				return Arrays.asList(Utils.getResources(getSelection().toArray()));
+			}
+		};
+		deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));			
 		deleteAction.setActionDefinitionId("org.eclipse.ui.edit.delete");  //$NON-NLS-1$
 		keyBindingService.registerAction(deleteAction);
 	}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
index 781b3f5..0fe4651 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
@@ -13,10 +13,15 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.eclipse.jface.wizard.*;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.team.internal.ui.IPreferenceIds;
+import org.eclipse.team.internal.ui.Policy;
 import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.*;
+import org.eclipse.team.ui.ISharedImages;
+import org.eclipse.team.ui.TeamImages;
+import org.eclipse.team.ui.TeamUI;
 import org.eclipse.team.ui.synchronize.ISynchronizeManager;
 import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
 import org.eclipse.ui.IWorkbench;
@@ -35,13 +40,17 @@
 	private String pluginId = TeamUIPlugin.PLUGIN_ID;
 
 	public GlobalSynchronizeWizard() {
-		setNeedsProgressMonitor(true);
-		setWindowTitle("Synchronize"); //$NON-NLS-1$
+		setWindowTitle(Policy.bind("GlobalSynchronizeWizard.11")); //$NON-NLS-1$
 		setDefaultPageImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_WIZBAN_SHARE));
 		setForcePreviousAndNextButtons(true);
 		setNeedsProgressMonitor(false);
 	}
 
+	public GlobalSynchronizeWizard(ISynchronizeParticipant participant) {
+		this();
+		this.participant = participant;
+	}
+	
 	/*
 	 * @see Wizard#addPages
 	 */
@@ -52,25 +61,28 @@
 			// Only skip the first page if the one wizard has at least one
 			// page.
 			participant = participants[0];
-			IWizard wizard = participants[0].createSynchronizeWizard();
-			wizard.addPages();
-			if (wizard.getPageCount() > 0) {
-				wizard.setContainer(getContainer());
-				IWizardPage[] pages = wizard.getPages();
-				for (int i = 0; i < pages.length; i++) {
-					addPage(pages[i]);
-				}
-				return;
-			}
 		}
-		mainPage = new GlobalRefreshParticipantSelectionPage();
-		addPage(mainPage);
+		if (participant != null) {
+			wizard = participants[0].createSynchronizeWizard();
+			addWizardPages(participant.createSynchronizeWizard());
+		} else {
+			mainPage = new GlobalRefreshParticipantSelectionPage();
+			addPage(mainPage);
+		}
 	}
 
-	public IWizardPage getNextPage(IWizardPage page) {
-		if (wizard != null) {
-			return wizard.getNextPage(page);
+	private void addWizardPages(IWizard wizard) {
+		wizard.addPages();
+		if (wizard.getPageCount() > 0) {
+			wizard.setContainer(getContainer());
+			IWizardPage[] pages = wizard.getPages();
+			for (int i = 0; i < pages.length; i++) {
+				addPage(pages[i]);
+			}
 		}
+	}
+	
+	public IWizardPage getNextPage(IWizardPage page) {
 		return super.getNextPage(page);
 	}
 	
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/GlobalRefreshResourceSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/GlobalRefreshResourceSelectionPage.java
index bd7bce5..e5c3ed1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/GlobalRefreshResourceSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/GlobalRefreshResourceSelectionPage.java
@@ -10,13 +10,21 @@
  *******************************************************************************/
 package org.eclipse.team.ui.synchronize.subscribers;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -24,11 +32,20 @@
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.TreeItem;
 import org.eclipse.team.internal.ui.Policy;
 import org.eclipse.team.internal.ui.Utils;
 import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.ui.*;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.IWorkingSetManager;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
 import org.eclipse.ui.ide.IDE;
 import org.eclipse.ui.internal.dialogs.ContainerCheckedTreeViewer;
@@ -127,7 +144,10 @@
 	public void createControl(Composite parent2) {
 		Composite top = new Composite(parent2, SWT.NULL);
 		top.setLayout(new GridLayout());
-		top.setLayoutData(new GridData(GridData.FILL_BOTH));
+		
+		GridData data = new GridData(GridData.FILL_BOTH);
+		data.widthHint = 50;
+		top.setLayoutData(data);
 		setControl(top);
 		
 		if (participant.getSubscriber().roots().length == 0) {
@@ -140,9 +160,9 @@
 			
 			// The viewer
 			fViewer = new ContainerCheckedTreeViewer(top, SWT.BORDER);
-			GridData data = new GridData(GridData.FILL_BOTH);
-			data.widthHint = 250;
-			data.heightHint = 200;
+			data = new GridData(GridData.FILL_HORIZONTAL);
+			//data.widthHint = 200;
+			data.heightHint = 100;
 			fViewer.getControl().setLayoutData(data);
 			fViewer.setContentProvider(new MyContentProvider());
 			fViewer.setLabelProvider( new DecoratingLabelProvider(
@@ -164,6 +184,7 @@
 			layout.makeColumnsEqualWidth = false;
 			scopeGroup.setLayout(layout);
 			data = new GridData(GridData.FILL_HORIZONTAL);
+			data.widthHint = 50;
 			scopeGroup.setLayoutData(data);
 			
 			participantScope = new Button(scopeGroup, SWT.RADIO); 
@@ -225,8 +246,6 @@
 			updateWorkingSetLabel();
 			initializeScopingHint();
 		}
-		
-		//updateOKStatus();
 		Dialog.applyDialogFont(top);
 	}
 	
@@ -295,7 +314,13 @@
 					updateSelectedResourcesScope();
 				}
 		}
-		fViewer.reveal(areAnyElementsChecked());
+	}
+	
+	private void intializeSelectionInViewer(IResource[] resources) {
+		if(resources.length > 0) {
+//			fViewer.setExpandedElements(resources);
+			fViewer.setSelection(new StructuredSelection(Arrays.asList(resources)), true);
+		}
 	}
 	
 	private void updateEnclosingProjectScope() {
@@ -322,6 +347,7 @@
 			IResource[] resources = getResourcesFromSelection();
 			fViewer.setCheckedElements(resources);
 			setPageComplete(resources.length > 0);
+			intializeSelectionInViewer(resources);
 		}
 	}
 	
@@ -349,7 +375,9 @@
 		if(workingSet != null) {
 				List resources = IDE.computeSelectedResources(new StructuredSelection(workingSet.getElements()));
 				if(! resources.isEmpty()) {
-					fViewer.setCheckedElements((IResource[])resources.toArray(new IResource[resources.size()]));
+					IResource[] resources2 = (IResource[])resources.toArray(new IResource[resources.size()]);
+					fViewer.setCheckedElements(resources2);
+					intializeSelectionInViewer(resources2);
 					setPageComplete(true);
 				}
 		} else {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberParticipant.java
index cf00abc..9481abd 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberParticipant.java
@@ -174,9 +174,27 @@
 	 * 
 	 * @param resources the resources to be refreshed.
 	 */
-	public void refresh(IResource[] resources, IRefreshSubscriberListener listener, String taskName, IWorkbenchSite site) {
-		ISynchronizeView view = TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage();
-		refreshHelper(view.getSite(), taskName, resources, getSubscriberSyncInfoCollector(), listener);
+	public void refresh(IResource[] resources, final IRefreshSubscriberListener listener, String taskName, IWorkbenchSite site) {
+		RefreshSubscriberJob job = new RefreshSubscriberJob(taskName, resources, collector.getSubscriber());
+		job.setSubscriberCollector(collector);
+		IRefreshSubscriberListener autoListener = new IRefreshSubscriberListener() {
+			public void refreshStarted(IRefreshEvent event) {
+				if(listener != null) {
+					listener.refreshStarted(event);
+				}
+			}
+			public void refreshDone(IRefreshEvent event) {
+				if(listener != null) {
+					listener.refreshDone(event);
+					RefreshSubscriberJob.removeRefreshListener(this);
+				}
+			}
+		};
+		
+		if (listener != null) {
+			RefreshSubscriberJob.addRefreshListener(autoListener);
+		}	
+		Utils.schedule(job, site);
 	}
 	
 	public IRefreshSubscriberListenerFactory getRefreshListeners() {
@@ -351,27 +369,4 @@
 		}
 		return null;
 	}
-	
-	private void refreshHelper(IWorkbenchSite site, String taskName, IResource[] resources, final SubscriberSyncInfoCollector collector, final IRefreshSubscriberListener listener) {
-		RefreshSubscriberJob job = new RefreshSubscriberJob(taskName, resources, collector.getSubscriber());
-		job.setSubscriberCollector(collector);
-		IRefreshSubscriberListener autoListener = new IRefreshSubscriberListener() {
-			public void refreshStarted(IRefreshEvent event) {
-				if(listener != null) {
-					listener.refreshStarted(event);
-				}
-			}
-			public void refreshDone(IRefreshEvent event) {
-				if(listener != null) {
-					listener.refreshDone(event);
-					RefreshSubscriberJob.removeRefreshListener(this);
-				}
-			}
-		};
-		
-		if (listener != null) {
-			RefreshSubscriberJob.addRefreshListener(autoListener);
-		}	
-		Utils.schedule(job, site);
-	}
 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshWizard.java
index 86df13e..7d85ba8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscribers/SubscriberRefreshWizard.java
@@ -49,8 +49,8 @@
 	 */
 	public void addPages() {
 		selectionPage = new GlobalRefreshResourceSelectionPage(participant, scopeHint);
-		schedulePage = new GlobalRefreshSchedulePage(participant);
 		addPage(selectionPage);
+		schedulePage = new GlobalRefreshSchedulePage(participant);
 		addPage(schedulePage);
 	}