Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-07-24 11:04:10 -0400
committerJean Michel-Lemieux2003-07-24 11:04:10 -0400
commita7c21049d5e7c8dd8ca50519d05c99c5f7398358 (patch)
tree113b7de1db6de5e49f9d107d5408b92efdd6f8d7
parente8925a5203c7e6c91980b627d657aea8cace13e3 (diff)
downloadeclipse.platform.team-a7c21049d5e7c8dd8ca50519d05c99c5f7398358.tar.gz
eclipse.platform.team-a7c21049d5e7c8dd8ca50519d05c99c5f7398358.tar.xz
eclipse.platform.team-a7c21049d5e7c8dd8ca50519d05c99c5f7398358.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSet.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java31
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java32
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java7
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java23
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/sync/SyncInfoFromSyncSet.java2
14 files changed, 170 insertions, 43 deletions
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 86aaf445a..78074e0b6 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
@@ -29,6 +29,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.ITeamResourceChangeListener;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.subscribers.TeamDelta;
import org.eclipse.team.core.subscribers.TeamProvider;
@@ -53,7 +54,7 @@ import org.eclipse.team.internal.core.SaveContext;
* TODO: Do certain operations (e.g. replace with) invalidate a merge subscriber?
* TODO: How to ensure that sync info is flushed when merge roots are deleted?
*/
-public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResourceChangeListener {
+public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResourceChangeListener, ITeamResourceChangeListener {
public static final String UNIQUE_ID_PREFIX = "merge-";
@@ -116,6 +117,7 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
// }
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+ CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().addListener(this);
}
protected SyncInfo getSyncInfo(IResource local, IRemoteResource base, IRemoteResource remote, IProgressMonitor monitor) throws TeamException {
@@ -300,5 +302,25 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
public boolean isMerged(IResource resource) throws CVSException {
return mergedSynchronizer.getSyncBytes(resource) != null;
+ }
+
+ /*
+ * Currently only the workspace subscriber knows when a project has been deconfigured. We will listen for these events
+ * and remove the root then forward to merge subscriber listeners.
+ * (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.ITeamResourceChangeListener#teamResourceChanged(org.eclipse.team.core.subscribers.TeamDelta[])
+ */
+ public void teamResourceChanged(TeamDelta[] deltas) {
+ for (int i = 0; i < deltas.length; i++) {
+ TeamDelta delta = deltas[i];
+ switch(delta.getFlags()) {
+ case TeamDelta.PROVIDER_DECONFIGURED:
+ IResource resource = delta.getResource();
+ if(roots.remove(resource)) {
+ fireTeamResourceChange(new TeamDelta[] {delta});
+ }
+ break;
+ }
+ }
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
index 385b3d24a..ce6b359af 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
@@ -205,16 +205,7 @@ public class SyncViewerActions extends SyncViewerActionGroup {
public void refreshFilters() {
final SubscriberInput input = getSubscriberContext();
if(input != null) {
- try {
- input.setFilter(new AndSyncInfoFilter(
- new SyncInfoFilter[] {
- new SyncInfoDirectionFilter(directionsFilters.getDirectionFilter()),
- new SyncInfoChangeTypeFilter(changeFilters.getChangeFilters()),
- new PseudoConflictFilter()
- }), new NullProgressMonitor() /* TODO: should be a job ? */);
- } catch (TeamException e) {
- // TODO: bad stuff here
- }
+ getSyncView().updateInputFilter(directionsFilters.getDirectionFilter(), changeFilters.getChangeFilters());
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java
index f239aabf6..20d63b96a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java
@@ -83,7 +83,7 @@ public class SyncViewerComparisonCriteria extends SyncViewerActionGroup {
// the new input.
SubscriberInput input = getSubscriberContext();
input.getSubscriber().setCurrentComparisonCriteria(activatedAction.getComparisonCriteria().getId());
- //input.prepareInput(monitor);
+ input.reset();
} catch (TeamException e) {
throw new InvocationTargetException(e);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java
index 010957768..fa1561caa 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java
@@ -17,6 +17,7 @@ import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.team.core.TeamException;
@@ -124,17 +125,21 @@ public class SubscriberInput implements IPropertyChangeListener, ITeamResourceCh
*/
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(TeamUI.GLOBAL_IGNORES_CHANGED)) {
- //try {
- // the reset will simply clear the set since a subscriber sync set doesn't
- // implement fetchInput().
- //subscriberSyncSet.reset(new NullProgressMonitor());
- //eventHandler.initialize();
- //} catch (TeamException e) {
- // TeamUIPlugin.log(e);
- //}
+ try {
+ reset();
+ } catch (TeamException e) {
+ TeamUIPlugin.log(e);
+ }
}
}
+ public void reset() throws TeamException {
+ subscriberSyncSet.reset(new NullProgressMonitor());
+ workingRootsSet.reset(new NullProgressMonitor());
+ filteredSyncSet.reset(new NullProgressMonitor());
+ eventHandler.initialize();
+ }
+
/**
* Process the resource delta
*
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSet.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSet.java
index 01d186a2a..12743d485 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSet.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSet.java
@@ -10,9 +10,11 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.sync.sets;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -20,8 +22,10 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
/**
* This class keeps track of a set of resources that are associated with
@@ -228,13 +232,17 @@ public class SyncSet {
IPath path = container.getFullPath();
Set children = (Set)parents.get(path);
if (children == null) return new SyncInfo[0];
- SyncInfo[] infos = new SyncInfo[children.size()];
- int i = 0;
+ List infos = new ArrayList();
for (Iterator iter = children.iterator(); iter.hasNext();) {
IResource child = (IResource) iter.next();
- infos[i++] = getSyncInfo(child);
+ SyncInfo info = getSyncInfo(child);
+ if(info != null) {
+ infos.add(info);
+ } else {
+ TeamUIPlugin.log(IStatus.INFO, "missing sync info: " + child.getFullPath(), null);
+ }
}
- return infos;
+ return (SyncInfo[]) infos.toArray(new SyncInfo[infos.size()]);
}
private IResource[] getRoots(IContainer root) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java
index 30b018fad..1c5506c74 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java
@@ -21,5 +21,19 @@ public interface INavigableControl {
/**
* Returns true if at end or beginning.
*/
- boolean gotoDifference(int direction);
+ boolean gotoDifference(int direction);
+
+ /**
+ * Preserve the selection for the given direction
+ * filter.
+ * @param the direction to preserve
+ */
+ void preserveState(int direction);
+
+ /**
+ * Restore the selection and expansion for the
+ * given direction.
+ * @param direction the direction to restore
+ */
+ void restoreState(int direction);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java
index 02d396448..fd54f666c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java
@@ -83,8 +83,7 @@ public class SyncSetTreeContentProvider extends SyncSetContentProvider implement
parent = getModelParent(resource);
}
Object element = getModelObject(resource);
- tree.add(parent, element);
- tree.expandToLevel(element, AbstractTreeViewer.ALL_LEVELS);
+ tree.add(parent, element);
}
} else {
super.handleResourceAdditions(event);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java
index b3d0168b6..19b06b1ea 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java
@@ -36,4 +36,16 @@ public class SyncTableViewer extends TableViewer implements INavigableControl {
table.setSelection(next);
return false;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.sync.views.INavigableControl#preserveSelection(int)
+ */
+ public void preserveState(int direction) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.sync.views.INavigableControl#restoreSelection(int)
+ */
+ public void restoreState(int direction) {
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java
index d9991013f..e6bc3a2a0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java
@@ -257,5 +257,16 @@ public class SyncTreeViewer extends TreeViewer implements INavigableControl {
}
}
}
-
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.sync.views.INavigableControl#preserveState(int)
+ */
+ public void preserveState(int direction) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.sync.views.INavigableControl#restoreState(int)
+ */
+ public void restoreState(int direction) {
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
index 599de883e..d732df502 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
@@ -19,6 +19,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
@@ -56,6 +57,7 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.ITeamResourceChangeListener;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.subscribers.TeamDelta;
@@ -76,7 +78,12 @@ import org.eclipse.team.internal.ui.sync.sets.ISyncSetChangedListener;
import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
import org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent;
import org.eclipse.team.ui.ISharedImages;
+import org.eclipse.team.ui.sync.AndSyncInfoFilter;
import org.eclipse.team.ui.sync.ISynchronizeView;
+import org.eclipse.team.ui.sync.PseudoConflictFilter;
+import org.eclipse.team.ui.sync.SyncInfoChangeTypeFilter;
+import org.eclipse.team.ui.sync.SyncInfoDirectionFilter;
+import org.eclipse.team.ui.sync.SyncInfoFilter;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
@@ -837,4 +844,28 @@ public class SynchronizeView extends ViewPart implements ITeamResourceChangeList
input.setWorkingSet(set);
updateTitle();
}
+ /**
+ * Updates the filter applied to the active subscriber input and ensures that selection and expansions
+ * is preserved when the filtered contents are shown.
+ * @param filter
+ */
+ public void updateInputFilter(int[] directions, int[] changeTypes) {
+ try {
+ if(viewer instanceof INavigableControl) {
+ ((INavigableControl)viewer).preserveState(1);
+ }
+ input.setFilter(
+ new AndSyncInfoFilter(
+ new SyncInfoFilter[] {
+ new SyncInfoDirectionFilter(directions),
+ new SyncInfoChangeTypeFilter(changeTypes),
+ new PseudoConflictFilter()
+ }), new NullProgressMonitor());
+ if(viewer instanceof INavigableControl) {
+ ((INavigableControl)viewer).restoreState(1);
+ }
+ } catch (TeamException e) {
+ Utils.handleError(getSite().getShell(), e, Policy.bind("SynchronizeView.16"), e.getMessage()); //$NON-NLS-1$
+ }
+ }
} \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
index f267ad7da..0190329ac 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
@@ -19,6 +19,7 @@ import junit.framework.TestSuite;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.subscribers.TeamProvider;
@@ -26,7 +27,10 @@ import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.client.Command;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.team.ui.sync.SyncInfoSet;
@@ -353,7 +357,33 @@ public class CVSMergeSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.CONFLICTING | SyncInfo.CHANGE});
// cancel the subscriber
- subscriber.cancel();
+ subscriber.cancel();
+ }
+
+ public void testDisconnectingProject() throws CoreException, IOException, TeamException, InterruptedException {
+ // Create a test project (which commits it as well)
+ // Create a test project
+ IProject project = createProject("testDisconnect", new String[] { "file1.txt", "file2.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"});
+ setContentsAndEnsureModified(project.getFile("file1.txt"), "some text\nwith several lines\n");
+ setContentsAndEnsureModified(project.getFile("file2.txt"), "some text\nwith several lines\n");
+ commitProject(project);
+
+ // Checkout and branch a copy
+ CVSTag root = new CVSTag("root_branch1", CVSTag.VERSION);
+ CVSTag branch = new CVSTag("branch1", CVSTag.BRANCH);
+ IProject branchedProject = branchProject(project, root, branch);
+
+ // modify the branch
+ appendText(branchedProject.getFile("file1.txt"), "first line\n", true);
+ appendText(branchedProject.getFile("file2.txt"), "last line\n", false);
+ commitProject(branchedProject);
+
+ // create a merge subscriber
+ CVSMergeSubscriber subscriber = createMergeSubscriber(project, root, branch);
+ ICVSFolder cvsProject = CVSWorkspaceRoot.getCVSFolderFor(project);
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project);
+ provider.deconfigure();
+ assertProjectRemoved(subscriber, project);
}
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
index 17e5d8f2d..2b57551f5 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
@@ -19,6 +19,7 @@ import java.util.Set;
import junit.framework.AssertionFailedError;
import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
@@ -217,4 +218,10 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
}
return result;
}
+
+ protected void assertProjectRemoved(TeamSubscriber subscriber, IProject project) throws TeamException, InterruptedException {
+ // wait for events to flow
+ Thread.sleep(1000);
+ getSyncInfoSource().assertProjectRemoved(subscriber, project);
+ }
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
index fd84f7c47..0420a2f04 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
@@ -30,12 +30,14 @@ import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
+import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.subscribers.TeamDelta;
import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -965,7 +967,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
assertSyncEquals("sync should be in sync", project, resourceNames, true, inSync);
}
- public void testDeleteProject() throws TeamException, CoreException, IOException {
+ public void testDeleteProject() throws CoreException, IOException, TeamException, InterruptedException {
String[] resourceNames = new String[] { "deleted.txt", "file1.txt", "folder1/", "folder1/a.txt" };
int[] inSync = new int[] {SyncInfo.IN_SYNC, SyncInfo.IN_SYNC, SyncInfo.IN_SYNC, SyncInfo.IN_SYNC};
IProject project = createProject("testDeleteProject", resourceNames);
@@ -990,13 +992,9 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
project.delete(true, false, DEFAULT_MONITOR);
- assertProjectRemoved(project);
+ assertProjectRemoved(getWorkspaceSubscriber(), project);
}
- protected void assertProjectRemoved(IProject project) throws TeamException {
- getSyncInfoSource().assertProjectRemoved(getWorkspaceSubscriber(), project);
- }
-
public void testFolderDeletion() throws TeamException, CoreException {
IProject project = createProject("testFolderDeletion", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt", "folder1/folder2/file.txt"});
@@ -1119,14 +1117,13 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
assertTrue("Folder should still exist", project.getFolder("folder2").exists());
}
- public void testDisconnectingProject() throws CoreException, TeamException {
+ public void testDisconnectingProject() throws CoreException, TeamException, InterruptedException {
// Create a test project (which commits it as well)
- // comment out until we can fix it :)
-// IProject project = createProject("testDisconnect", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"});
-// ICVSFolder cvsProject = CVSWorkspaceRoot.getCVSFolderFor(project);
-// CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project);
-// provider.deconfigure();
-// assertProjectRemoved(project);
+ IProject project = createProject("testDisconnect", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"});
+ ICVSFolder cvsProject = CVSWorkspaceRoot.getCVSFolderFor(project);
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project);
+ provider.deconfigure();
+ assertProjectRemoved(getWorkspaceSubscriber(), project);
}
/*
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/sync/SyncInfoFromSyncSet.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/sync/SyncInfoFromSyncSet.java
index 35f36c1d1..23650d1ae 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/sync/SyncInfoFromSyncSet.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/sync/SyncInfoFromSyncSet.java
@@ -36,7 +36,7 @@ public class SyncInfoFromSyncSet extends SyncInfoSource {
public SyncInfo getSyncInfo(TeamSubscriber subscriber, IResource resource) throws TeamException {
TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.TESTING_SYNCVIEW, true);
SubscriberInput input = getInput(subscriber);
- SyncSet set = input.getFilteredSyncSet();
+ SyncSet set = input.getWorkingSetSyncSet();
SyncInfo info = set.getSyncInfo(resource);
if (info == null) {
info = subscriber.getSyncInfo(resource, DEFAULT_MONITOR);

Back to the top