Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2006-01-11 21:29:34 +0000
committerMichael Valenta2006-01-11 21:29:34 +0000
commit1de3b94bac29f6430595eba3bd248269b4002f32 (patch)
tree25968bf2a84ee4f45d3e07f9ef98a2e84df27db5
parentf7d398b3668732ed42d4de58fb198137b8cc52e0 (diff)
downloadeclipse.platform.team-1de3b94bac29f6430595eba3bd248269b4002f32.tar.gz
eclipse.platform.team-1de3b94bac29f6430595eba3bd248269b4002f32.tar.xz
eclipse.platform.team-1de3b94bac29f6430595eba3bd248269b4002f32.zip
Bug 105077 Need a CVSLightweightDecorator.isDirty(ResourceMapping)
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java43
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java11
3 files changed, 64 insertions, 2 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
index ba96ef548..486557bb8 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.jobs.ILock;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.history.IFileHistoryProvider;
+import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.internal.core.*;
/**
@@ -795,4 +796,15 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
public IResourceRuleFactory getRuleFactory() {
return new PessimisticResourceRuleFactory();
}
+
+ /**
+ * Return a {@link Subscriber} that describes the synchronization state
+ * of the resources contained in the project associated with this
+ * provider. By default, <code>null</code> is returned. Subclasses
+ * may override.
+ * @return a subscriber that provides resource synchronization state or <code>null</code>
+ */
+ public Subscriber getSubscriber() {
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java
index 8fd528113..4aa027bd3 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java
@@ -18,8 +18,7 @@ import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.*;
-import org.eclipse.team.core.diff.IDiffNode;
-import org.eclipse.team.core.diff.IDiffVisitor;
+import org.eclipse.team.core.diff.*;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.core.variants.IResourceVariantComparator;
@@ -435,4 +434,44 @@ abstract public class Subscriber {
}
monitor.done();
}
+
+ /**
+ * Convenience method that returns whether there are any local changes covered
+ * by the given traversals. Clients could also get this information by visiting
+ * the diffs returned from the subscriber but this method is provided so that sublcasses
+ * have any opportunity to optimize this check for clients who are only looking for
+ * local changes. Locla changes can only exist if the subscriber is three-way
+ * <p>
+ * The default implementation uses the {@link #accept(ResourceTraversal[], IDiffVisitor)}
+ * method to look for local changes. Subclasses may override.
+ * </p>
+ * @since 3.2
+ * @param traversals the resource traversals
+ * @param monitor a progress monitor
+ * @return whether there are any local changes covered
+ * by the given traversals
+ * @throws CoreException if errors occur
+ */
+ public boolean hasLocalChanges(ResourceTraversal[] traversals, IProgressMonitor monitor) throws CoreException {
+ if (getResourceComparator().isThreeWay()) {
+ final CoreException found = new CoreException(Status.OK_STATUS);
+ try {
+ accept(traversals, new IDiffVisitor() {
+ public boolean visit(IDiffNode delta) throws CoreException {
+ if (delta instanceof IThreeWayDiff) {
+ IThreeWayDiff twd = (IThreeWayDiff) delta;
+ if (twd.getLocalChange() != null && twd.getLocalChange().getKind() != IDiffNode.NO_CHANGE) {
+ throw found;
+ }
+ }
+ return true;
+ }
+ });
+ } catch (CoreException e) {
+ if (e == found)
+ return true;
+ }
+ }
+ return false;
+ }
}
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 8afef5ba9..7f6abd185 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
@@ -24,6 +24,7 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.history.IFileHistoryProvider;
+import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.internal.ccvs.core.client.*;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
@@ -836,10 +837,20 @@ public class CVSTeamProvider extends RepositoryProvider {
return RESOURCE_RULE_FACTORY;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.RepositoryProvider#getFileHistoryProvider()
+ */
public IFileHistoryProvider getFileHistoryProvider() {
if (CVSTeamProvider.fileHistoryProvider == null) {
CVSTeamProvider.fileHistoryProvider = new CVSFileHistoryProvider();
}
return CVSTeamProvider.fileHistoryProvider;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.RepositoryProvider#getSubscriber()
+ */
+ public Subscriber getSubscriber() {
+ return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
+ }
}

Back to the top