Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2006-01-24 21:01:06 +0000
committerMichael Valenta2006-01-24 21:01:06 +0000
commite94d3998c0224b39c9497c0f8b56801b99b87c03 (patch)
tree7af6f0601546dcb7029e8c2717f2d3aa238d9208
parent952f3078ff5ea1cd2f34f98ab94a1b4522556777 (diff)
downloadeclipse.platform.team-e94d3998c0224b39c9497c0f8b56801b99b87c03.tar.gz
eclipse.platform.team-e94d3998c0224b39c9497c0f8b56801b99b87c03.tar.xz
eclipse.platform.team-e94d3998c0224b39c9497c0f8b56801b99b87c03.zip
Modified model update to cache contents and clean timestamps on refresh
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractModelMergeOperation.java25
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSResourceMappingParticipant.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeOperation.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java4
8 files changed, 52 insertions, 40 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractModelMergeOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractModelMergeOperation.java
index 2c7addc01..797a03f2c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractModelMergeOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractModelMergeOperation.java
@@ -10,16 +10,10 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.mappings;
-import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.mapping.IMergeContext;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.CacheBaseContentsOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.CacheRemoteContentsOperation;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.ui.operations.ResourceMappingMergeOperation;
import org.eclipse.ui.IWorkbenchPart;
@@ -38,21 +32,6 @@ public abstract class AbstractModelMergeOperation extends ResourceMappingMergeOp
protected ResourceMappingContext getResourceMappingContext() {;
return context;
}
-
- protected void cacheContents(IWorkbenchPart part, IMergeContext context, IProgressMonitor monitor) throws CVSException {
- // cache the base and remote contents
- // TODO: Refreshing and caching now takes 3 round trips.
- // OPTIMIZE: remote state and contents could be obtained in 1
- // OPTIMIZE: Based could be avoided if we always cached base locally
- try {
- new CacheBaseContentsOperation(part, context.getScope().getMappings(), context.getDiffTree(), true).run(Policy.subMonitorFor(monitor, 25));
- new CacheRemoteContentsOperation(part, context.getScope().getMappings(), context.getDiffTree()).run(Policy.subMonitorFor(monitor, 25));
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Ignore
- }
- }
/* (non-Javadoc)
* @see org.eclipse.team.ui.TeamOperation#canRunAsJob()
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSResourceMappingParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSResourceMappingParticipant.java
index 5faf5c867..a4f1679dc 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSResourceMappingParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSResourceMappingParticipant.java
@@ -89,11 +89,6 @@ public class CVSResourceMappingParticipant extends
CONTEXT_MENU_CONTRIBUTION_GROUP_3,
new CVSActionDelegateWrapper(new SetKeywordSubstitutionAction(), configuration));
}
- //TODO: needs to be converted
-// appendToGroup(
-// ISynchronizePageConfiguration.P_CONTEXT_MENU,
-// CONTEXT_MENU_CONTRIBUTION_GROUP_4,
-// new RefreshDirtyStateAction(configuration));
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeOperation.java
index 5d2a502a2..67386692d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeOperation.java
@@ -33,7 +33,6 @@ public class ModelMergeOperation extends AbstractModelMergeOperation {
throws CoreException {
monitor.beginTask(null, 100);
IMergeContext context = MergeSubscriberContext.createContext(getScope(), subscriber, Policy.subMonitorFor(monitor, 50));
- cacheContents(getPart(), context, monitor);
monitor.done();
return context;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java
index 32ac20a87..09b1d60ac 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java
@@ -50,7 +50,6 @@ public class ModelUpdateOperation extends AbstractModelMergeOperation {
protected IMergeContext buildMergeContext(IProgressMonitor monitor) throws CoreException {
monitor.beginTask(null, 100);
IMergeContext context = WorkspaceSubscriberContext.createContext(getScope(), true /* refresh */, getMergeType(), Policy.subMonitorFor(monitor, 50));
- cacheContents(getPart(), context, Policy.subMonitorFor(monitor, 40));
monitor.done();
return context;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
index 3896dc137..ac7965e33 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
@@ -10,8 +10,10 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.mappings;
+import java.lang.reflect.InvocationTargetException;
+
import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
+import org.eclipse.core.resources.mapping.*;
import org.eclipse.core.runtime.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.diff.IDiffNode;
@@ -29,6 +31,8 @@ import org.eclipse.team.internal.ccvs.core.client.PruneFolderVisitor;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.operations.CacheBaseContentsOperation;
+import org.eclipse.team.internal.ccvs.ui.operations.CacheRemoteContentsOperation;
import org.eclipse.team.internal.core.mapping.CompoundResourceTraversal;
public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext {
@@ -157,7 +161,8 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext {
* @see org.eclipse.team.core.subscribers.SubscriberMergeContext#refresh(org.eclipse.core.resources.mapping.ResourceTraversal[], int, org.eclipse.core.runtime.IProgressMonitor)
*/
public void refresh(ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException {
- super.refresh(traversals, flags, monitor);
+ monitor.beginTask(null, 50);
+ super.refresh(traversals, flags, Policy.subMonitorFor(monitor, 25));
// Prune any empty folders within the traversals
if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories()) {
CompoundResourceTraversal ct = new CompoundResourceTraversal();
@@ -171,5 +176,36 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext {
CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot()),
cvsResources);
}
+ cacheContents(traversals, Policy.subMonitorFor(monitor, 25));
+ monitor.done();
+ }
+
+ protected void cacheContents(final ResourceTraversal[] traversals, IProgressMonitor monitor) throws CVSException {
+ // cache the base and remote contents
+ // TODO: Refreshing and caching now takes 3 round trips.
+ // OPTIMIZE: remote state and contents could be obtained in 1
+ // OPTIMIZE: Based could be avoided if we always cached base locally
+ ResourceMapping[] mappings = new ResourceMapping[] { new ResourceMapping() {
+ public Object getModelObject() {
+ return WorkspaceSubscriberContext.this;
+ }
+ public IProject[] getProjects() {
+ return ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ }
+ public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
+ return traversals;
+ }
+ }};
+ try {
+ monitor.beginTask(null, 50);
+ new CacheBaseContentsOperation(null, mappings, getDiffTree(), true).run(Policy.subMonitorFor(monitor, 25));
+ new CacheRemoteContentsOperation(null, mappings, getDiffTree()).run(Policy.subMonitorFor(monitor, 25));
+ } catch (InvocationTargetException e) {
+ throw CVSException.wrapException(e);
+ } catch (InterruptedException e) {
+ // Ignore
+ } finally {
+ monitor.done();
+ }
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
index 0f566455a..6d9245701 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
@@ -38,8 +38,8 @@ public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
private final boolean includeOutgoing;
- public CacheBaseContentsOperation(IWorkbenchPart part, ResourceMapping[] mappers, IResourceDiffTree tree, boolean includeOutgoing) {
- super(part, mappers, tree);
+ public CacheBaseContentsOperation(IWorkbenchPart part, ResourceMapping[] mappings, IResourceDiffTree tree, boolean includeOutgoing) {
+ super(part, mappings, tree);
this.includeOutgoing = includeOutgoing;
}
@@ -73,7 +73,7 @@ public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
super.execute(provider, resources, recurse, monitor);
// Now that the contents are cached, reset the timestamps for any false local changes
if (localChanges.length > 0) {
- performCleanTimestampa(localChanges[0].getProject(), localChanges, monitor);
+ performCleanTimestamps(localChanges[0].getProject(), localChanges, monitor);
}
}
@@ -101,7 +101,7 @@ public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
return false;
}
- private void performCleanTimestampa(IProject project, final IResource[] resources, IProgressMonitor monitor) throws CVSException {
+ private void performCleanTimestamps(IProject project, final IResource[] resources, IProgressMonitor monitor) throws CVSException {
ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
final ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false);
folder.run(new ICVSRunnable() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
index 41de654e1..c4a3097bd 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
@@ -41,8 +41,8 @@ public abstract class CacheTreeContentsOperation extends SingleCommandOperation
private final IResourceDiffTree tree;
- public CacheTreeContentsOperation(IWorkbenchPart part, ResourceMapping[] mappers, IResourceDiffTree tree) {
- super(part, mappers, Command.NO_LOCAL_OPTIONS);
+ public CacheTreeContentsOperation(IWorkbenchPart part, ResourceMapping[] mappings, IResourceDiffTree tree) {
+ super(part, mappings, Command.NO_LOCAL_OPTIONS);
this.tree = tree;
}
@@ -176,6 +176,10 @@ public abstract class CacheTreeContentsOperation extends SingleCommandOperation
return CVSUIMessages.CacheTreeContentsOperation_1;
}
+ /**
+ * Return the diff tree whose contents are being cached
+ * @return
+ */
protected IResourceDiffTree getTree() {
return tree;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java
index 731ddee0c..870da83fa 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java
@@ -24,8 +24,8 @@ public abstract class SingleCommandOperation extends RepositoryProviderOperation
private LocalOption[] options = Command.NO_LOCAL_OPTIONS;
- public SingleCommandOperation(IWorkbenchPart part, ResourceMapping[] mappers, LocalOption[] options) {
- super(part, mappers);
+ public SingleCommandOperation(IWorkbenchPart part, ResourceMapping[] mappings, LocalOption[] options) {
+ super(part, mappings);
if (options != null) {
this.options = options;
}

Back to the top