Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-03-01 15:37:54 -0500
committerJean Michel-Lemieux2002-03-01 15:37:54 -0500
commit402b4f5ee148505e76f959cdbed7d4d7ef989a98 (patch)
tree96c9cf3a9efe906d48dbf51352ed2869f1c35720
parent4c30bc4f0235cad205a4aae49203eac639d0425d (diff)
downloadeclipse.platform.team-402b4f5ee148505e76f959cdbed7d4d7ef989a98.tar.gz
eclipse.platform.team-402b4f5ee148505e76f959cdbed7d4d7ef989a98.tar.xz
eclipse.platform.team-402b4f5ee148505e76f959cdbed7d4d7ef989a98.zip
refactoring in progress...
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java10
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java12
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java368
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java5
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java22
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoveEntryHandler.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSFileNotFoundException.java25
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java140
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java106
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java20
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java389
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java1
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java58
29 files changed, 756 insertions, 502 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java
index fa0f1f90e..76e96cdae 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java
@@ -365,6 +365,8 @@ public class CVSProvider implements ICVSProvider {
// Determine if the repository is known
boolean alreadyExists = isCached(location);
+ // Set the folder sync info of the project to point to the remote module
+ ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
try {
// Get the import properties
@@ -391,9 +393,7 @@ public class CVSProvider implements ICVSProvider {
} finally {
s.close();
}
-
- // Set the folder sync info of the project to point to the remote module
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
+
folder.setFolderSyncInfo(new FolderSyncInfo(moduleName, location.getLocation(), null, false));
// Register the project with Team
@@ -412,7 +412,7 @@ public class CVSProvider implements ICVSProvider {
disposeRepository(location);
throw e;
} finally {
- CVSProviderPlugin.getSynchronizer().save(project.getLocation().toFile(), Policy.subMonitorFor(monitor, 5));
+ folder.saveSyncInfo(Policy.subMonitorFor(monitor, 5));
}
// Add the repository if it didn't exist already
if ( ! alreadyExists)
@@ -483,7 +483,7 @@ public class CVSProvider implements ICVSProvider {
} catch (CoreException e) {
throw wrapException(e);
} finally {
- CVSProviderPlugin.getSynchronizer().save(project.getLocation().toFile(), Policy.subMonitorFor(monitor, 5));
+ folder.saveSyncInfo(Policy.subMonitorFor(monitor, 5));
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
index fdbf2ad12..6ad6f9875 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
@@ -56,7 +56,6 @@ public class CVSProviderPlugin extends Plugin {
private String cvsServer = DEFAULT_CVS_SERVER;
private static CVSProviderPlugin instance;
- private static ICVSSynchronizer synchronizer;
/**
* The identifier for the CVS nature
@@ -156,8 +155,6 @@ public class CVSProviderPlugin extends Plugin {
super.startup();
Policy.localize("org.eclipse.team.internal.ccvs.core.messages"); //$NON-NLS-1$
- synchronizer = new FileSystemSynchronizer();
-
CVSProvider.startup();
ProjectDescriptionManager.initializeChangeListener();
new OrphanedFolderListener().register();
@@ -170,14 +167,7 @@ public class CVSProviderPlugin extends Plugin {
super.shutdown();
CVSProvider.shutdown();
}
-
- /**
- * Returns the synchronizer reponsible for managing the CVS meta information.
- */
- public static ICVSSynchronizer getSynchronizer() {
- return synchronizer;
- }
-
+
/*
* Add a resource change listener to the workspace in order to respond to
* resource deletions and moves and to ensure or project desription file is up to date.
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 854061189..36d7edc15 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -84,7 +84,6 @@ import org.eclipse.team.internal.ccvs.core.util.Assert;
*/
public class CVSTeamProvider implements ITeamNature, ITeamProvider {
- // Instance variables
private CVSWorkspaceRoot workspaceRoot;
private IProject project;
private String comment = ""; //$NON-NLS-1$
@@ -99,7 +98,6 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
* @see IProjectNature#configure()
*/
public void configure() throws CoreException {
- // Do nothing
}
/**
@@ -114,6 +112,12 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
public IProject getProject() {
return project;
}
+
+ /**
+ * @see ITeamNature#configureProvider(Properties)
+ */
+ public void configureProvider(Properties configuration) throws TeamException {
+ }
/**
* @see IProjectNature#setProject(IProject)
@@ -137,20 +141,12 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
*/
public ITeamProvider getProvider() throws TeamException {
if (workspaceRoot == null) {
- // An error must have occured when we were configured
throw new TeamException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, Policy.bind("CVSTeamProvider.initializationFailed", new Object[]{project.getName()}), null)); //$NON-NLS-1$
}
return this;
}
/**
- * @see ITeamNature#configureProvider(Properties)
- */
- public void configureProvider(Properties configuration) throws TeamException {
- // Do nothing
- }
-
- /**
* Add the given resources to the project.
* <p>
* The sematics follow that of CVS in the sense that any folders
@@ -195,9 +191,9 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
// Auto-add parents if they are not already managed
IContainer parent = resources[i].getParent();
// XXX Need to consider workspace root
-
- while (parent.getType() != IResource.ROOT && ! isManaged(parent)) {
- folders.add(parent.getFullPath().removeFirstSegments(1).toString());
+ ICVSFolder cvsParent = CVSWorkspaceRoot.getCVSFolderFor(parent);
+ while (parent.getType()!=IResource.PROJECT && !cvsParent.isManaged()) {
+ folders.add(parent.getProjectRelativePath().toString());
parent = parent.getParent();
}
@@ -207,22 +203,17 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
// Auto-add children
resources[i].accept(new IResourceVisitor() {
public boolean visit(IResource resource) {
- try {
- if (!isManaged(resource)) {
- String name = resource.getFullPath().removeFirstSegments(1).toString();
- if (resource.getType() == IResource.FILE) {
- String extension = resource.getFileExtension();
- if ((extension != null) && ("true".equals(registry.getValue(extension, "isText")))) //$NON-NLS-1$ //$NON-NLS-2$
- textfiles.add(name);
- else
- binaryfiles.add(name);
- } else
- folders.add(name);
- }
- } catch (TeamException e) {
- // Record the exception to be thrown again later
- eHolder[0] = e;
- return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if (!cvsResource.isManaged() && resource.getType()!=IResource.PROJECT) {
+ String name = resource.getFullPath().removeFirstSegments(1).toString();
+ if (resource.getType() == IResource.FILE) {
+ String extension = resource.getFileExtension();
+ if ((extension != null) && ("true".equals(registry.getValue(extension, "isText")))) //$NON-NLS-1$ //$NON-NLS-2$
+ textfiles.add(name);
+ else
+ binaryfiles.add(name);
+ } else
+ folders.add(name);
}
// Always return true and let the depth determine if children are visited
return true;
@@ -334,18 +325,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
*/
public void checkout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
}
-
- /*
- * Generate an exception if the resource is not a child of the project
- */
- private void checkIsChild(IResource resource) throws CVSException {
- if (!isChildResource(resource))
- throw new CVSException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE,
- Policy.bind("CVSTeamProvider.invalidResource", //$NON-NLS-1$
- new Object[] {resource.getFullPath().toString(), project.getName()}),
- null));
- }
-
+
/**
* @see ITeamProvider#delete(IResource[], int, IProgressMonitor)
*/
@@ -370,17 +350,14 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
resources[i].accept(new IResourceVisitor() {
public boolean visit(IResource resource) {
try {
- if (isManaged(resource)) {
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if (cvsResource.isManaged()) {
String name = resource.getFullPath().removeFirstSegments(1).toString();
if (resource.getType() == IResource.FILE) {
files.add(name);
((IFile)resource).delete(false, true, progress);
}
}
- } catch (TeamException e) {
- eHolder[0] = e;
- // If there was a problem, don't visit the children
- return false;
} catch (CoreException e) {
eHolder[0] = wrapException(e);
// If there was a problem, don't visit the children
@@ -489,8 +466,9 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- getChild(resource).accept(visitor);
- CVSProviderPlugin.getSynchronizer().save(resource.getLocation().toFile(), progress);
+ ICVSResource cvsResource = workspaceRoot.getLocalRoot().getChild(resource.getProjectRelativePath().toString());
+ cvsResource.accept(visitor);
+ cvsResource.saveSyncInfo(progress);
}
// Perform an update, ignoring any local file modifications
@@ -503,122 +481,6 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
update(resources, commandOptions, tag, null, progress);
}
- /*
- * Get the corresponding managed child for the given resource.
- */
- private ICVSResource getChild(IResource resource) throws CVSException {
- if (resource.equals(project))
- return workspaceRoot.getLocalRoot();
- return workspaceRoot.getLocalRoot().getChild(resource.getProjectRelativePath().toString());
- }
-
-
- /*
- * Helper method that uses the parent of a local resource that has no base to ensure that the resource
- * wasn't added remotely by a third party
- */
- private ICVSRemoteResource getRemoteTreeFromParent(IResource resource, ICVSResource managed, CVSTag tag, IProgressMonitor progress) throws TeamException {
- // If the parent isn't mapped to CVS, there's nothing we can do
- ICVSFolder parent = managed.getParent();
- if (!parent.isCVSFolder()) {
- // Check to make sure the project still has the CVS information
- ICVSFolder root = workspaceRoot.getLocalRoot();
- if (!root.isCVSFolder()) {
- // This is a catastrophic error. The project should have CVS information
- TeamPlugin.getManager().removeProvider(project, Policy.monitorFor(null));
- throw new CVSException(new CVSStatus(CVSStatus.ERROR, project.getFullPath(), Policy.bind("CVSTeamProvider.invalidProjectState", root.getName()), null)); //$NON-NLS-1$
- } else {
- throw new CVSException(new CVSStatus(CVSStatus.ERROR, resource.getFullPath(), Policy.bind("CVSTeamProvider.unmanagedParent", resource.getFullPath().toString()), null)); //$NON-NLS-1$
- }
- }
- ICVSRepositoryLocation location = CVSProvider.getInstance().getRepository(parent.getFolderSyncInfo().getRoot());
- // XXX We build and fetch the whole tree from the parent. We could restrict the search to just the desired child
- RemoteFolder remoteParent = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, parent, tag, progress);
- ICVSRemoteResource remote = null;
- if (remoteParent != null) {
- try {
- remote = (ICVSRemoteResource)remoteParent.getChild(resource.getName());
- } catch (CVSException e) {
- remote = null;
- }
- // The types need to match or we're in trouble
- if (remote != null && !(remote.isContainer() == managed.isFolder()))
- throw new CVSException(new CVSStatus(CVSStatus.ERROR, resource.getFullPath(), Policy.bind("CVSTeamProvider.typesDiffer", resource.getFullPath().toString()), null)); //$NON-NLS-1$
- }
- return remote;
- }
-
- public IRemoteSyncElement getRemoteSyncTree(IResource resource, CVSTag tag, IProgressMonitor progress) throws TeamException {
- checkIsChild(resource);
- ICVSResource managed = getChild(resource);
- ICVSRemoteResource remote = workspaceRoot.getRemoteResourceFor(resource);
- ICVSRemoteResource baseTree = null;
-
- // The resource doesn't have a remote base.
- // However, we still need to check to see if its been created remotely by a third party.
- if (remote == null) {
- remote = getRemoteTreeFromParent(resource, managed, tag, progress);
- } else if(resource.getType() == IResource.FILE) {
- baseTree = remote;
- ICVSRemoteResource remoteParent = workspaceRoot.getRemoteResourceFor(resource.getParent());
- remote = RemoteFile.getLatest((RemoteFolder)remoteParent, (ICVSFile)managed, tag, progress);
- } else {
- ICVSRepositoryLocation location = remote.getRepository();
- baseTree = RemoteFolderTreeBuilder.buildBaseTree((CVSRepositoryLocation)location, (ICVSFolder)managed, tag, progress);
- remote = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFolder)managed, tag, progress);
- }
- return new CVSRemoteSyncElement(false, resource, baseTree, remote);
- }
-
- public ICVSRemoteResource getRemoteTree(IResource resource, CVSTag tag, IProgressMonitor progress) throws TeamException {
- checkIsChild(resource);
- ICVSResource managed = getChild(resource);
- ICVSRemoteResource remote = workspaceRoot.getRemoteResourceFor(resource);
- if (remote == null) {
- remote = getRemoteTreeFromParent(resource, managed, tag, progress);
- } else if(resource.getType() == IResource.FILE) {
- ICVSRemoteResource remoteParent = workspaceRoot.getRemoteResourceFor(resource.getParent());
- remote = RemoteFile.getLatest((RemoteFolder)remoteParent, (ICVSFile)managed, tag, progress);
- } else {
- ICVSRepositoryLocation location = remote.getRepository();
- remote = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFolder)managed, tag, progress);
- }
- return remote;
- }
-
- /**
- * Returns an IUserInfo instance that can be used to access and set the
- * user name and set the password. To have changes take place, the user must
- * invoke the setUserInfo() method.
- */
- public IUserInfo getUserInfo(IResource resource) throws TeamException {
- checkIsChild(resource);
- // Get the repository location for the receiver
- CVSRepositoryLocation location = (CVSRepositoryLocation)workspaceRoot.getRemoteLocation();
- return location.getUserInfo(true);
- }
-
- /*
- * Get the arguments to be passed to a commit or update
- */
- private String[] getValidArguments(IResource[] resources, LocalOption[] options) throws CVSException {
- int depth = Command.DO_NOT_RECURSE.isElementOf(options) ? IResource.DEPTH_ZERO : IResource.DEPTH_INFINITE;
- List arguments = new ArrayList(resources.length);
- for (int i=0;i<resources.length;i++) {
- checkIsChild(resources[i]);
- // A depth of zero is only valid for files
- if ((depth != IResource.DEPTH_ZERO) || (resources[i].getType() == IResource.FILE)) {
- IPath cvsPath = resources[i].getFullPath().removeFirstSegments(1);
- if (cvsPath.segmentCount() == 0) {
- arguments.add(Session.CURRENT_LOCAL_FOLDER);
- }
- else
- arguments.add(cvsPath.toString());
- }
- }
- return (String[])arguments.toArray(new String[arguments.size()]);
- }
-
/**
* @see ITeamProvider#hasRemote(IResource)
* XXX to be removed when sync methods are removed from ITeamProvider
@@ -636,7 +498,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
} else {
ResourceSyncInfo info = cvsResource.getSyncInfo();
if(info!=null) {
- return !info.getRevision().equals(ResourceSyncInfo.ADDED_REVISION);
+ return !info.isAdded();
} else {
return false;
}
@@ -651,42 +513,8 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
* XXX to be removed when sync methods are removed from ITeamProvider
*/
public boolean isCheckedOut(IResource resource) {
- // check to see if the resource exists and has an entry
- try {
- return isManaged(resource);
- } catch (TeamException e) {
- // Something went wrong. Log it and say the file is not checked out
- CVSProviderPlugin.log(e);
- return false;
- }
- }
-
- /*
- * Helper to indicate if the resource is a child of the receiver's project
- */
- private boolean isChildResource(IResource resource) {
- return resource.getProject().getName().equals(project.getName());
- }
-
- /**
- * Return whether the given resource is managed.
- *
- * From a CVS standpoint, this means that we have a CVS entry
- * for the resource and that uodates and commits may effect the
- * resource or its children.
- */
- public boolean isManaged(IResource resource) throws TeamException {
-
- if (resource.equals(project))
- return true;
-
- // Ensure that the resource is a child of our project
- if (!isChildResource(resource))
- // Is returning false enough or should we throw an exception
- return false;
-
- // Get the ICVSResource corresponding to the resource and check if its managed
- return getChild(resource).isManaged();
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ return cvsResource.isManaged();
}
/**
@@ -706,11 +534,6 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
* @see ITeamProvider#move(IResource, IPath, IProgressMonitor)
*/
public void moved(IPath source, IResource resource, IProgressMonitor progress) throws TeamException {
- // XXX
- // this translates to a delete and an add
- // How is this managed? Do we do the move or is that done after?
- // It becomes complicated if the local and remote operations
- // are independant as this is not the way CVS works!
}
/**
@@ -761,39 +584,6 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
}
}
- /*
- * This method expects to be passed an InfiniteSubProgressMonitor
- */
- private void setRemoteRoot(ICVSRepositoryLocation location, final IProgressMonitor monitor) throws TeamException {
-
- // Check if there is a differnece between the new and old roots
- final String root = location.getLocation();
- if (root.equals(workspaceRoot.getRemoteLocation()))
- return;
-
- try {
- // 256 ticks gives us a maximum of 1024 which seems reasonable for folders is a project
- monitor.beginTask(Policy.bind("CVSTeamProvider.folderInfo", project.getName()), 256); //$NON-NLS-1$
-
- // Visit all the children folders in order to set the root in the folder sync info
- workspaceRoot.getLocalRoot().accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {};
- public void visitFolder(ICVSFolder folder) throws CVSException {
- monitor.worked(1);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- if (info != null) {
- monitor.subTask(Policy.bind("CVSTeamProvider.updatingFolder", info.getRepository())); //$NON-NLS-1$
- folder.setFolderSyncInfo(new FolderSyncInfo(info.getRepository(), root, info.getTag(), info.getIsStatic()));
- folder.acceptChildren(this);
- }
- };
- });
- CVSProviderPlugin.getSynchronizer().save(project.getLocation().toFile(), monitor);
- } finally {
- monitor.done();
- }
- }
-
/**
* Tag the resources in the CVS repository with the given tag.
*/
@@ -908,18 +698,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
throw new CVSServerException(status);
}
}
-
- private static TeamException wrapException(CoreException e) {
- return new TeamException(statusFor(e));
- }
-
-
- private static IStatus statusFor(CoreException e) {
- // We should be taking out any status from the CVSException
- // and creating an array of IStatus!
- return new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, getMessageFor(e), e);
- }
-
+
public static String getMessageFor(Exception e) {
String message = Policy.bind(e.getClass().getName(), new Object[] {e.getMessage()});
if (message.equals(e.getClass().getName()))
@@ -959,6 +738,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
Assert.isTrue(false);
return false;
}
+
/*
* @see ITeamProvider#isDirty(IResource)
*/
@@ -967,7 +747,89 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
return false;
}
- public CVSWorkspaceRoot getCVSWorkspaceRoot() {
- return workspaceRoot;
+ public CVSWorkspaceRoot getCVSWorkspaceRoot() {
+ return workspaceRoot;
+ }
+
+ /*
+ * Generate an exception if the resource is not a child of the project
+ */
+ private void checkIsChild(IResource resource) throws CVSException {
+ if (!isChildResource(resource))
+ throw new CVSException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE,
+ Policy.bind("CVSTeamProvider.invalidResource", //$NON-NLS-1$
+ new Object[] {resource.getFullPath().toString(), project.getName()}),
+ null));
}
+
+ /*
+ * Get the arguments to be passed to a commit or update
+ */
+ private String[] getValidArguments(IResource[] resources, LocalOption[] options) throws CVSException {
+ int depth = Command.DO_NOT_RECURSE.isElementOf(options) ? IResource.DEPTH_ZERO : IResource.DEPTH_INFINITE;
+ List arguments = new ArrayList(resources.length);
+ for (int i=0;i<resources.length;i++) {
+ checkIsChild(resources[i]);
+ // A depth of zero is only valid for files
+ if ((depth != IResource.DEPTH_ZERO) || (resources[i].getType() == IResource.FILE)) {
+ IPath cvsPath = resources[i].getFullPath().removeFirstSegments(1);
+ if (cvsPath.segmentCount() == 0) {
+ arguments.add(Session.CURRENT_LOCAL_FOLDER);
+ }
+ else
+ arguments.add(cvsPath.toString());
+ }
+ }
+ return (String[])arguments.toArray(new String[arguments.size()]);
+ }
+
+ /*
+ * This method expects to be passed an InfiniteSubProgressMonitor
+ */
+ private void setRemoteRoot(ICVSRepositoryLocation location, final IProgressMonitor monitor) throws TeamException {
+
+ // Check if there is a differnece between the new and old roots
+ final String root = location.getLocation();
+ if (root.equals(workspaceRoot.getRemoteLocation()))
+ return;
+
+ try {
+ // 256 ticks gives us a maximum of 1024 which seems reasonable for folders is a project
+ monitor.beginTask(Policy.bind("CVSTeamProvider.folderInfo", project.getName()), 256); //$NON-NLS-1$
+
+ // Visit all the children folders in order to set the root in the folder sync info
+ workspaceRoot.getLocalRoot().accept(new ICVSResourceVisitor() {
+ public void visitFile(ICVSFile file) throws CVSException {};
+ public void visitFolder(ICVSFolder folder) throws CVSException {
+ monitor.worked(1);
+ FolderSyncInfo info = folder.getFolderSyncInfo();
+ if (info != null) {
+ monitor.subTask(Policy.bind("CVSTeamProvider.updatingFolder", info.getRepository())); //$NON-NLS-1$
+ folder.setFolderSyncInfo(new FolderSyncInfo(info.getRepository(), root, info.getTag(), info.getIsStatic()));
+ folder.acceptChildren(this);
+ }
+ };
+ });
+ workspaceRoot.getLocalRoot().saveSyncInfo(monitor);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ /*
+ * Helper to indicate if the resource is a child of the receiver's project
+ */
+ private boolean isChildResource(IResource resource) {
+ return resource.getProject().getName().equals(project.getName());
+ }
+
+ private static TeamException wrapException(CoreException e) {
+ return new TeamException(statusFor(e));
+ }
+
+ private static IStatus statusFor(CoreException e) {
+ // We should be taking out any status from the CVSException
+ // and creating an array of IStatus!
+ return new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, getMessageFor(e), e);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java
index 23f68405e..fbf5a6dee 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java
@@ -83,6 +83,11 @@ public interface ICVSRepositoryLocation extends IAdaptable {
public String getUsername();
/**
+ * Returns the user information for the location.
+ */
+ public IUserInfo getUserInfo(boolean allowModificationOfUsername);
+
+ /**
* Validate that the receiver can be used to connect to a repository.
* An exception is thrown if connection fails
*
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
index fe6ce870d..6ff261d72 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
@@ -23,7 +23,6 @@ import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
-import org.eclipse.team.internal.ccvs.core.resources.CVSFileNotFoundException;
/**
* Abstract base class for the commands which implements the ICommand
@@ -262,9 +261,13 @@ public abstract class Command {
// which type we return since only the name of the resource is used
// and sent to the server.
if(resource==null) {
- // XXX returning a folder because it is the safest choice when
- // localRoot is a handle to the IWorkspaceRoot!
- resource = localRoot.getFolder(arguments[i]);
+ if(localRoot.getName().length()==0) {
+ // XXX returning a folder because it is the safest choice when
+ // localRoot is a handle to the IWorkspaceRoot!
+ resource = localRoot.getFolder(arguments[i]);
+ } else {
+ resource = localRoot.getFile(arguments[i]);
+ }
}
resources[i] = resource;
}
@@ -295,10 +298,13 @@ public abstract class Command {
protected void checkResourcesManaged(ICVSResource[] resources) throws CVSException {
for (int i = 0; i < resources.length; ++i) {
ICVSFolder folder;
- /// XXX should perhaps use a visitor instead of type checking
- if (resources[i].isFolder()) folder = (ICVSFolder) resources[i];
- else folder = resources[i].getParent();
- if (folder==null || !folder.isCVSFolder()) {
+ if (resources[i].isFolder()) {
+ folder = (ICVSFolder) resources[i];
+ }
+ else {
+ folder = resources[i].getParent();
+ }
+ if (folder==null || (!folder.isCVSFolder() && folder.exists())) {
throw new CVSException(Policy.bind("Command.argumentNotManaged", folder.getName()));//$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoveEntryHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoveEntryHandler.java
index 208fab03e..98d5c7674 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoveEntryHandler.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoveEntryHandler.java
@@ -44,10 +44,6 @@ class RemoveEntryHandler extends ResponseHandler {
String fileName = repositoryFile.substring(repositoryFile.lastIndexOf("/") + 1); //$NON-NLS-1$
ICVSFolder mParent = session.getLocalRoot().getFolder(localDir);
ICVSFile mFile = mParent.getFile(fileName);
-
- // NOTE: Should we do something here other than throw a run-time exception
- Assert.isTrue(mParent.exists() && !mFile.exists());
-
mFile.unmanage();
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSFileNotFoundException.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSFileNotFoundException.java
deleted file mode 100644
index 2b1f23a81..000000000
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSFileNotFoundException.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.team.internal.ccvs.core.resources;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-
-/**
- * This exception represents the attemp to access a file/folder
- * that did not exist.
- */
-public class CVSFileNotFoundException extends CVSException {
-
- public CVSFileNotFoundException(IStatus status) {
- super(status);
- }
-
- public CVSFileNotFoundException(String message) {
- super(message);
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
index 025b12364..c6a45e510 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
@@ -5,19 +5,25 @@ package org.eclipse.team.internal.ccvs.core.resources;
* All Rights Reserved.
*/
-import java.io.File;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.team.ccvs.core.CVSStatus;
+import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.ICVSFile;
import org.eclipse.team.ccvs.core.ICVSFolder;
import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.ccvs.core.ICVSResource;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProvider;
+import org.eclipse.team.internal.ccvs.core.Policy;
+import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
public class CVSWorkspaceRoot {
@@ -28,31 +34,23 @@ public class CVSWorkspaceRoot {
this.localRoot = getCVSFolderFor(resource);
}
-/* public CVSWorkspaceRoot(File resource){
- try {
- this.localRoot = getCVSFolderFor(resource);
- } catch(ClassCastException e) {
- this.localRoot = null;
- }
+ public static ICVSFolder getCVSFolderFor(IContainer resource) {
+ return new EclipseFolder(resource);
}
-*/
- /*
- * @see ICVSWorkspaceRoot#getCVSResourceFor(File)
- */
-/* public static ICVSResource getCVSResourceFor(File resource) {
- if (resource.exists()) {
- if (resource.isDirectory()) {
- return new LocalFolder(resource);
- } else {
- return new LocalFile(resource);
- }
- }
- return null;
+
+
+ public static ICVSFile getCVSFileFor(IFile resource) {
+ return new EclipseFile(resource);
}
-*/
- /*
- * @see ICVSWorkspaceRoot#getRemoteResourceFor(IResource)
- */
+
+
+ public static ICVSResource getCVSResourceFor(IResource resource) {
+ if (resource.getType() == IResource.FILE)
+ return getCVSFileFor((IFile) resource);
+ else
+ return getCVSFolderFor((IContainer) resource);
+ }
+
public static ICVSRemoteResource getRemoteResourceFor(IResource resource) throws CVSException {
ICVSResource managed = getCVSResourceFor(resource);
if (managed.isFolder()) {
@@ -67,43 +65,75 @@ public class CVSWorkspaceRoot {
}
return null;
}
-
+
/*
- * @see ICVSWorkspaceRoot#getRemoteRoot()
+ * Helper method that uses the parent of a local resource that has no base to ensure that the resource
+ * wasn't added remotely by a third party
*/
- public ICVSRepositoryLocation getRemoteLocation() throws CVSException {
- return CVSProvider.getInstance().getRepository(localRoot.getFolderSyncInfo().getRoot());
+ private static ICVSRemoteResource getRemoteTreeFromParent(IResource resource, ICVSResource managed, CVSTag tag, IProgressMonitor progress) throws TeamException {
+ // If the parent isn't mapped to CVS, there's nothing we can do
+ ICVSFolder parent = managed.getParent();
+ if (!parent.isCVSFolder()) {
+ throw new CVSException(new CVSStatus(CVSStatus.ERROR, resource.getFullPath(), Policy.bind("CVSTeamProvider.unmanagedParent", resource.getFullPath().toString()), null)); //$NON-NLS-1$
+ }
+ ICVSRepositoryLocation location = CVSProvider.getInstance().getRepository(parent.getFolderSyncInfo().getRoot());
+ // XXX We build and fetch the whole tree from the parent. We could restrict the search to just the desired child
+ RemoteFolder remoteParent = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, parent, tag, progress);
+ ICVSRemoteResource remote = null;
+ if (remoteParent != null) {
+ try {
+ remote = (ICVSRemoteResource)remoteParent.getChild(resource.getName());
+ } catch (CVSException e) {
+ remote = null;
+ }
+ // The types need to match or we're in trouble
+ if (remote != null && !(remote.isContainer() == managed.isFolder()))
+ throw new CVSException(new CVSStatus(CVSStatus.ERROR, resource.getFullPath(), Policy.bind("CVSTeamProvider.typesDiffer", resource.getFullPath().toString()), null)); //$NON-NLS-1$
+ }
+ return remote;
}
-
- /*
- * @see ICVSWorkspaceRoot#getLocalRoot()
- */
- public ICVSFolder getLocalRoot() {
- return localRoot;
+
+ public static IRemoteSyncElement getRemoteSyncTree(IResource resource, CVSTag tag, IProgressMonitor progress) throws TeamException {
+ ICVSResource managed = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ ICVSRemoteResource remote = CVSWorkspaceRoot.getRemoteResourceFor(resource);
+ ICVSRemoteResource baseTree = null;
+
+ // The resource doesn't have a remote base.
+ // However, we still need to check to see if its been created remotely by a third party.
+ if (remote == null) {
+ remote = getRemoteTreeFromParent(resource, managed, tag, progress);
+ } else if(resource.getType() == IResource.FILE) {
+ baseTree = remote;
+ ICVSRemoteResource remoteParent = CVSWorkspaceRoot.getRemoteResourceFor(resource.getParent());
+ remote = RemoteFile.getLatest((RemoteFolder)remoteParent, (ICVSFile)managed, tag, progress);
+ } else {
+ ICVSRepositoryLocation location = remote.getRepository();
+ baseTree = RemoteFolderTreeBuilder.buildBaseTree((CVSRepositoryLocation)location, (ICVSFolder)managed, tag, progress);
+ remote = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFolder)managed, tag, progress);
+ }
+ return new CVSRemoteSyncElement(false, resource, baseTree, remote);
}
-
- /**
- * Gives you an LocalFolder for a absolute path in
- * platform dependend style.
- *
- * @throws CVSException on path.indexOf("CVS") != -1
- * @throws CVSException on internal IOExeption
- */
- public static ICVSFolder getCVSFolderFor(IContainer resource) {
- return new EclipseFolder(resource);
+
+ public static ICVSRemoteResource getRemoteTree(IResource resource, CVSTag tag, IProgressMonitor progress) throws TeamException {
+ ICVSResource managed = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ ICVSRemoteResource remote = CVSWorkspaceRoot.getRemoteResourceFor(resource);
+ if (remote == null) {
+ remote = getRemoteTreeFromParent(resource, managed, tag, progress);
+ } else if(resource.getType() == IResource.FILE) {
+ ICVSRemoteResource remoteParent = CVSWorkspaceRoot.getRemoteResourceFor(resource.getParent());
+ remote = RemoteFile.getLatest((RemoteFolder)remoteParent, (ICVSFile)managed, tag, progress);
+ } else {
+ ICVSRepositoryLocation location = remote.getRepository();
+ remote = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFolder)managed, tag, progress);
+ }
+ return remote;
}
-
- public static ICVSFile getCVSFileFor(IFile resource) {
- return new EclipseFile(resource);
+ public ICVSRepositoryLocation getRemoteLocation() throws CVSException {
+ return CVSProvider.getInstance().getRepository(localRoot.getFolderSyncInfo().getRoot());
}
-
- public static ICVSResource getCVSResourceFor(IResource resource) {
- if (resource.getType() == IResource.FILE)
- return getCVSFileFor((IFile) resource);
- else
- return getCVSFolderFor((IContainer) resource);
+ public ICVSFolder getLocalRoot() {
+ return localRoot;
}
-
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
index 7a2c24202..3dfcdf2e3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
@@ -14,8 +14,10 @@ import java.text.ParseException;
import java.util.Date;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ccvs.core.ICVSFile;
@@ -94,6 +96,11 @@ class EclipseFile extends EclipseResource implements ICVSFile {
}
}
getIOFile().setLastModified(millSec);
+ try {
+ resource.refreshLocal(IResource.DEPTH_ZERO, null);
+ } catch(CoreException e) {
+ throw CVSException.wrapException(e);
+ }
}
/*
@@ -158,7 +165,7 @@ class EclipseFile extends EclipseResource implements ICVSFile {
* @see ICVSResource#unmanage()
*/
public void unmanage() throws CVSException {
- CVSProviderPlugin.getSynchronizer().deleteResourceSync(getIOFile());
+ EclipseSynchronizer.getInstance().deleteResourceSync(resource, new NullProgressMonitor());
}
/*
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
index 0f9b2481b..c59aa6eeb 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
@@ -41,72 +41,48 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
* @see ICVSFolder#getFolders()
*/
public ICVSFolder[] getFolders() throws CVSException {
- try {
- IContainer folder = (IContainer)resource;
-
- if(!resource.exists()) {
- return new ICVSFolder[0];
- }
-
- final List folders = new ArrayList();
-
- ResourceSyncInfo[] syncDirs = CVSProviderPlugin.getSynchronizer().members(getIOFile());
- for (int i = 0; i < syncDirs.length; i++) {
- if(syncDirs[i].isDirectory()) {
- folders.add(new EclipseFolder(folder.getFolder(new Path(syncDirs[i].getName()))));
- }
- }
-
- IResource[] members = folder.members();
- for (int i = 0; i < members.length; i++) {
- IResource child = members[i];
- if(child.getType()!=IResource.FILE) {
- EclipseFolder childFolder = new EclipseFolder((IContainer)child);
- if(!childFolder.isIgnored() && !folders.contains(childFolder)) {
- folders.add(childFolder);
- }
- }
- }
- return (ICVSFolder[]) folders.toArray(new ICVSFolder[folders.size()]);
- } catch(CoreException e) {
- throw new CVSException(e.getStatus());
+ if(!resource.exists()) {
+ return new ICVSFolder[0];
}
+
+ IContainer folder = (IContainer)resource;
+ final List folders = new ArrayList();
+
+ IResource[] resources = EclipseSynchronizer.getInstance().members(folder);
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if(resources[i].getType()!=IResource.FILE) {
+ ICVSResource cvsResource = new EclipseFolder((IContainer)resources[i]);
+ if(!cvsResource.isIgnored()) {
+ folders.add(cvsResource);
+ }
+ }
+ }
+ return (ICVSFolder[]) folders.toArray(new ICVSFolder[folders.size()]);
}
/**
* @see ICVSFolder#getFiles()
*/
public ICVSFile[] getFiles() throws CVSException {
- try {
- IContainer folder = (IContainer)resource;
-
- if(!resource.exists()) {
- return new ICVSFile[0];
- }
-
- final List files = new ArrayList();
-
- ResourceSyncInfo[] syncFiles = CVSProviderPlugin.getSynchronizer().members(getIOFile());
- for (int i = 0; i < syncFiles.length; i++) {
- if(!syncFiles[i].isDirectory()) {
- files.add(new EclipseFile((IFile)folder.getFile(new Path(syncFiles[i].getName()))));
- }
- }
-
- IResource[] members = folder.members();
- for (int i = 0; i < members.length; i++) {
- IResource child = members[i];
- if(child.getType()==IResource.FILE) {
- EclipseFile childFile = new EclipseFile((IFile)child);
- if(!childFile.isIgnored() && !files.contains(childFile)) {
- files.add(childFile);
- }
- }
- }
- return (ICVSFile[]) files.toArray(new ICVSFile[files.size()]);
- } catch(CoreException e) {
- throw new CVSException(e.getStatus());
+ if(!resource.exists()) {
+ return new ICVSFile[0];
}
+
+ IContainer folder = (IContainer)resource;
+ final List files = new ArrayList();
+
+ IResource[] resources = EclipseSynchronizer.getInstance().members(folder);
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if(resources[i].getType()==IResource.FILE) {
+ ICVSResource cvsResource = new EclipseFile((IFile)resources[i]);
+ if(!cvsResource.isIgnored()) {
+ files.add(cvsResource);
+ }
+ }
+ }
+ return (ICVSFile[]) files.toArray(new ICVSFile[files.size()]);
}
/**
@@ -205,14 +181,14 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
* @see ICVSFolder#getFolderInfo()
*/
public FolderSyncInfo getFolderSyncInfo() throws CVSException {
- return CVSProviderPlugin.getSynchronizer().getFolderSync(getIOFile());
+ return EclipseSynchronizer.getInstance().getFolderSync((IContainer)resource);
}
/*
* @see ICVSFolder#setFolderInfo(FolderSyncInfo)
*/
public void setFolderSyncInfo(FolderSyncInfo folderInfo) throws CVSException {
- CVSProviderPlugin.getSynchronizer().setFolderSync(getIOFile(), folderInfo);
+ EclipseSynchronizer.getInstance().setFolderSync((IContainer)resource, folderInfo);
// the server won't add directories as sync info, therefore it must be done when
// a directory is shared with the repository.
setSyncInfo(new ResourceSyncInfo(getName()));
@@ -223,7 +199,7 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
*/
public boolean isCVSFolder() {
try {
- return CVSProviderPlugin.getSynchronizer().getFolderSync(getIOFile()) != null;
+ return EclipseSynchronizer.getInstance().getFolderSync((IContainer)resource) != null;
} catch(CVSException e) {
return false;
}
@@ -233,7 +209,7 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
* @see ICVSResource#unmanage()
*/
public void unmanage() throws CVSException {
- CVSProviderPlugin.getSynchronizer().deleteFolderSync(getIOFile(), new NullProgressMonitor());
+ EclipseSynchronizer.getInstance().deleteFolderSync((IContainer)resource, new NullProgressMonitor());
}
/*
@@ -249,7 +225,11 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
/*
* @see ICVSFolder#getChild(String)
*/
- public ICVSResource getChild(String path) throws CVSException {
+ public ICVSResource getChild(String namedPath) throws CVSException {
+ IPath path = new Path(namedPath);
+ if(path.segmentCount()==0) {
+ return this;
+ }
IResource child = ((IContainer)resource).findMember(path);
if(child!=null) {
if(child.getType()==IResource.FILE) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
index 377bd625f..fc5f2b537 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
@@ -133,7 +133,7 @@ abstract class EclipseResource implements ICVSResource {
// 2. check .cvsignore file
if(!ignored) {
- ignored = CVSProviderPlugin.getSynchronizer().isIgnored(getIOFile());
+ ignored = EclipseSynchronizer.getInstance().isIgnored(resource);
}
// 3. check the parent
@@ -150,14 +150,14 @@ abstract class EclipseResource implements ICVSResource {
* @see ICVSResource#setIgnored()
*/
public void setIgnored() throws CVSException {
- CVSProviderPlugin.getSynchronizer().setIgnored(getIOFile(), null);
+ EclipseSynchronizer.getInstance().setIgnored(resource, null);
}
/*
* @see ICVSResource#setIgnoredAs(String)
*/
public void setIgnoredAs(String pattern) throws CVSException {
- CVSProviderPlugin.getSynchronizer().setIgnored(getIOFile(), pattern);
+ EclipseSynchronizer.getInstance().setIgnored(resource, pattern);
}
/*
@@ -202,7 +202,7 @@ abstract class EclipseResource implements ICVSResource {
* @see ICVSResource#getSyncInfo()
*/
public ResourceSyncInfo getSyncInfo() throws CVSException {
- return CVSProviderPlugin.getSynchronizer().getResourceSync(getIOFile());
+ return EclipseSynchronizer.getInstance().getResourceSync(resource);
}
/*
@@ -210,7 +210,7 @@ abstract class EclipseResource implements ICVSResource {
*/
public void setSyncInfo(ResourceSyncInfo info) throws CVSException {
if (getParent().isCVSFolder()) {
- CVSProviderPlugin.getSynchronizer().setResourceSync(getIOFile(), info);
+ EclipseSynchronizer.getInstance().setResourceSync(resource, info);
}
}
@@ -240,23 +240,15 @@ abstract class EclipseResource implements ICVSResource {
return null;
}
- /*
+ /*
* @see ICVSResource#reloadSyncInfo(IProgressMonitor)
*/
public void reloadSyncInfo(IProgressMonitor monitor) throws CVSException {
- File file = getIOFile();
- if(file!=null) {
- CVSProviderPlugin.getSynchronizer().reload(file, monitor);
- }
}
/*
* @see ICVSResource#saveSyncInfo(IProgressMonitor)
*/
public void saveSyncInfo(IProgressMonitor monitor) throws CVSException {
- File file = getIOFile();
- if(file!=null) {
- CVSProviderPlugin.getSynchronizer().save(file, monitor);
- }
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
new file mode 100644
index 000000000..af1451a5f
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
@@ -0,0 +1,389 @@
+package org.eclipse.team.internal.ccvs.core.resources;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ISynchronizer;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.team.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.ccvs.core.CVSTag;
+import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
+import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
+
+/**
+ * A synchronizer is responsible for managing synchronization information for local
+ * CVS resources.
+ *
+ * @see ResourceSyncInfo
+ * @see FolderSyncInfo
+ */
+public class EclipseSynchronizer {
+ private static final QualifiedName FOLDER_SYNC_KEY = new QualifiedName(CVSProviderPlugin.ID, "folder-sync");
+ private static final QualifiedName RESOURCE_SYNC_KEY = new QualifiedName(CVSProviderPlugin.ID, "resource-sync");
+ private static EclipseSynchronizer instance;
+ private int nestingCount = 0;
+ private Set changedResources = new HashSet();
+ private Set changedFolders = new HashSet();
+
+ private EclipseSynchronizer() {
+ getSynchronizer().add(RESOURCE_SYNC_KEY);
+ getSynchronizer().add(FOLDER_SYNC_KEY);
+ }
+
+ /**
+ * Associates the provided folder sync information with the given folder. The folder
+ * must exist on the file system.
+ * <p>
+ * The workbench and team plugins are notified that the state of this resources has
+ * changed.</p>
+ *
+ * @param file the file or folder for which to associate the sync info.
+ * @param info the folder sync to set.
+ *
+ * @throws CVSException if there was a problem adding sync info.
+ */
+ public void setFolderSync(IContainer folder, FolderSyncInfo info) throws CVSException {
+ beginOperation();
+ setCachedFolderSync(folder, info);
+ changedFolders.add(folder);
+ endOperation();
+ }
+
+ /**
+ * Answers the folder sync information associated with this folder or <code>null</code>
+ * if none is available.
+ *
+ * @param folder the folder for which to return folder sync info.
+ * @throws CVSException if there was a problem adding folder sync info.
+ */
+ public FolderSyncInfo getFolderSync(IContainer folder) throws CVSException {
+ if(folder.getType()==IResource.ROOT) return null;
+ beginOperation();
+ FolderSyncInfo info = getCachedFolderSync(folder);
+ if (info == null) {
+ info = readFolderConfig(folder);
+ setCachedFolderSync(folder, info);
+ }
+ endOperation();
+ return info;
+ }
+
+ /**
+ * Associates the provided sync information with the given file or folder. The resource
+ * may or may not exist on the file system however the parent folder must be a cvs
+ * folder.
+ * <p>
+ * The workbench and team plugins are notified that the state of this resources has
+ * changed.</p>
+ *
+ * @param file the file or folder for which to associate the sync info.
+ * @param info to set. The name in the resource info must match the file or folder name.
+ *
+ * @throws CVSException if there was a problem adding sync info.
+ */
+ public void setResourceSync(IResource resource, ResourceSyncInfo info) throws CVSException {
+ beginOperation();
+ setCachedResourceSync(resource, info);
+ changedResources.add(resource);
+ endOperation();
+ }
+
+ /**
+ * Answers the sync information associated with this file of folder or <code>null</code>
+ * if none is available. A resource cannot have sync information if its parent folder
+ * does not exist.
+ *
+ * @param file the file or folder for which to return sync info.
+ * @throws CVSException if there was a problem adding sync info or broadcasting
+ * the changes.
+ */
+ public ResourceSyncInfo getResourceSync(IResource resource) throws CVSException {
+ if(resource.getType()==IResource.ROOT) return null;
+ beginOperation();
+ ResourceSyncInfo info = getCachedResourceSync(resource);
+ if (info == null) {
+ IContainer parent = resource.getParent();
+ if (parent != null) {
+ ResourceSyncInfo[] infos = readEntriesFile(resource.getParent());
+ if (infos != null) {
+ for (int i = 0; i < infos.length; i++) {
+ ResourceSyncInfo syncInfo = infos[i];
+ IResource peer;
+ if (resource.getName().equals(syncInfo.getName())) {
+ info = syncInfo;
+ peer = resource;
+ } else {
+ IPath path = new Path(syncInfo.getName());
+ if (syncInfo.isDirectory()) {
+ peer = parent.getFolder(path);
+ } else {
+ peer = parent.getFile(path);
+ }
+ }
+ // may create a phantom if the sibling resource does not exist.
+ setCachedResourceSync(peer, syncInfo);
+ }
+ }
+ }
+ }
+ endOperation();
+ return info;
+ }
+
+ /**
+ * Removes the folder's and all children's folder sync information. This will essentially remove
+ * all CVS knowledge from these resources.
+ */
+ public void deleteFolderSync(IContainer folder, IProgressMonitor monitor) throws CVSException {
+ beginOperation();
+ setCachedFolderSync(folder, null);
+ changedFolders.add(folder);
+ endOperation();
+ }
+
+ /**
+ * Removes the resource's sync information.
+ */
+ public void deleteResourceSync(IResource resource, IProgressMonitor monitor) throws CVSException {
+ beginOperation();
+ setCachedResourceSync(resource, null);
+ changedResources.add(resource);
+ endOperation();
+ }
+
+ /**
+ * Answers if the following resource is ignored
+ */
+ public boolean isIgnored(IResource resource) {
+ // FIX ME!
+ return false;
+ }
+
+ /**
+ * Adds a pattern or file name to be ignored in the current files directory.
+ */
+ public void setIgnored(IResource resource, String pattern) throws CVSException {
+ // FIX ME!
+ }
+
+ /**
+ * Answers an array with the sync information for immediate child resources of this folder. Note
+ * that the returned sync information may be for resources that no longer exist (e.g. in the
+ * case of a pending deletion).
+ *
+ * @param folder the folder for which to return the children resource sync infos. The folder
+ * must exist.
+ *
+ * @throws CVSException if an error occurs retrieving the sync info.
+ */
+ public IResource[] members(IContainer folder) throws CVSException {
+ try {
+ IResource[] children = folder.members(true);
+ List list = new ArrayList(children.length);
+ for (int i = 0; i < children.length; ++i) {
+ IResource child = children[i];
+ if (! child.isPhantom() || getCachedResourceSync(child) != null) {
+ list.add(child);
+ }
+ }
+ return (IResource[]) list.toArray(new IResource[list.size()]);
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ }
+ }
+
+ public void beginOperation() throws CVSException {
+ if (nestingCount++ == 0) {
+ // any work here?
+ }
+ }
+
+ public void endOperation() throws CVSException {
+ if (--nestingCount == 0) {
+ if (! changedFolders.isEmpty() || ! changedResources.isEmpty()) {
+ // write sync info to disk
+ Iterator it = changedFolders.iterator();
+ while (it.hasNext()) {
+ IContainer folder = (IContainer) it.next();
+ FolderSyncInfo info = getCachedFolderSync(folder);
+ if (info != null) {
+ writeFolderConfig(folder, info);
+ } else {
+ deleteFolderConfig(folder);
+ }
+ }
+ it = changedResources.iterator();
+ while (it.hasNext()) {
+ IResource resource = (IResource) it.next();
+ ResourceSyncInfo info = getCachedResourceSync(resource);
+ if (info != null) {
+ writeResourceSync(resource, info);
+ } else {
+ deleteResourceSync(resource);
+ }
+ }
+
+ // broadcast events
+ changedResources.addAll(changedFolders);
+ changedFolders.clear();
+ IResource[] resources = (IResource[]) changedResources.toArray(
+ new IResource[changedResources.size()]);
+ TeamPlugin.getManager().broadcastResourceStateChanges(resources);
+ changedResources.clear();
+ }
+ }
+ }
+
+ private ISynchronizer getSynchronizer() {
+ return ResourcesPlugin.getWorkspace().getSynchronizer();
+ }
+
+ private ResourceSyncInfo getCachedResourceSync(IResource resource) throws CVSException {
+ try {
+ byte[] bytes = getSynchronizer().getSyncInfo(RESOURCE_SYNC_KEY, resource);
+ if(bytes==null) {
+ return null;
+ }
+ return new ResourceSyncInfo(new String(bytes), null, null);
+ } catch(CoreException e) {
+ throw CVSException.wrapException(e);
+ }
+ }
+
+ private void setCachedResourceSync(IResource resource, ResourceSyncInfo info) throws CVSException {
+ try {
+ if(info==null) {
+ getSynchronizer().flushSyncInfo(RESOURCE_SYNC_KEY, resource, IResource.DEPTH_ZERO);
+ } else {
+ getSynchronizer().setSyncInfo(RESOURCE_SYNC_KEY, resource, info.getEntryLine(true).getBytes());
+ }
+ } catch(CoreException e) {
+ throw CVSException.wrapException(e);
+ }
+ }
+
+ private FolderSyncInfo getCachedFolderSync(IContainer folder) throws CVSException {
+ try {
+ byte[] bytes = getSynchronizer().getSyncInfo(FOLDER_SYNC_KEY, folder);
+ if(bytes==null) {
+ return null;
+ }
+ DataInputStream is = new DataInputStream(new ByteArrayInputStream(bytes));
+ String repo = is.readUTF();
+ String root = is.readUTF();
+ String tag = is.readUTF();
+ CVSTag cvsTag = null;
+ boolean isStatic = is.readBoolean();
+ if(!tag.equals("null")) {
+ cvsTag = new CVSEntryLineTag(tag);
+ }
+ return new FolderSyncInfo(repo, root, cvsTag, isStatic);
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ } catch(IOException e) {
+ throw CVSException.wrapException(e);
+ }
+ }
+
+ private void setCachedFolderSync(IContainer folder, FolderSyncInfo info) throws CVSException {
+ try {
+ if(info==null) {
+ getSynchronizer().flushSyncInfo(FOLDER_SYNC_KEY, folder, IResource.DEPTH_INFINITE);
+ } else {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ DataOutputStream os = new DataOutputStream(bos);
+ os.writeUTF(info.getRepository());
+ os.writeUTF(info.getRoot());
+ CVSEntryLineTag tag = info.getTag();
+ if(tag==null) {
+ os.writeUTF("null");
+ } else {
+ os.writeUTF(info.getTag().toEntryLineFormat(false));
+ }
+ os.writeBoolean(info.getIsStatic());
+ getSynchronizer().setSyncInfo(FOLDER_SYNC_KEY, folder, bos.toByteArray());
+ os.close();
+ }
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ } catch(IOException e) {
+ throw CVSException.wrapException(e);
+ }
+ }
+
+ private FolderSyncInfo readFolderConfig(IContainer folder) throws CVSException {
+ //return SyncFileUtil.readFolderConfig(folder.getLocation().toFile());
+ return null;
+ }
+
+ private void writeFolderConfig(IContainer folder, FolderSyncInfo info) throws CVSException {
+ /*
+ SyncFileUtil.writeFolderConfig(folder.getLocation().toFile(), info);
+ try {
+ folder.refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ }
+ */
+ }
+
+ private void deleteFolderConfig(IContainer folder) throws CVSException {
+ //SyncFileUtil.deleteSync(folder.getLocation().toFile());
+ }
+
+ private ResourceSyncInfo[] readEntriesFile(IContainer folder) throws CVSException {
+ //return SyncFileUtil.readEntriesFile(folder.getLocation().toFile());
+ return null;
+ }
+
+ private void writeResourceSync(IResource resource, ResourceSyncInfo info) throws CVSException {
+ /*
+ SyncFileUtil.writeResourceSync(resource.getLocation().toFile(), info);
+ try {
+ resource.getParent().refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ }*/
+ }
+
+ private void deleteResourceSync(IResource resource) throws CVSException {
+ /*
+ SyncFileUtil.deleteSync(resource.getLocation().toFile());
+ try {
+ resource.getParent().refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ }
+ */
+ }
+
+ public static EclipseSynchronizer getInstance() {
+ if (instance == null) {
+ instance = new EclipseSynchronizer();
+ }
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java
index 4c0ce1747..3869cc27d 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java
@@ -29,7 +29,7 @@ public class OrphanedFolderListener extends ResourceDeltaVisitor {
ICVSFolder mFolder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(resource);
if (mFolder.isCVSFolder() && ! mFolder.isManaged() && mFolder.getParent().isCVSFolder()) {
mFolder.unmanage();
- CVSProviderPlugin.getSynchronizer().reload(resource.getLocation().toFile(), Policy.monitorFor(null));
+ mFolder.reloadSyncInfo(Policy.monitorFor(null));
}
} catch (CVSException e) {
CVSProviderPlugin.log(e);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
index d827f5cff..5f9cdda1d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
@@ -172,10 +172,11 @@ public class CVSPropertiesPage extends PropertyPage {
methodType.add(methods[i]);
}
try {
- String method = cvsRoot.getRemoteLocation().getMethod().getName();
+ ICVSRepositoryLocation location = cvsRoot.getRemoteLocation();
+ String method = location.getMethod().getName();
methodType.select(methodType.indexOf(method));
- info = provider.getUserInfo(project);
+ info = location.getUserInfo(true);
userText.setText(info.getUsername());
} catch (TeamException e) {
handle(e);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java
index e3a506c12..8dd81df8b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java
@@ -13,9 +13,11 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.ccvs.core.ICVSFolder;
+import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.ui.dialogs.PropertyPage;
/**
@@ -40,14 +42,20 @@ public class ResourcePropertiesPage extends PropertyPage {
try {
IResource resource = getSelectedElement();
if (resource != null) {
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resource.getProject());;
- if (!provider.isManaged(resource)) {
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if (!cvsResource.isManaged()) {
createPair(composite, Policy.bind("ResourcePropertiesPage.status"), Policy.bind("ResourcePropertiesPage.notManaged"));
} else {
- createPair(composite, Policy.bind("ResourcePropertiesPage.status"), provider.hasRemote(resource) ? Policy.bind("ResourcePropertiesPage.versioned") : Policy.bind("ResourcePropertiesPage.notVersioned"));
- createPair(composite, Policy.bind("ResourcePropertiesPage.state"), provider.isCheckedOut(resource) ? Policy.bind("ResourcePropertiesPage.checkedOut") : Policy.bind("ResourcePropertiesPage.checkedIn"));
-
- //createPair(composite, Policy.bind("ResourcePropertiesPage.baseRevision"), common != null ? common.getVersionName() : Policy.bind("ResourcePropertiesPage.none"));
+ boolean hasRemote = false;
+ if(cvsResource.isFolder()) {
+ hasRemote = ((ICVSFolder)cvsResource).isCVSFolder();
+ } else {
+ ResourceSyncInfo info = cvsResource.getSyncInfo();
+ if(info!=null && !info.isAdded()) {
+ hasRemote = true;
+ }
+ }
+ createPair(composite, Policy.bind("ResourcePropertiesPage.status"), hasRemote ? Policy.bind("ResourcePropertiesPage.versioned") : Policy.bind("ResourcePropertiesPage.notVersioned"));
}
}
} catch (TeamException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
index 6d97730e6..c00ca4a84 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
@@ -16,10 +16,12 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.core.ITeamManager;
import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.actions.TeamAction;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -66,8 +68,9 @@ public class AddAction extends TeamAction {
ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
ITeamProvider provider = manager.getProvider(resources[i].getProject());
- if (provider == null) return false;
- if (((CVSTeamProvider)provider).isManaged(resources[i])) return false;
+ if(provider == null) return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
+ if (cvsResource.isManaged()) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
index ac429c083..22277d48c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
@@ -9,11 +9,12 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.core.ITeamManager;
import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.wizards.BranchWizard;
import org.eclipse.team.ui.actions.TeamAction;
@@ -46,7 +47,8 @@ public class BranchAction extends TeamAction {
for (int i = 0; i < resources.length; i++) {
ITeamProvider provider = manager.getProvider(resources[i].getProject());
if (provider == null) return false;
- if (!((CVSTeamProvider)provider).isManaged(resources[i])) return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
+ if (!cvsResource.isManaged()) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
index 6685c74f0..0505aa9d8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
@@ -10,11 +10,12 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.core.ITeamManager;
import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
+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.RepositoryManager;
@@ -55,9 +56,8 @@ public class CommitAction extends TeamAction {
for (int i = 0; i < resources.length; i++) {
ITeamProvider provider = manager.getProvider(resources[i].getProject());
if (provider == null) return false;
- CVSTeamProvider cvsProvider = (CVSTeamProvider)provider;
- if (!cvsProvider.isManaged(resources[i])) return false;
- if (!cvsProvider.isCheckedOut(resources[i])) return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
+ if (!cvsResource.isManaged()) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
index 7f013cc81..2c77c24a1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
@@ -71,7 +71,7 @@ public class CompareWithRemoteAction extends TeamAction {
}
}
- ICVSRemoteResource remoteResource = (ICVSRemoteResource)provider.getRemoteTree(resource, tag, new NullProgressMonitor());
+ ICVSRemoteResource remoteResource = CVSWorkspaceRoot.getRemoteTree(resource, tag, new NullProgressMonitor());
// Just to be safe...
if (remoteResource == null) {
MessageDialog.openInformation(getShell(), Policy.bind("CompareWithRemoteAction.noRemote"), Policy.bind("CompareWithRemoteAction.noRemoteLong"));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
index efd8f4d7a..dc3386400 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
@@ -17,6 +17,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSRemoteFile;
+import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.ccvs.core.ILogEntry;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
@@ -70,7 +71,7 @@ public class CompareWithRevisionAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length != 1) return false;
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resources[0]);
- return provider.isManaged(resources[0]);
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[0]);
+ return cvsResource.isManaged();
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
index 1b312a01b..d22031ef3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
@@ -18,6 +18,7 @@ import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSCompareEditorInput;
import org.eclipse.team.internal.ccvs.ui.CVSResourceNode;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -50,7 +51,7 @@ public class CompareWithTagAction extends TeamAction {
return;
}
CVSTag tag = dialog.getResult();
- ICVSRemoteResource remoteResource = (ICVSRemoteResource)provider.getRemoteTree(resource, tag, new NullProgressMonitor());
+ ICVSRemoteResource remoteResource = CVSWorkspaceRoot.getRemoteTree(resource, tag, new NullProgressMonitor());
CompareUI.openCompareEditor(new CVSCompareEditorInput(new CVSResourceNode(resource), new ResourceEditionNode(remoteResource)));
} catch (TeamException e) {
throw new InvocationTargetException(e);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
index 030f05d31..cb87f0890 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
@@ -22,10 +22,12 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.core.ITeamManager;
import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.actions.TeamAction;
@@ -80,7 +82,8 @@ public class TagAction extends TeamAction {
for (int i = 0; i < resources.length; i++) {
ITeamProvider provider = manager.getProvider(resources[i].getProject());
if (provider == null) return false;
- if (!((CVSTeamProvider)provider).isManaged(resources[i])) return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
+ if (!cvsResource.isManaged()) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
index 12223485e..7bd43f984 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
@@ -32,6 +32,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSFolder;
+import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.core.ITeamManager;
import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
@@ -189,7 +190,8 @@ public class UnmanageAction extends TeamAction {
if(resources[i].getType()!=IResource.PROJECT) return false;
ITeamProvider provider = manager.getProvider(resources[i].getProject());
if (provider == null) return false;
- if (!((CVSTeamProvider)provider).isManaged(resources[i])) return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
+ if (!cvsResource.isManaged()) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
index e496786f5..9a11671f2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
@@ -15,13 +15,14 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.core.ITeamManager;
import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.client.Command;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.actions.TeamAction;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -72,7 +73,8 @@ public class UpdateAction extends TeamAction {
for (int i = 0; i < resources.length; i++) {
ITeamProvider provider = manager.getProvider(resources[i].getProject());
if (provider == null) return false;
- if (!((CVSTeamProvider)provider).isManaged(resources[i])) return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
+ if (!cvsResource.isManaged()) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
index d59030497..c761429fc 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
@@ -20,6 +20,7 @@ import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
import org.eclipse.team.ui.sync.CatchupReleaseViewer;
@@ -45,9 +46,8 @@ public class MergeEditorInput extends CVSSyncCompareInput {
protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
monitor.beginTask(null, 100);
try {
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(project);
- IRemoteResource base = provider.getRemoteTree(project, start, Policy.subMonitorFor(monitor, 50));
- IRemoteResource remote = provider.getRemoteTree(project, end, Policy.subMonitorFor(monitor, 50));
+ IRemoteResource base = CVSWorkspaceRoot.getRemoteTree(project, start, Policy.subMonitorFor(monitor, 50));
+ IRemoteResource remote = CVSWorkspaceRoot.getRemoteTree(project, end, Policy.subMonitorFor(monitor, 50));
return new IRemoteSyncElement[] {new CVSRemoteSyncElement(false, project, base, remote)};
} finally {
monitor.done();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
index 3277b0544..57623a908 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
@@ -22,6 +22,7 @@ import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.core.sync.IRemoteSyncElement;
+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.ui.sync.CatchupReleaseViewer;
@@ -60,8 +61,7 @@ public class CVSSyncCompareInput extends SyncCompareInput {
monitor.beginTask(null, work);
try {
for (int i = 0; i < trees.length; i++) {
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resources[i].getProject());
- trees[i] = provider.getRemoteSyncTree(resources[i], null, Policy.subMonitorFor(monitor, 1000));
+ trees[i] = CVSWorkspaceRoot.getRemoteSyncTree(resources[i], null, Policy.subMonitorFor(monitor, 1000));
}
} finally {
monitor.done();
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
index a0b4e65e3..f8b348057 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
@@ -151,7 +151,6 @@ public class EclipseTest extends EclipseWorkspaceTest {
for (int i=0;i<resources.length;i++) {
CVSWorkspaceRoot.getCVSResourceFor(resources[i]).unmanage();
}
- CVSProviderPlugin.getSynchronizer().save(container.getLocation().toFile(), DEFAULT_MONITOR);
}
/**
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
index d5d623151..28fc6f6f3 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
@@ -194,7 +194,7 @@ public class RemoteResourceTest extends EclipseTest {
getProvider(project).checkin(new IResource[] {project}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
// Fetch the remote tree for the version
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, v1Tag, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, v1Tag, DEFAULT_MONITOR);
// Check out the project version
project = checkoutCopy(project, v1Tag);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java
index f7c996d0e..3f870b8ac 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java
@@ -143,7 +143,7 @@ public class SyncElementTest extends EclipseTest {
getProvider(copy).checkin(new IResource[] {copy}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
// Get the sync tree for the project
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testIncomingChanges", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"},
new int[] {
@@ -161,7 +161,7 @@ public class SyncElementTest extends EclipseTest {
updateResources(project, new String[] {"folder1/a.txt", "folder1/b.txt", /* "folder2/", "folder2/folder3/", */ "folder2/folder3/add.txt"}, false);
// Verify that we are in sync (except for "folder1/b.txt", which was deleted)
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testIncomingChanges", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"},
new int[] {
@@ -194,7 +194,7 @@ public class SyncElementTest extends EclipseTest {
deleteResources(project, new String[] {"folder1/b.txt"}, false);
// Get the sync tree for the project
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testOutgoingChanges", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"},
new int[] {
@@ -210,7 +210,7 @@ public class SyncElementTest extends EclipseTest {
commitResources(project, new String[] {"folder1/a.txt", "folder1/b.txt", "folder2/folder3/add.txt"});
// Ensure we're in sync
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testOutgoingChanges", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"},
new int[] {
@@ -238,7 +238,7 @@ public class SyncElementTest extends EclipseTest {
file.delete(true, DEFAULT_MONITOR);
// Get the sync tree for the project
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testOutgoingQuestionables", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"},
new int[] {
@@ -257,7 +257,7 @@ public class SyncElementTest extends EclipseTest {
commitResources(project, new String[] {"folder1/b.txt", "folder2/folder3/add.txt"});
// Ensure we are in sync
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testOutgoingQuestionables", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"},
new int[] {
@@ -297,7 +297,7 @@ public class SyncElementTest extends EclipseTest {
file.setContents(getRandomContents(), false, false, null); // This will test conflicts (C)
// Get the sync tree for the project
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testFileConflict", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
new int[] {
@@ -309,7 +309,7 @@ public class SyncElementTest extends EclipseTest {
getProvider(project).update(new IResource[] {project.getFile("file1.txt")},
new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES, Command.DO_NOT_RECURSE},
null, null, DEFAULT_MONITOR);
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testFileConflict", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
new int[] {
@@ -319,7 +319,7 @@ public class SyncElementTest extends EclipseTest {
// Release the folder1/a.txt conflict by merging and then committing
makeOutgoing(tree, new String[] {"folder1/a.txt"});
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testFileConflict", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
new int[] {
@@ -327,7 +327,7 @@ public class SyncElementTest extends EclipseTest {
IRemoteSyncElement.IN_SYNC,
IRemoteSyncElement.OUTGOING | IRemoteSyncElement.CHANGE });
getProvider(project).checkin(new IResource[] {project.getFile("folder1/a.txt")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testFileConflict", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
new int[] {
@@ -363,7 +363,7 @@ public class SyncElementTest extends EclipseTest {
deleteResources(copy, new String[] { "add3.txt"}, true);
// Get the sync tree for the project
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testAdditionConflicts", tree,
new String[] { "file.txt", "add1a.txt", "add1b.txt", "add2a.txt", "add2b.txt", "add3.txt"},
new int[] {
@@ -376,7 +376,7 @@ public class SyncElementTest extends EclipseTest {
// Release the conflict cases (MERGE is not required for add3.txt but we do it anyway to ensure it doesn't cause problems)
makeOutgoing(tree, new String[]{"add1b.txt", "add2b.txt", "add3.txt"});
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testAdditionConflicts", tree,
new String[] { "file.txt", "add1b.txt", "add2b.txt", "add3.txt"},
new int[] {
@@ -385,7 +385,7 @@ public class SyncElementTest extends EclipseTest {
IRemoteSyncElement.OUTGOING | IRemoteSyncElement.CHANGE,
IRemoteSyncElement.OUTGOING | IRemoteSyncElement.ADDITION });
getProvider(project).checkin(new IResource[] {project.getFile("add1b.txt"), project.getFile("add2b.txt"), project.getFile("add3.txt")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testAdditionConflicts", tree,
new String[] { "file.txt", "add1b.txt", "add2b.txt", "add3.txt"},
new int[] {
@@ -400,7 +400,7 @@ public class SyncElementTest extends EclipseTest {
getProvider(project).update(new IResource[] {project.getFile("add1a.txt"), project.getFile("add2a.txt")},
new Command.LocalOption[] {Command.DO_NOT_RECURSE},
null, null, DEFAULT_MONITOR);
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testAdditionConflicts", tree,
new String[] { "add1a.txt", "add2a.txt"},
new int[] {
@@ -456,7 +456,7 @@ public class SyncElementTest extends EclipseTest {
// Get the sync tree for the project
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testDeletionConflictsA", tree,
new String[] { "delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt"},
new int[] {
@@ -473,7 +473,7 @@ public class SyncElementTest extends EclipseTest {
makeIncoming(tree, new String[] {"delete3.txt"});
project.getFile("delete3.txt").delete(false, DEFAULT_MONITOR);
updateResources(project, new String[] {"delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt"}, true);
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testDeletionConflictsA", tree,
new String[] { "delete1.txt", "delete2.txt"},
new int[] {
@@ -508,7 +508,7 @@ public class SyncElementTest extends EclipseTest {
// Get the sync tree for the project
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testDeletionConflictsB", tree,
new String[] { "delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt"},
new int[] {
@@ -524,7 +524,7 @@ public class SyncElementTest extends EclipseTest {
// XXX SPECIAL CASE: "delete4.txt" and "delete5.txt" must be unmanaged
unmanageResources(project, new String[]{"delete4.txt", "delete5.txt"});
commitResources(project, new String[] { "delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt"});
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testDeletionConflictsB", tree,
new String[] { "delete3.txt"},
new int[] {
@@ -572,7 +572,7 @@ public class SyncElementTest extends EclipseTest {
IResource[] resources = buildResources(project, new String[] {"folder1/"});
((IFolder)resources[0]).create(false, true, DEFAULT_MONITOR);
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testFolderConflict", tree,
new String[] { "file.txt", "folder1/", "folder1/file.txt", "folder2/", "folder2/file.txt"},
new int[] {
@@ -583,7 +583,7 @@ public class SyncElementTest extends EclipseTest {
IRemoteSyncElement.INCOMING | IRemoteSyncElement.ADDITION});
makeInSync(tree, new String[] {"folder1/"});
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testFolderConflict", tree,
new String[] { "file.txt", "folder1/", "folder1/file.txt", "folder2/", "folder2/file.txt"},
new int[] {
@@ -607,7 +607,7 @@ public class SyncElementTest extends EclipseTest {
file.delete(true, DEFAULT_MONITOR);
// Get the sync tree for the project
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testOutgoingDeletion", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"},
new int[] {
@@ -620,7 +620,7 @@ public class SyncElementTest extends EclipseTest {
getProvider(file).update(new IResource[] {file}, new Command.LocalOption[] {Command.DO_NOT_RECURSE}, null, null, DEFAULT_MONITOR);
// Get the sync tree again for the project and ensure others aren't effected
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testOutgoingDeletion", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
new int[] {
@@ -644,7 +644,7 @@ public class SyncElementTest extends EclipseTest {
addResources(copy, new String[] { "folder1/add.txt" }, true);
// Get the sync tree for the project
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testIncomingAddition", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/add.txt"},
new int[] {
@@ -661,7 +661,7 @@ public class SyncElementTest extends EclipseTest {
null, null, DEFAULT_MONITOR);
// Get the sync tree again for the project and ensure the added resource is in sync
- tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testIncomingAddition", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/add.txt"},
new int[] {
@@ -695,7 +695,7 @@ public class SyncElementTest extends EclipseTest {
file.setContents(new ByteArrayInputStream("unique text".getBytes()), false, false, null);
// Get the sync tree for the project
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertSyncEquals("testGranularityContents", tree,
new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
new int[] {
@@ -720,7 +720,7 @@ public class SyncElementTest extends EclipseTest {
deleteResources(project, new String[] {"folder1/b.txt"}, false);
// Get the sync tree for the project
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertEquals(Path.EMPTY, (ICVSResource)tree.getBase(), CVSWorkspaceRoot.getCVSResourceFor(copy), false, false);
}
@@ -747,8 +747,8 @@ public class SyncElementTest extends EclipseTest {
changeResources(project, new String[] {"file2.txt"}, false);
changeResources(project, new String[] {"file3.txt"}, true);
- IRemoteResource base = getProvider(project).getRemoteTree(project, new CVSTag("v1", CVSTag.VERSION), DEFAULT_MONITOR);
- IRemoteResource remote = getProvider(project).getRemoteTree(project, new CVSTag("branch1", CVSTag.BRANCH), DEFAULT_MONITOR);
+ IRemoteResource base = CVSWorkspaceRoot.getRemoteTree(project, new CVSTag("v1", CVSTag.VERSION), DEFAULT_MONITOR);
+ IRemoteResource remote = CVSWorkspaceRoot.getRemoteTree(project, new CVSTag("branch1", CVSTag.BRANCH), DEFAULT_MONITOR);
IRemoteSyncElement tree = new CVSRemoteSyncElement(false, project, base, remote);
// watch for empty directories and the prune option!!!
@@ -779,7 +779,7 @@ public class SyncElementTest extends EclipseTest {
changeResources(copy, new String[] {"file1.txt", "file2.txt"}, true);
// Sync on the original and assert the result equals the copy
- IRemoteSyncElement tree = getProvider(project).getRemoteSyncTree(project, null, DEFAULT_MONITOR);
+ IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, null, DEFAULT_MONITOR);
assertEquals(Path.EMPTY, (ICVSResource)tree.getRemote(), CVSWorkspaceRoot.getCVSResourceFor(copy), false, false);
}
} \ No newline at end of file

Back to the top