Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java26
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java13
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRunnable.java37
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java64
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java14
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ExpandModules.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java21
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java34
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java26
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java301
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/ICVSSynchronizer.java122
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java8
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java115
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java34
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java7
26 files changed, 436 insertions, 432 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 76e96cdae..b057d4e3a 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
@@ -411,8 +411,6 @@ public class CVSProvider implements ICVSProvider {
if ( ! alreadyExists)
disposeRepository(location);
throw e;
- } finally {
- folder.saveSyncInfo(Policy.subMonitorFor(monitor, 5));
}
// Add the repository if it didn't exist already
if ( ! alreadyExists)
@@ -482,8 +480,6 @@ public class CVSProvider implements ICVSProvider {
TeamPlugin.getManager().setProvider(project, CVSProviderPlugin.NATURE_ID, null, monitor);
} catch (CoreException e) {
throw wrapException(e);
- } finally {
- folder.saveSyncInfo(Policy.subMonitorFor(monitor, 5));
}
}
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 36d7edc15..95ac8a283 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
@@ -468,7 +468,6 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
IResource resource = resources[i];
ICVSResource cvsResource = workspaceRoot.getLocalRoot().getChild(resource.getProjectRelativePath().toString());
cvsResource.accept(visitor);
- cvsResource.saveSyncInfo(progress);
}
// Perform an update, ignoring any local file modifications
@@ -810,7 +809,6 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
}
};
});
- workspaceRoot.getLocalRoot().saveSyncInfo(monitor);
} finally {
monitor.done();
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java
index a183caf7d..8ab8bcb8a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java
@@ -5,6 +5,7 @@ package org.eclipse.team.ccvs.core;
* All Rights Reserved.
*/
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
@@ -93,4 +94,29 @@ public interface ICVSFolder extends ICVSResource {
* <code>false</code> otherwise.
*/
public boolean isCVSFolder();
+
+ /**
+ * Runs the given action as an atomic cvs local workspace operation
+ * rooted at this cvs folder.
+ * <p>
+ * After running a method that modifies cvs resource state in the
+ * local workspace, registered listeners receive after-the-fact
+ * notification in the form of a resource state change event. In addition,
+ * any resource state information persistance is batched.
+ * This method allows clients to call a number of
+ * methods that modify resources and only have resource
+ * change event notifications reported at the end of the entire
+ * batch.
+ * </p>
+ * <p>
+ * If this method is called in the dynamic scope of another such
+ * call, this method simply runs the action.
+ * </p>
+ *
+ * @param action the action to perform
+ * @param monitor a progress monitor, or <code>null</code> if progress
+ * reporting and cancellation are not desired
+ * @exception CVSException if the operation failed.
+ */
+ public void run(ICVSRunnable job, IProgressMonitor monitor) throws CVSException;
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java
index 9d288a464..e5e4b120f 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java
@@ -5,6 +5,7 @@ package org.eclipse.team.ccvs.core;
* All Rights Reserved.
*/
+import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.syncinfo.*;
@@ -134,15 +135,5 @@ public interface ICVSResource {
/**
* Accept a vistor to this resource.
*/
- public void accept(ICVSResourceVisitor visitor) throws CVSException;
-
- /**
- * Reload sync info from for this resource and all child resources from disk
- */
- public void reloadSyncInfo(IProgressMonitor monitor) throws CVSException;
-
- /**
- * Save sync info from for this resource and all child resources from disk
- */
- public void saveSyncInfo(IProgressMonitor monitor) throws CVSException;
+ public void accept(ICVSResourceVisitor visitor) throws CVSException;
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRunnable.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRunnable.java
new file mode 100644
index 000000000..69916b0d2
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRunnable.java
@@ -0,0 +1,37 @@
+package org.eclipse.team.ccvs.core;
+
+/*
+ * (c) Copyright IBM Corp. 2001, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+
+/**
+ * A runnable which executes as a batch operation within a specific cvs local
+ * workspace.
+ * The <code>ICVSRunnable</code> interface should be implemented by any class whose
+ * instances are intended to be run by <code>IWorkspace.run</code>.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see
+ */
+public interface ICVSRunnable {
+ /**
+ * Runs the operation reporting progress to and accepting
+ * cancellation requests from the given progress monitor.
+ * <p>
+ * Implementors of this method should check the progress monitor
+ * for cancellation when it is safe and appropriate to do so. The cancellation
+ * request should be propagated to the caller by throwing
+ * <code>OperationCanceledException</code>.
+ * </p>
+ *
+ * @param monitor a progress monitor, or <code>null</code> if progress
+ * reporting and cancellation are not desired
+ * @exception CoreException if this operation fails.
+ */
+ public void run(IProgressMonitor monitor) throws CVSException;
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
index 2213b5c9e..0af68f130 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
@@ -109,7 +109,7 @@ public class Checkout extends Command {
/**
* Override execute to perform a expand-modules before the checkout
*/
- public IStatus execute(Session session, GlobalOption[] globalOptions,
+ protected IStatus doExecute(Session session, GlobalOption[] globalOptions,
LocalOption[] localOptions, String[] arguments, ICommandOutputListener listener,
IProgressMonitor monitor) throws CVSException {
monitor.beginTask(null, 100);
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 6ff261d72..84d4f6834 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
@@ -20,6 +20,7 @@ import org.eclipse.team.ccvs.core.CVSStatus;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.ICVSFolder;
import org.eclipse.team.ccvs.core.ICVSResource;
+import org.eclipse.team.ccvs.core.ICVSRunnable;
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;
@@ -309,43 +310,7 @@ public abstract class Command {
}
}
}
-
- /**
- * Reloads the sync info for all resource arguments.
- *
- * @param resources the resource arguments for the command
- * @param monitor the progress monitor
- */
- private void reloadSyncInfo(ICVSResource[] resources, IProgressMonitor monitor) throws CVSException {
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(Policy.bind("Command.loadingSyncInfo"), 100 * resources.length);//$NON-NLS-1$
- for (int i = 0; i < resources.length; i++) {
- resources[i].reloadSyncInfo(Policy.subMonitorFor(monitor, 100));
- }
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Saves the sync info for all resource arguments.
- *
- * @param resources the resource arguments for the command
- * @param monitor the progress monitor
- */
- private void saveSyncInfo(ICVSResource[] resources, IProgressMonitor monitor) throws CVSException {
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(Policy.bind("Command.savingSyncInfo"), 100 * resources.length);//$NON-NLS-1$
- for (int i = 0; i < resources.length; i++) {
- resources[i].saveSyncInfo(Policy.subMonitorFor(monitor, 100));
- }
- } finally {
- monitor.done();
- }
- }
-
+
/**
* Executes a CVS command.
* <p>
@@ -363,9 +328,23 @@ public abstract class Command {
* @return a status code indicating success or failure of the operation
* @throws CVSException if a fatal error occurs (e.g. connection timeout)
*/
- public IStatus execute(Session session, GlobalOption[] globalOptions,
+ public final IStatus execute(final Session session, final GlobalOption[] globalOptions,
+ final LocalOption[] localOptions, final String[] arguments, final ICommandOutputListener listener,
+ IProgressMonitor pm) throws CVSException {
+ final IStatus[] status = new IStatus[1];
+ ICVSRunnable job = new ICVSRunnable() {
+ public void run(IProgressMonitor monitor) throws CVSException {
+ status[0] = doExcecute(session, globalOptions, localOptions, arguments, listener, monitor);
+ }
+ };
+ session.getLocalRoot().run(job, pm);
+ return status[0];
+ }
+
+ protected IStatus doExcecute(Session session, GlobalOption[] globalOptions,
LocalOption[] localOptions, String[] arguments, ICommandOutputListener listener,
IProgressMonitor monitor) throws CVSException {
+
ICVSResource[] resources = null;
/*** setup progress monitor ***/
monitor = Policy.monitorFor(monitor);
@@ -375,8 +354,7 @@ public abstract class Command {
/*** prepare for command ***/
// Ensure that the commands run with the latest contents of the CVS subdirectory sync files
// and not the cached values. Allow 10% of work.
- resources = computeWorkResources(session, localOptions, arguments);
- reloadSyncInfo(resources, Policy.subMonitorFor(monitor, 10));
+ resources = computeWorkResources(session, localOptions, arguments);
Policy.checkCanceled(monitor);
// clear stale command state from previous runs
@@ -407,11 +385,7 @@ public abstract class Command {
commandFinished(session, gOptions, lOptions, resources, Policy.subMonitorFor(monitor, 5),
status.getCode() != CVSStatus.SERVER_ERROR);
return status;
- } finally {
- // Give the synchronizer a chance to persist any pending changes.
- if(resources != null) {
- saveSyncInfo(resources, Policy.subMonitorFor(monitor, 5));
- }
+ } finally {
monitor.done();
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
index 6a8183852..abe7a9179 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
@@ -30,15 +30,13 @@ public class Diff extends Command {
}
/**
- * Overwritten to throw the CVSDiffException if the server returns an error, because it just does so when there is a
- * difference between the checked files.
+ * Overwritten to throw the CVSDiffException if the server returns an error, because it just does
+ * so when there is a difference between the checked files.
*/
- public IStatus execute(Session session, GlobalOption[] globalOptions,
- LocalOption[] localOptions, String[] arguments, ICommandOutputListener listener,
- IProgressMonitor monitor)
- throws CVSException {
+ protected IStatus doExcecute(Session session, GlobalOption[] globalOptions, LocalOption[] localOptions,
+ String[] arguments, ICommandOutputListener listener, IProgressMonitor monitor) throws CVSException {
try {
- return super.execute(session, globalOptions, localOptions, arguments, listener, monitor);
+ return super.doExcecute(session, globalOptions, localOptions, arguments, listener, monitor);
} catch (CVSServerException e) {
if (e.containsErrors()) throw e;
return e.getStatus();
@@ -54,5 +52,5 @@ public class Diff extends Command {
for (int i = 0; i < resources.length; i++) {
resources[i].accept(fsVisitor);
}
- }
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ExpandModules.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ExpandModules.java
index 66280a5cf..8d2c135fd 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ExpandModules.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ExpandModules.java
@@ -43,5 +43,4 @@ public class ExpandModules extends Command {
public IStatus execute(Session session, String[] modules, IProgressMonitor monitor) throws CVSException {
return execute(session, NO_GLOBAL_OPTIONS, NO_LOCAL_OPTIONS, modules, null, monitor);
}
-
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java
index 7e2d7fb8a..0d8bd1670 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java
@@ -203,13 +203,11 @@ public class CVSRemoteSyncElement extends RemoteSyncElement {
} else {
// We have conflicting deletions. Clear the sync info
local.setSyncInfo(null);
- local.saveSyncInfo(Policy.monitorFor(monitor));
return;
}
}
info = new ResourceSyncInfo(info.getName(), revision, ResourceSyncInfo.DUMMY_TIMESTAMP, info.getKeywordMode(), local.getParent().getFolderSyncInfo().getTag(), info.getPermissions());
local.setSyncInfo(info);
- local.saveSyncInfo(Policy.monitorFor(monitor));
}
/*
@@ -261,7 +259,6 @@ public class CVSRemoteSyncElement extends RemoteSyncElement {
FolderSyncInfo remoteInfo = remote.getFolderSyncInfo();
FolderSyncInfo localInfo = local.getParent().getFolderSyncInfo();
local.setFolderSyncInfo(new FolderSyncInfo(remoteInfo.getRepository(), remoteInfo.getRoot(), localInfo.getTag(), localInfo.getIsStatic()));
- local.saveSyncInfo(Policy.monitorFor(monitor));
}
/*
* @see ILocalSyncElement#getSyncKind(int, IProgressMonitor)
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 515abf2ec..353a6938e 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
@@ -59,13 +59,14 @@ class EclipseFile extends EclipseResource implements ICVSFile {
try {
IFile file = getIFile();
if(resource.exists()) {
- file.setContents(new ByteArrayInputStream(toByteArray()), true /*force*/, true /*keep history*/, null);
+ file.setContents(new ByteArrayInputStream(toByteArray()), false /*force*/, true /*keep history*/, null);
} else {
- file.create(new ByteArrayInputStream(toByteArray()), true /*force*/, null);
+ file.create(new ByteArrayInputStream(toByteArray()), false /*force*/, null);
}
- super.close();
} catch(CoreException e) {
throw new IOException("Error setting file contents: " + e.getMessage());
+ } finally {
+ super.close();
}
}
};
@@ -80,13 +81,14 @@ class EclipseFile extends EclipseResource implements ICVSFile {
try {
IFile file = getIFile();
if(resource.exists()) {
- file.appendContents(new ByteArrayInputStream(toByteArray()), true /*force*/, true /*keep history*/, null);
+ file.appendContents(new ByteArrayInputStream(toByteArray()), false /*force*/, true /*keep history*/, null);
} else {
- file.create(new ByteArrayInputStream(toByteArray()), true /*force*/, null);
+ file.create(new ByteArrayInputStream(toByteArray()), false /*force*/, null);
}
- super.close();
} catch(CoreException e) {
throw new IOException("Error setting file contents: " + e.getMessage());
+ } finally {
+ super.close();
}
}
};
@@ -116,12 +118,7 @@ class EclipseFile extends EclipseResource implements ICVSFile {
throw new CVSException(Policy.bind("LocalFile.invalidDateFormat", date), e); //$NON-NLS-1$
}
}
- getIOFile().setLastModified(millSec);
- try {
- resource.refreshLocal(IResource.DEPTH_ZERO, null);
- } catch(CoreException e) {
- throw CVSException.wrapException(e);
- }
+ getIOFile().setLastModified(millSec);
}
/*
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 c59aa6eeb..9806a8013 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
@@ -16,11 +16,16 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.team.ccvs.core.*;
-import org.eclipse.team.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.ccvs.core.ICVSFile;
+import org.eclipse.team.ccvs.core.ICVSFolder;
+import org.eclipse.team.ccvs.core.ICVSResource;
+import org.eclipse.team.ccvs.core.ICVSResourceVisitor;
+import org.eclipse.team.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
@@ -240,4 +245,29 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
}
return null;
}
+
+ /*
+ * @see ICVSFolder#run(ICVSRunnable, IProgressMonitor)
+ */
+ public void run(ICVSRunnable job, IProgressMonitor monitor) throws CVSException {
+ monitor = Policy.monitorFor(monitor);
+ try {
+ monitor.beginTask(null, 100);
+ try {
+ EclipseSynchronizer.getInstance().beginOperation(Policy.subMonitorFor(monitor, 5));
+ job.run(Policy.subMonitorFor(monitor, 85));
+ } finally {
+ EclipseSynchronizer.getInstance().endOperation(Policy.subMonitorFor(monitor, 8));
+ try {
+ // this is temporary until core allows setting of timestamp via a
+ // IResource handle
+ resource.refreshLocal(IResource.DEPTH_INFINITE, Policy.subMonitorFor(monitor, 2));
+ } catch(CoreException e) {
+ throw CVSException.wrapException(e);
+ }
+ }
+ } finally {
+ monitor.done();
+ }
+ }
} \ No newline at end of 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 fc5f2b537..0fd4c2db8 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
@@ -118,25 +118,33 @@ abstract class EclipseResource implements ICVSResource {
return false;
}
- // initialize matcher with global ignores and basic CVS ignore patterns
- IIgnoreInfo[] ignorePatterns = TeamPlugin.getManager().getGlobalIgnore();
+ // initialize matcher with global ignores, basic CVS ignore patterns, and ignore patterns
+ // from the .cvsignore file.
FileNameMatcher matcher = new FileNameMatcher(SyncFileUtil.BASIC_IGNORE_PATTERNS);
+ String[] cvsIgnorePatterns;;
+ try {
+ cvsIgnorePatterns = EclipseSynchronizer.getInstance().getIgnored(resource);
+ } catch(CVSException e) {
+ cvsIgnorePatterns = null;
+ }
+ IIgnoreInfo[] ignorePatterns = TeamPlugin.getManager().getGlobalIgnore();
for (int i = 0; i < ignorePatterns.length; i++) {
IIgnoreInfo info = ignorePatterns[i];
if(info.getEnabled()) {
matcher.register(info.getPattern(), "true"); //$NON-NLS-1$
}
}
+ if(cvsIgnorePatterns!=null) {
+ for (int i = 0; i < cvsIgnorePatterns.length; i++) {
+ matcher.register(cvsIgnorePatterns[i], "true");
+ }
+ }
- // 1. check CVS default patterns and global ignores
+ // check against all the registered patterns
boolean ignored = matcher.match(getName());
- // 2. check .cvsignore file
- if(!ignored) {
- ignored = EclipseSynchronizer.getInstance().isIgnored(resource);
- }
-
- // 3. check the parent
+ // check the parent, if the parent is ignored then this resource
+ // is ignored also
if(!ignored) {
ICVSFolder parent = getParent();
if(parent==null) return false;
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
index 56af1502c..6f72d7fce 100644
--- 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
@@ -27,12 +27,15 @@ 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.ccvs.core.ICVSFile;
import org.eclipse.team.ccvs.core.ICVSFolder;
import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
+import org.eclipse.team.internal.ccvs.core.util.Assert;
import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
/**
@@ -43,7 +46,6 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
* 1. how can we expire cache elements and purge to safe memory?
* 2. how can we safeguard against overwritting meta files changes made outside of Eclipse? I'm
* not sure we should force setting file contents in EclipseFile handles?
- * 3. how can we group operations?
* 4. how do we reload
* ]
*
@@ -51,9 +53,16 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
* @see FolderSyncInfo
*/
public class EclipseSynchronizer {
+ // the resources plugin synchronizer is used to cache and possibly persist. These
+ // are keys for storing the sync info.
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 final QualifiedName IGNORE_SYNC_KEY = new QualifiedName(CVSProviderPlugin.ID, "folder-ignore");
+
+ // the cvs eclipse synchronizer is a singleton
private static EclipseSynchronizer instance;
+
+ // track resources that have changed in a given operation
private int nestingCount = 0;
private Set changedResources = new HashSet();
private Set changedFolders = new HashSet();
@@ -61,141 +70,110 @@ public class EclipseSynchronizer {
private EclipseSynchronizer() {
getSynchronizer().add(RESOURCE_SYNC_KEY);
getSynchronizer().add(FOLDER_SYNC_KEY);
+ getSynchronizer().add(IGNORE_SYNC_KEY);
}
public static EclipseSynchronizer getInstance() {
- if (instance == null) {
+ if (instance == null) {
+ ResourcesPlugin.getWorkspace().getSynchronizer().remove(RESOURCE_SYNC_KEY);
+ ResourcesPlugin.getWorkspace().getSynchronizer().remove(FOLDER_SYNC_KEY);
+ ResourcesPlugin.getWorkspace().getSynchronizer().remove(IGNORE_SYNC_KEY);
instance = new EclipseSynchronizer();
}
return instance;
}
- /**
- * 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();
+ try {
+ beginOperation(null);
+ setCachedFolderSync(folder, info);
+ changedFolders.add(folder);
+ } finally {
+ endOperation(null);
+ }
}
- /**
- * 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 = SyncFileWriter.readFolderConfig(CVSWorkspaceRoot.getCVSFolderFor(folder));
- if(info!=null) {
- setCachedFolderSync(folder, info);
- // read the child meta-files also
- getMetaResourceSyncForFolder(folder, null);
+ try {
+ beginOperation(null);
+ if(folder.getType()==IResource.ROOT) return null;
+ FolderSyncInfo info = getCachedFolderSync(folder);
+ if (info == null) {
+ info = SyncFileWriter.readFolderConfig(CVSWorkspaceRoot.getCVSFolderFor(folder));
+ if(info!=null) {
+ setCachedFolderSync(folder, info);
+ // read the child meta-files also
+ getMetaResourceSyncForFolder(folder, null);
+ }
}
+ return info;
+ } finally {
+ endOperation(null);
}
- 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();
+ try {
+ beginOperation(null);
+ setCachedResourceSync(resource, info);
+ changedResources.add(resource);
+ } finally {
+ endOperation(null);
+ }
}
- /**
- * 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) {
- info = getMetaResourceSyncForFolder(resource.getParent(), resource);
+ try {
+ beginOperation(null);
+ if(resource.getType()==IResource.ROOT) return null;
+ ResourceSyncInfo info = getCachedResourceSync(resource);
+ if(info==null) {
+ info = getMetaResourceSyncForFolder(resource.getParent(), resource);
+ }
+ return info;
+ } finally {
+ endOperation(null);
}
- 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();
+ try {
+ beginOperation(null);
+ setCachedFolderSync(folder, null);
+ changedFolders.add(folder);
+ } finally {
+ endOperation(null);
+ }
}
- /**
- * Removes the resource's sync information.
- */
public void deleteResourceSync(IResource resource, IProgressMonitor monitor) throws CVSException {
- beginOperation();
- setCachedResourceSync(resource, null);
- changedResources.add(resource);
- endOperation();
+ try {
+ beginOperation(null);
+ setCachedResourceSync(resource, null);
+ changedResources.add(resource);
+ } finally {
+ endOperation(null);
+ }
}
- /**
- * Answers if the following resource is ignored
- */
- public boolean isIgnored(IResource resource) {
- return false;
+ public String[] getIgnored(IResource resource) throws CVSException {
+ IContainer parent = resource.getParent();
+ if(parent==null || parent.getType()==IResource.ROOT) return null;
+ String[] ignores = getCachedFolderIgnores(parent);
+ if(ignores==null) {
+ ICVSFile ignoreFile = CVSWorkspaceRoot.getCVSFileFor(parent.getFile(new Path(SyncFileWriter.IGNORE_FILE)));
+ if(ignoreFile.exists()) {
+ ignores = SyncFileWriter.readLines(ignoreFile);
+ setCachedFolderIgnores(parent, ignores);
+ }
+ }
+ return ignores;
}
- /**
- * Adds a pattern or file name to be ignored in the current files directory.
- */
public void setIgnored(IResource resource, String pattern) throws CVSException {
+ SyncFileWriter.addCvsIgnoreEntry(CVSWorkspaceRoot.getCVSResourceFor(resource), pattern);
}
-
- /**
- * 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 {
// initialize cache if needed, this will create phantoms
@@ -217,48 +195,58 @@ public class EclipseSynchronizer {
}
}
- public void beginOperation() throws CVSException {
+ public void beginOperation(IProgressMonitor monitor) throws CVSException {
if (nestingCount++ == 0) {
- // any work here?
- }
+ // any work here?
+ }
}
- public void endOperation() throws CVSException {
- if (--nestingCount == 0) {
+ public void endOperation(IProgressMonitor monitor) 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);
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(folder);
- if (info != null) {
- SyncFileWriter.writeFolderConfig(cvsFolder, info);
- } else {
- SyncFileWriter.deleteFolderSync(cvsFolder);
+ try {
+ monitor = Policy.monitorFor(monitor);
+ int numResources = changedFolders.size() + changedResources.size();
+ monitor.beginTask("Updating CVS synchronization information...", numResources);
+ // write sync info to disk
+ Iterator it = changedFolders.iterator();
+ while (it.hasNext()) {
+ IContainer folder = (IContainer) it.next();
+ FolderSyncInfo info = getCachedFolderSync(folder);
+ ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(folder);
+ if (info != null) {
+ SyncFileWriter.writeFolderConfig(cvsFolder, info);
+ } else {
+ SyncFileWriter.deleteFolderSync(cvsFolder);
+ }
+ monitor.worked(1);
}
- }
- it = changedResources.iterator();
- while (it.hasNext()) {
- IResource resource = (IResource) it.next();
- ResourceSyncInfo info = getCachedResourceSync(resource);
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (info != null) {
- SyncFileWriter.writeResourceSync(cvsResource, info);
- } else {
- SyncFileWriter.deleteSync(cvsResource);
+ it = changedResources.iterator();
+ while (it.hasNext()) {
+ IResource resource = (IResource) it.next();
+ ResourceSyncInfo info = getCachedResourceSync(resource);
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if (info != null) {
+ SyncFileWriter.writeResourceSync(cvsResource, info);
+ } else {
+ SyncFileWriter.deleteSync(cvsResource);
+ }
+ monitor.worked(1);
}
+
+ // broadcast events
+ changedResources.addAll(changedFolders);
+ IResource[] resources = (IResource[]) changedResources.toArray(
+ new IResource[changedResources.size()]);
+ TeamPlugin.getManager().broadcastResourceStateChanges(resources);
+ changedResources.clear();
+ changedFolders.clear();
+ } finally {
+ monitor.done();
}
-
- // broadcast events
- changedResources.addAll(changedFolders);
- changedFolders.clear();
- IResource[] resources = (IResource[]) changedResources.toArray(
- new IResource[changedResources.size()]);
- TeamPlugin.getManager().broadcastResourceStateChanges(resources);
- changedResources.clear();
}
}
+ Assert.isTrue(nestingCount>= 0);
}
private static ISynchronizer getSynchronizer() {
@@ -338,6 +326,47 @@ public class EclipseSynchronizer {
}
}
+ private String[] getCachedFolderIgnores(IContainer folder) throws CVSException {
+ try {
+ byte[] bytes = getSynchronizer().getSyncInfo(IGNORE_SYNC_KEY, folder);
+ if(bytes==null) {
+ return null;
+ }
+ DataInputStream is = new DataInputStream(new ByteArrayInputStream(bytes));
+ int count = is.readInt();
+ String[] ignoreList = new String[count];
+ for(int i = 0; i < count; ++i) {
+ ignoreList[i] = is.readUTF();
+ }
+ return ignoreList;
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ } catch(IOException e) {
+ throw CVSException.wrapException(e);
+ }
+ }
+
+ private void setCachedFolderIgnores(IContainer folder, String[] ignores) throws CVSException {
+ try {
+ if(ignores==null || ignores.length==0) {
+ getSynchronizer().flushSyncInfo(IGNORE_SYNC_KEY, folder, IResource.DEPTH_ZERO);
+ } else {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ DataOutputStream os = new DataOutputStream(bos);
+ os.writeInt(ignores.length);
+ for(int i = 0; i < ignores.length; ++i) {
+ os.writeUTF(ignores[i]);
+ }
+ getSynchronizer().setSyncInfo(IGNORE_SYNC_KEY, folder, bos.toByteArray());
+ os.close();
+ }
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ } catch(IOException e) {
+ throw CVSException.wrapException(e);
+ }
+ }
+
/*
* Reads and caches the ResourceSyncInfos for this folder. If target is non-null, then
* returns the ResourceSync for this resource is it is found.
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/ICVSSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/ICVSSynchronizer.java
deleted file mode 100644
index 7ed3120be..000000000
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/ICVSSynchronizer.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.team.internal.ccvs.core.resources;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.File;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.syncinfo.*;
-
-/**
- * A synchronizer is responsible for managing synchronization information for local
- * CVS resources.
- *
- * @see ResourceSyncInfo
- * @see FolderSyncInfo
- */
-public interface ICVSSynchronizer {
-
- /**
- * 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(File folder, FolderSyncInfo info) throws CVSException;
-
- /**
- * 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(File file) throws CVSException;
-
- /**
- * 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(File file, ResourceSyncInfo info) throws CVSException;
-
- /**
- * 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(File file) throws CVSException;
-
- /**
- * Removes the folder's and all children's folder sync information. This will essentially remove
- * all CVS knowledge from these resources.
- */
- public void deleteFolderSync(File file, IProgressMonitor monitor) throws CVSException;
-
- /**
- * Removes the resource's sync information.
- */
- public void deleteResourceSync(File file) throws CVSException;
-
- /**
- * Answers if the following resource is ignored
- */
- public boolean isIgnored(File file);
-
- /**
- * Adds a pattern or file name to be ignored in the current files directory.
- */
- public void setIgnored(File file, String pattern) throws CVSException;
-
- /**
- * Allows the synchronizer to update the workspace with changes made by an 3rd
- * party tool to the sync info.
- */
- public void reload(File file, IProgressMonitor monitor) throws CVSException;
-
- /**
- * Call to allow the synchronizer to save any pending or buffered changes and dispatch
- * state change notifications.
- */
- public void save(File file, IProgressMonitor monitor) throws CVSException;
-
- /**
- * 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 ResourceSyncInfo[] members(File folder) throws CVSException;
-
- /**
- * XXX: Should be removed. Currently only used by tests and instead the tests should be
- * created for the different types of concrete sync classes.
- */
- public boolean isEmpty();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
index 6fc3a6b70..ce5f6fb7d 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
@@ -23,6 +23,7 @@ import org.eclipse.team.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.ccvs.core.ICVSRunnable;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -603,4 +604,11 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
children = oldChildren;
}
}
+
+ /*
+ * @see ICVSFolder#run(ICVSRunnable, IProgressMonitor)
+ */
+ public void run(ICVSRunnable job, IProgressMonitor monitor) throws CVSException {
+ job.run(monitor);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
index b186d6202..73cf779d3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
@@ -38,7 +38,6 @@ import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.omg.CORBA.UNKNOWN;
/*
* This class is responsible for building a remote tree that shows the repository
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 3869cc27d..996116153 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,6 @@ public class OrphanedFolderListener extends ResourceDeltaVisitor {
ICVSFolder mFolder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(resource);
if (mFolder.isCVSFolder() && ! mFolder.isManaged() && mFolder.getParent().isCVSFolder()) {
mFolder.unmanage();
- mFolder.reloadSyncInfo(Policy.monitorFor(null));
}
} catch (CVSException e) {
CVSProviderPlugin.log(e);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
index 3fe345b84..3bd908695 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
@@ -308,11 +308,11 @@ public class SyncFileWriter {
}
}
- public static void addCvsIgnoreEntry(ICVSFile file, String pattern) throws CVSException {
+ public static void addCvsIgnoreEntry(ICVSResource resource, String pattern) throws CVSException {
OutputStream out = null;
try {
- ICVSFile cvsignore = file.getParent().getFile(IGNORE_FILE);
- String line = pattern == null ? file.getName() : pattern;
+ ICVSFile cvsignore = resource.getParent().getFile(IGNORE_FILE);
+ String line = pattern == null ? resource.getName() : pattern;
line += "\n"; //$NON-NLS-1$
out = cvsignore.getAppendingOutputStream();
out.write(line.getBytes());
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
index 484494de9..25ab25ef3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
@@ -10,65 +10,72 @@ import java.util.Map;
public class CVSDecoration {
- private String format;
- private Map bindings;
- private List overlays;
+ private String format;
+ private Map bindings;
+ private List overlays;
- /* package */ CVSDecoration() {
- this(null, null, null);
- }
+ /* package */ CVSDecoration() {
+ this(null, null, null);
+ }
- /* package */ CVSDecoration(String format, Map bindings, List overlays) {
- setFormat(format);
- setBindings(bindings);
- setOverlays(overlays);
- }
-
- /**
- * Gets the overlays.
- * @return Returns a List
- */
- public List getOverlays() {
- return overlays;
- }
+ /* package */ CVSDecoration(String format, Map bindings, List overlays) {
+ setFormat(format);
+ setBindings(bindings);
+ setOverlays(overlays);
+ }
+
+ public int hashCode() {
+ return overlays.hashCode();
+ }
+ public boolean equals(Object o) {
+ if (!(o instanceof CVSDecoration)) return false;
+ return overlays.equals(((CVSDecoration)o).overlays);
+ }
+ /**
+ * Gets the overlays.
+ * @return Returns a List
+ */
+ public List getOverlays() {
+ return overlays;
+ }
- /**
- * Sets the overlays.
- * @param overlays The overlays to set
- */
- public void setOverlays(List overlays) {
- this.overlays = overlays;
- }
+ /**
+ * Sets the overlays.
+ * @param overlays The overlays to set
+ */
+ public void setOverlays(List overlays) {
+ this.overlays = overlays;
+ }
- /**
- * Gets the substitutions.
- * @return Returns a String[]
- */
- public Map getBindins() {
- return bindings;
- }
+ /**
+ * Gets the substitutions.
+ * @return Returns a String[]
+ */
+ public Map getBindings() {
+ return bindings;
+ }
- /**
- * Sets the substitutions.
- * @param substitutions The substitutions to set
- */
- public void setBindings(Map bindings) {
- this.bindings = bindings;
- }
+ /**
+ * Sets the substitutions.
+ * @param substitutions The substitutions to set
+ */
+ public void setBindings(Map bindings) {
+ this.bindings = bindings;
+ }
- /**
- * Gets the textBinding.
- * @return Returns a String
- */
- public String getFormat() {
- return format;
- }
+ /**
+ * Gets the textBinding.
+ * @return Returns a String
+ */
+ public String getFormat() {
+ return format;
+ }
- /**
- * Sets the textBinding.
- * @param textBinding The textBinding to set
- */
- public void setFormat(String format) {
- this.format = format;
- }
+ /**
+ * Sets the textBinding.
+ * @param textBinding The textBinding to set
+ */
+ public void setFormat(String format) {
+ this.format = format;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
index bf52fc4cd..0e672e95f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
@@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -63,6 +64,8 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
private boolean shutdown = false;
+ private Hashtable imageCache = new Hashtable();
+
public CVSDecorator() {
// The decorator is a singleton, there should never be more than one instance.
// temporary until the UI component properly calls dispose when the workbench shutsdown
@@ -89,7 +92,7 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
if (format == null) {
return text;
} else {
- Map bindings = decoration.getBindins();
+ Map bindings = decoration.getBindings();
if (bindings.isEmpty())
return text;
bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, text);
@@ -112,13 +115,31 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
if (decoration != null) {
List overlays = decoration.getOverlays();
- return overlays == null ? image : new OverlayIcon(image.getImageData(), new ImageDescriptor[][] {(ImageDescriptor[]) overlays.toArray(new ImageDescriptor[overlays.size()])}, new Point(16, 16)).createImage();
+ return overlays == null ? image : getCachedImage(image, overlays);
} else {
addResourcesToBeDecorated(new IResource[] { resource });
return image;
}
}
+ /**
+ * Get the composite image for the given image and overlays. Return one from the cache if
+ * it exists. If not, create it, cache it, and return it.
+ */
+ private Image getCachedImage(Image image, List overlays) {
+ Hashtable overlayTable = (Hashtable)imageCache.get(image);
+ if (overlayTable == null) {
+ overlayTable = new Hashtable();
+ imageCache.put(image, overlayTable);
+ }
+ Image cachedImage = (Image)overlayTable.get(overlays);
+ if (cachedImage == null) {
+ cachedImage = new OverlayIcon(image.getImageData(), new ImageDescriptor[][] {(ImageDescriptor[])overlays.toArray(new ImageDescriptor[overlays.size()])}, new Point(16, 16)).createImage();
+ overlayTable.put(overlays, cachedImage);
+ }
+ return cachedImage;
+ }
+
/*
* @see IDecorationNotifier#next()
*/
@@ -333,6 +354,15 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
decoratorNeedsUpdating.clear();
cache.clear();
+ Iterator it = imageCache.values().iterator();
+ while (it.hasNext()) {
+ Hashtable overlayTable = (Hashtable)it.next();
+ Iterator it2 = overlayTable.values().iterator();
+ while (it2.hasNext()) {
+ ((Image)it2.next()).dispose();
+ }
+ }
+ imageCache = new Hashtable();
theDecorator = null;
}
} \ No newline at end of file
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 22277d48c..2f08cec9a 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
@@ -45,10 +45,11 @@ public class BranchAction extends TeamAction {
if (resources.length == 0) return false;
ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
+ IResource resource = resources[i];
+ ITeamProvider provider = manager.getProvider(resource.getProject());
if (provider == null) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- if (!cvsResource.isManaged()) return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if (resource.getType()!=IResource.PROJECT&&!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 0505aa9d8..c73ed7edb 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
@@ -54,10 +54,11 @@ public class CommitAction extends TeamAction {
if (resources.length == 0) return false;
ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
+ IResource resource = resources[i];
+ ITeamProvider provider = manager.getProvider(resource.getProject());
if (provider == null) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- if (!cvsResource.isManaged()) return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if (resource.getType()!=IResource.PROJECT&&!cvsResource.isManaged()) return false;
}
return true;
}
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 cb87f0890..e14c0abd0 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
@@ -80,10 +80,11 @@ public class TagAction extends TeamAction {
if (resources.length == 0) return false;
ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
+ IResource resource = resources[i];
+ ITeamProvider provider = manager.getProvider(resource.getProject());
if (provider == null) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- if (!cvsResource.isManaged()) return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if (resource.getType()!=IResource.PROJECT&&!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 7bd43f984..24e567cba 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
@@ -150,7 +150,6 @@ public class UnmanageAction extends TeamAction {
ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer) resource);
if(deleteContent) {
folder.unmanage();
- folder.reloadSyncInfo(Policy.subMonitorFor(subMonitor, 90));
}
TeamPlugin.getManager().removeProvider((IProject)resource, Policy.subMonitorFor(subMonitor, 10));
CVSDecorator.refresh(resource);
@@ -190,8 +189,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;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- if (!cvsResource.isManaged()) return false;
+ ICVSFolder project = CVSWorkspaceRoot.getCVSFolderFor((IContainer)resources[i]);
+ if (!project.isCVSFolder()) 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 9a11671f2..4561c7e0b 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
@@ -71,10 +71,11 @@ public class UpdateAction extends TeamAction {
if (resources.length == 0) return false;
ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
+ IResource resource = resources[i];
+ ITeamProvider provider = manager.getProvider(resource.getProject());
if (provider == null) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- if (!cvsResource.isManaged()) return false;
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if (resource.getType()!=IResource.PROJECT&&!cvsResource.isManaged()) return false;
}
return true;
}

Back to the top