Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-01-13 18:46:34 +0000
committerMichael Valenta2004-01-13 18:46:34 +0000
commit9502ce8f655fe8ba9cc749de1d61df4ff2803b59 (patch)
tree5ecd079bf09d94fd4a028c980fa48d8e09c5e9cc
parent6deed80d2f068dac87a8a8a8d26179db1fbaecb1 (diff)
downloadeclipse.platform.team-9502ce8f655fe8ba9cc749de1d61df4ff2803b59.tar.gz
eclipse.platform.team-9502ce8f655fe8ba9cc749de1d61df4ff2803b59.tar.xz
eclipse.platform.team-9502ce8f655fe8ba9cc749de1d61df4ff2803b59.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.core/.project1
-rw-r--r--bundles/org.eclipse.team.core/plugin.properties4
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml1
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/DeploymentProvider.java94
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IDeploymentProviderManager.java94
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IMemento.java169
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java25
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java50
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java116
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java13
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberResource.java70
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteContentsCache.java (renamed from bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCache.java)2
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteContentsCacheEntry.java (renamed from bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCacheEntry.java)14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteSynchronizer.java63
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java43
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java20
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriberSyncInfoCollector.java16
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/DescendantSynchronizationCache.java127
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SyncTreeSubscriber.java99
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationCache.java107
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationCacheRefreshOperation.java272
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationSyncBytesCache.java (renamed from bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteBytesSynchronizer.java)76
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java13
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DeploymentProviderManager.java353
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Sorter.java67
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/XMLMemento.java407
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderDescriptor.java80
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderRegistry.java56
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/RegistryReader.java144
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java71
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSyncInfo.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java13
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java12
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java174
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java111
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java10
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java10
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java55
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java30
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaseSynchronizer.java94
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSBaseSynchronizationCache.java56
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSDescendantSynchronizationCache.java62
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSRefreshOperation.java110
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSRemoteSynchronizer.java93
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSSynchronizationCache.java52
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/MergedSynchronizer.java49
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/OptimizedRemoteSynchronizer.java84
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteResourceFactory.java21
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java257
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.project1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java33
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java97
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/OverrideUpdateMergeAction.java67
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java157
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateWithForcedJoinAction.java96
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ICVSRunnableContext.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java143
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java253
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareUnsharedInput.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java46
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java366
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceUpdateSyncAction.java51
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/IgnoreAction.java134
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java369
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java430
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java84
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/JobBusyCursor.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java43
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoDiffNode.java77
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNode.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java6
-rw-r--r--examples/org.eclipse.team.examples.filesystem/plugin.xml59
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java5
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java1
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java1
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/SimpleAccessOperations.java267
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/DeployAction.java48
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/FileSystemDeploymentProvider.java55
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/NullAction.java42
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/UnDeployAction.java54
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00007.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00009.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00011.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00013.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00016.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00018.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00019.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00021.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00022.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00023.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00024.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00025.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00026.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00027.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00028.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00029.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00029a.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00030.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00030a.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00031.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00032.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch28
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java25
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java25
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java10
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java19
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java46
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java9
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java6
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java6
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java8
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java32
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CVSUITestCase.java150
130 files changed, 3640 insertions, 3863 deletions
diff --git a/bundles/org.eclipse.team.core/.project b/bundles/org.eclipse.team.core/.project
index 748544e0d..693d30d67 100644
--- a/bundles/org.eclipse.team.core/.project
+++ b/bundles/org.eclipse.team.core/.project
@@ -3,7 +3,6 @@
<name>org.eclipse.team.core</name>
<comment></comment>
<projects>
- <project>org.eclipse.core.boot</project>
<project>org.eclipse.core.resources</project>
<project>org.eclipse.core.runtime</project>
<project>org.eclipse.core.runtime.compatibility</project>
diff --git a/bundles/org.eclipse.team.core/plugin.properties b/bundles/org.eclipse.team.core/plugin.properties
index 60289eeda..2f89eff07 100644
--- a/bundles/org.eclipse.team.core/plugin.properties
+++ b/bundles/org.eclipse.team.core/plugin.properties
@@ -14,5 +14,5 @@ FileTypesRegistry=File Types Registry
GlobalIgnoreRegistry=Global Ignore Registry
TeamProjectSets=Team Project Sets
Targets=Target Provider and Location Factories
-Repository=Repository Provider Factories
-Subscriber=Sync Tree Subscriber Factories \ No newline at end of file
+Repository=Repository Providers
+Deployment=Deployment Providers \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index 9a9f09c2b..bcde56282 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -24,6 +24,7 @@
<extension-point id="ignore" name="%GlobalIgnoreRegistry" schema="schema/ignore.exsd"/>
<extension-point id="projectSets" name="%TeamProjectSets" schema="schema/projectSets.exsd"/>
<extension-point id="repository" name="%Repository" schema="schema/repository.exsd"/>
+ <extension-point id="deployment" name="%Deployment" schema="schema/deployment.exsd"/>
<extension-point id="subscriber" name="%Subscriber"/>
<!-- Define common known file types -->
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DeploymentProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DeploymentProvider.java
new file mode 100644
index 000000000..aa6bae1a5
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DeploymentProvider.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.core;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.internal.core.registry.DeploymentProviderDescriptor;
+
+/**
+ * A deployment provider allows synchronization of workspace resources with a remote location. At a minimum
+ * it allows pushing resources in the workspace to a remote location and pulling resources from a
+ * remote location into the workspace.
+ * <p>
+ * The difference between a deployment provider and repository provider is the following:
+ * <ul>
+ * <li>a deployment provider doesn't have full control of workspace resources whereas the repository
+ * provider can hook into the IMoveDeleteHook and IFileModificationValidator.
+ * <li>multiple deployment providers can be mapped to the same folder whereas there is only one
+ * repository provider per project.
+ * <li>a deployment provider can be mapped to any folder as long as the mapping is not overlapping
+ * whereas the repository provider must be mapped at the project.
+ * </ul>
+ * </p>
+ * @see RepositoryProvider
+ * @see IDeploymentProviderManager
+ * @since 3.0
+ */
+public abstract class DeploymentProvider implements IExecutableExtension, IAdaptable {
+
+ private String id;
+ private IContainer container;
+ private String name;
+
+ public String getID() {
+ return id;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public IContainer getMappedContainer() {
+ return this.container;
+ }
+
+ abstract public void init();
+
+ abstract public void dispose();
+
+ public void setContainer(IContainer container) {
+ this.container = container;
+ }
+
+ abstract public void saveState(IMemento memento);
+
+ abstract public void restoreState(IMemento memento);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ */
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ // TODO: This doesn't work well since the Provider is created programmatically
+ // when initially mapped
+ this.id = config.getAttribute(DeploymentProviderDescriptor.ATT_ID);
+ this.name = config.getAttribute(DeploymentProviderDescriptor.ATT_NAME);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ /**
+ * Returns whether a resource can be mapped to multiple deployment providers
+ * of this type. Even if this method returns <code>false</code>, a resource can
+ * still be mapped to multiple providers whose id differs. By default,
+ * multiple mappings are not supported. Subclasses must override this method
+ * to change this behavior.
+ * @return whether multiple mappings to providers of this type are supported
+ */
+ public boolean isMultipleMappingsSupported() {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IDeploymentProviderManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IDeploymentProviderManager.java
new file mode 100644
index 000000000..6591e1c46
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IDeploymentProviderManager.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.core;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+
+/**
+ * Manages deployment providers. Clients can programatically map and unmap deployment
+ * providers to containers.
+ * <p>
+ * Clients are not intended to implement this interface.
+ * </p>
+ * @see RepositoryProvider
+ * @see DeploymentProvider
+ * @since 3.0
+ */
+public interface IDeploymentProviderManager {
+ /**
+ * Maps a container to the the given provider. Mappings are persisted across
+ * workbench sessions.
+ *
+ * @param container the container to be mapped to the given provider
+ * @param provider the provider to be mapped to the container
+ * @throws TeamException
+ */
+ public void map(IContainer container, DeploymentProvider provider) throws TeamException;
+
+ /**
+ * Unmaps the given provider from the container.
+ *
+ * @param container the container to be unmapped from the given provider
+ * @param provider the provider to unmap from the container
+ * @throws TeamException
+ */
+ public void unmap(IContainer container, DeploymentProvider provider) throws TeamException;
+
+ /**
+ * Returns the providers associated with the given resource. This loads the providers
+ * if not already loaded, and can be long running. To check the existance of
+ * a particular mapping call {@link #getMappedTo(IResource, String)} instead.
+ * This method returns an empty array if there are no mappings.
+ *
+ * @param resource the resource whose mappings are to be retreived
+ * @return the mappings for the resource
+ */
+ public DeploymentProvider[] getMappings(IResource resource);
+
+ /**
+ * Returns the providers with the given id associated with the given resource.
+ * This loads the providers if not already loaded, and can be long running.
+ * To check the existance of a particular mapping call
+ * {@link #getMappedTo(IResource, String)} instead.
+ * This method returns an empty array if there are no mappings. This method will
+ * only return either an empty array or an array of length 1 if the provider
+ * of the given type does not support multiple mappings
+ * (@see DeploymentProvider#isMultipleMappingsSupported()).
+ * @param resource the resource whose mappings are to be retreived
+ * @param id the id of the provider
+ * @return the mappings for the resource
+ */
+ public DeploymentProvider[] getMappings(IResource resource, String id);
+
+ /**
+ * Returns <code>true</code> if the resource is mapped to the provider with
+ * the given id, and <code>false</code> otherwise. This method is fast running
+ * and won't load the provider.
+ *
+ * @param resource the resource for which to check the mapping
+ * @param id the id of the provider
+ * @return <code>true</code> if the resource is mapped to the provider with
+ * the given id, and <code>false</code> otherwise.
+ */
+ public boolean getMappedTo(IResource resource, String id);
+
+ /**
+ * Return an array of all the resource roots that are mapped
+ * to a deployment providers with the given
+ * id. If id is <code>null</code>, the roots of all deployment providers
+ * are returned.
+ * @param id a deployment provider id or <code>null</code>
+ * @return all roots that are mapped to deployment providers with
+ * the given id
+ */
+ public IResource[] getDeploymentProviderRoots(String id);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IMemento.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IMemento.java
new file mode 100644
index 000000000..9e4a1cb0d
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IMemento.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.core;
+
+/**
+ * Interface to a memento used for saving the important state of an object
+ * in a form that can be persisted in the file system.
+ * <p>
+ * Mementos were designed with the following requirements in mind:
+ * <ol>
+ * <li>Certain objects need to be saved and restored across platform sessions.
+ * </li>
+ * <li>When an object is restored, an appropriate class for an object might not
+ * be available. It must be possible to skip an object in this case.</li>
+ * <li>When an object is restored, the appropriate class for the object may be
+ * different from the one when the object was originally saved. If so, the
+ * new class should still be able to read the old form of the data.</li>
+ * </ol>
+ * </p>
+ * <p>
+ * Mementos meet these requirements by providing support for storing a
+ * mapping of arbitrary string keys to primitive values, and by allowing
+ * mementos to have other mementos as children (arranged into a tree).
+ * A robust external storage format based on XML is used.
+ * </p><p>
+ * The key for an attribute may be any alpha numeric value. However, the
+ * value of <code>TAG_ID</code> is reserved for internal use.
+ * </p><p>
+ * This interface is not intended to be implemented or extended by clients.
+ * </p>
+ *
+ * @see IPersistableElement
+ * @see IElementFactory
+ */
+public interface IMemento {
+ /**
+ * Special reserved key used to store the memento id
+ * (value <code>"org.eclipse.ui.id"</code>).
+ *
+ * @see #getID()
+ */
+ public static final String TAG_ID = "IMemento.internal.id"; //$NON-NLS-1$
+ /**
+ * Creates a new child of this memento with the given type.
+ * <p>
+ * The <code>getChild</code> and <code>getChildren</code> methods
+ * are used to retrieve children of a given type.
+ * </p>
+ *
+ * @param type the type
+ * @return a new child memento
+ * @see #getChild
+ * @see #getChildren
+ */
+ public IMemento createChild(String type);
+ /**
+ * Creates a new child of this memento with the given type and id.
+ * The id is stored in the child memento (using a special reserved
+ * key, <code>TAG_ID</code>) and can be retrieved using <code>getId</code>.
+ * <p>
+ * The <code>getChild</code> and <code>getChildren</code> methods
+ * are used to retrieve children of a given type.
+ * </p>
+ *
+ * @param type the type
+ * @param id the child id
+ * @return a new child memento with the given type and id
+ * @see #getID
+ */
+ public IMemento createChild(String type, String id);
+ /**
+ * Returns the first child with the given type id.
+ *
+ * @param type the type id
+ * @return the first child with the given type
+ */
+ public IMemento getChild(String type);
+ /**
+ * Returns all children with the given type id.
+ *
+ * @param type the type id
+ * @return the list of children with the given type
+ */
+ public IMemento[] getChildren(String type);
+ /**
+ * Returns the floating point value of the given key.
+ *
+ * @param key the key
+ * @return the value, or <code>null</code> if the key was not found or was found
+ * but was not a floating point number
+ */
+ public Float getFloat(String key);
+ /**
+ * Returns the id for this memento.
+ *
+ * @return the memento id, or <code>null</code> if none
+ * @see #createChild(java.lang.String,java.lang.String)
+ */
+ public String getID();
+ /**
+ * Returns the integer value of the given key.
+ *
+ * @param key the key
+ * @return the value, or <code>null</code> if the key was not found or was found
+ * but was not an integer
+ */
+ public Integer getInteger(String key);
+ /**
+ * Returns the string value of the given key.
+ *
+ * @param key the key
+ * @return the value, or <code>null</code> if the key was not found
+ */
+ public String getString(String key);
+ /**
+ * Returns the data of the Text node of the memento. Each memento is allowed
+ * only one Text node.
+ *
+ * @return the data of the Text node of the memento, or <code>null</code>
+ * if the memento has no Text node.
+ * @since 2.0
+ */
+ public String getTextData();
+ /**
+ * Sets the value of the given key to the given floating point number.
+ *
+ * @param key the key
+ * @param value the value
+ */
+ public void putFloat(String key, float value);
+ /**
+ * Sets the value of the given key to the given integer.
+ *
+ * @param key the key
+ * @param value the value
+ */
+ public void putInteger(String key, int value);
+ /**
+ * Copy the attributes and children from <code>memento</code>
+ * to the receiver.
+ *
+ * @param memento the IMemento to be copied.
+ */
+ public void putMemento(IMemento memento);
+ /**
+ * Sets the value of the given key to the given string.
+ *
+ * @param key the key
+ * @param value the value
+ */
+ public void putString(String key, String value);
+ /**
+ * Sets the memento's Text node to contain the given data. Creates the Text node if
+ * none exists. If a Text node does exist, it's current contents are replaced.
+ * Each memento is allowed only one text node.
+ *
+ * @param data the data to be placed on the Text node
+ * @since 2.0
+ */
+ public void putTextData(String data);
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
index ef43f0b66..b8a66559e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
@@ -15,31 +15,32 @@ import java.io.File;
import org.eclipse.core.runtime.IProgressMonitor;
/**
- * This class represents provisional API. A provider is not required to implement this API.
- * Implementers, and those who reference it, do so with the awareness that this class may be
- * removed or substantially changed at future times without warning.
+ * This class represents provisional API. A provider is not required to
+ * implement this API. Implementers, and those who reference it, do so with the
+ * awareness that this class may be removed or substantially changed at future
+ * times without warning.
* <p>
* The intention is that this class will eventually replace <code>IProjectSetSerializer</code>.
- * At the current time it only complements this API by providing a notification mechanism
- * for informing repository providers when a project set has been created.
+ * At the current time it only complements this API by providing a notification
+ * mechanism for informing repository providers when a project set has been
+ * created.
*
* @see IProjectSetSerializer
* @see RepositoryProviderType
*
* @since 2.1
*/
-
public abstract class ProjectSetCapability {
/**
- * Notify the provider that a project set has been created at path.
- * Only providers identified as having projects in the project set will be
- * notified. The project set may or may not be created in a workspace
+ * Notify the provider that a project set has been created at path. Only
+ * providers identified as having projects in the project set will be
+ * notified. The project set may or may not be created in a workspace
* project (thus may not be a resource).
*
- * @param File the project set file that was created
- */
+ * @param File
+ * the project set file that was created
+ */
public void projectSetCreated(File file, Object context, IProgressMonitor monitor) {
//default is to do nothing
}
-
}
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 9482ae5f2..ec686faa9 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
@@ -18,7 +18,6 @@ import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.ILock;
import org.eclipse.team.internal.core.Policy;
import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations;
/**
* A concrete subclass of <code>RepositoryProvider</code> is created for each
@@ -49,7 +48,7 @@ import org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations;
*
* @since 2.0
*/
-public abstract class RepositoryProvider implements IProjectNature {
+public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
private final static String TEAM_SETID = "org.eclipse.team.repository-provider"; //$NON-NLS-1$
@@ -516,24 +515,6 @@ public abstract class RepositoryProvider implements IProjectNature {
return false;
}
}
-
- /**
- * Provisional non-API method.
- *
- * This method is here to allow experimentation with 3rd party tools
- * calling providers in a repository neutral manner.
- *
- * Returns an object which implements a set of provider neutral operations for this
- * provider. Answers <code>null</code> if the provider does not wish to support these
- * operations.
- *
- * @return the repository operations or <code>null</code> if the provider does not
- * support provider neutral operations.
- * @see SimpleAccessOperations
- */
- public SimpleAccessOperations getSimpleAccess() {
- return null;
- }
/*
* @see IProjectNature#getProject()
@@ -598,27 +579,6 @@ public abstract class RepositoryProvider implements IProjectNature {
}
/**
- * Convert a project that are using natures to mark them as Team projects
- * to instead use persistent properties. Optionally remove the nature from the project.
- * Do nothing if the project has no Team nature.
- * Assume that the same ID is used for both the nature and the persistent property.
- *
- * @deprecated
- */
- public static void convertNatureToProperty(IProject project, boolean removeNature) throws TeamException {
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- if(provider == null)
- return;
-
- String providerId = provider.getID();
-
- RepositoryProvider.map(project, providerId);
- if(removeNature) {
- Team.removeNatureFromProject(project, providerId, new NullProgressMonitor());
- }
- }
-
- /**
* Method validateCreateLink is invoked by the Platform Core TeamHook when a
* linked resource is about to be added to the provider's project. It should
* not be called by other clients and it should not need to be overridden by
@@ -660,4 +620,12 @@ public abstract class RepositoryProvider implements IProjectNature {
public boolean canHandleLinkedResources() {
return false;
}
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
index c0336b5c9..dceecfe41 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
@@ -10,57 +10,26 @@
*******************************************************************************/
package org.eclipse.team.core;
-import java.io.DataInputStream;
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.SortedMap;
-import java.util.StringTokenizer;
-import java.util.TreeMap;
-import java.util.Vector;
+import java.io.*;
+import java.util.*;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.StringMatcher;
-import org.eclipse.team.internal.core.TeamPlugin;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.internal.core.*;
/**
* The Team class provides a global point of reference for the global ignore set
* and the text/binary registry.
*
+ * WVCM: how does the IProjectSetSerializer fit into the 3.0 team api?
+ *
* @since 2.0
*/
public final class Team {
- public static final String PREF_TEAM_IGNORES = "ignore_files"; //$NON-NLS-1$
- public static final String PREF_TEAM_TYPES = "file_types"; //$NON-NLS-1$
- public static final String PREF_TEAM_SEPARATOR = "\n"; //$NON-NLS-1$
+ private static final String PREF_TEAM_IGNORES = "ignore_files"; //$NON-NLS-1$
+ private static final String PREF_TEAM_TYPES = "file_types"; //$NON-NLS-1$
+ private static final String PREF_TEAM_SEPARATOR = "\n"; //$NON-NLS-1$
public static final Status OK_STATUS = new Status(Status.OK, TeamPlugin.ID, Status.OK, Policy.bind("ok"), null); //$NON-NLS-1$
// File type constants
@@ -75,6 +44,9 @@ public final class Team {
private static SortedMap globalIgnore, pluginIgnore;
private static StringMatcher[] ignoreMatchers;
+ // Deployment provider manager
+ private static IDeploymentProviderManager deploymentManager;
+
private static class FileTypeInfo implements IFileTypeInfo {
private String extension;
private int type;
@@ -296,55 +268,6 @@ public final class Team {
TeamPlugin.getPlugin().getPluginPreferences().setValue(PREF_TEAM_IGNORES, buf.toString());
}
- /**
- * Utility method for removing a project nature from a project.
- *
- * @param proj the project to remove the nature from
- * @param natureId the nature id to remove
- * @param monitor a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- *
- * @deprecated
- */
- public static void removeNatureFromProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
- try {
- IProjectDescription description = proj.getDescription();
- String[] prevNatures= description.getNatureIds();
- List newNatures = new ArrayList(Arrays.asList(prevNatures));
- newNatures.remove(natureId);
- description.setNatureIds((String[])newNatures.toArray(new String[newNatures.size()]));
- proj.setDescription(description, monitor);
- } catch(CoreException e) {
- throw wrapException(Policy.bind("manager.errorRemovingNature", proj.getName(), natureId), e); //$NON-NLS-1$
- }
- }
-
- /**
- * Utility method for adding a nature to a project.
- *
- * @param proj the project to add the nature
- * @param natureId the id of the nature to assign to the project
- * @param monitor a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- *
- * @exception TeamException if a problem occured setting the nature
- *
- * @deprecated
- */
- public static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
- try {
- IProjectDescription description = proj.getDescription();
- String[] prevNatures= description.getNatureIds();
- String[] newNatures= new String[prevNatures.length + 1];
- System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
- newNatures[prevNatures.length]= natureId;
- description.setNatureIds(newNatures);
- proj.setDescription(description, monitor);
- } catch(CoreException e) {
- throw wrapException(Policy.bind("manager.errorSettingNature", proj.getName(), natureId), e); //$NON-NLS-1$
- }
- }
-
/*
* TEXT
*
@@ -649,4 +572,17 @@ public final class Team {
initializePluginPatterns(pTypes, gTypes);
return getFileTypeInfo(gTypes);
}
+
+ /**
+ * Returns the deployment manager.
+ * @return the deployment manager
+ * @since 3.0
+ */
+ public static IDeploymentProviderManager getDeploymentManager() {
+ if(deploymentManager == null) {
+ deploymentManager = new DeploymentProviderManager();
+ }
+ return deploymentManager;
+ }
+
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java
index b30984675..d7bd5979e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamException.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.team.core;
+import java.lang.reflect.InvocationTargetException;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -78,4 +80,15 @@ public class TeamException extends CoreException {
}
return new TeamException(e);
}
+
+ /*
+ * Static helper methods for creating exceptions
+ */
+ public static TeamException asTeamException(InvocationTargetException e) {
+ Throwable target = e.getTargetException();
+ if (target instanceof TeamException) {
+ return (TeamException) target;
+ }
+ return new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, UNABLE, target.getMessage() != null ? target.getMessage() : "", target)); //$NON-NLS-1$
+ }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java
index 5e1b5768c..5fc2b541a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java
@@ -15,7 +15,6 @@ import java.io.*;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.core.TeamPlugin;
/**
@@ -135,10 +134,10 @@ public class ContentComparisonCriteria implements IComparisonCriteria {
try {
if (resource instanceof IFile) {
return new BufferedInputStream(((IFile) resource).getContents());
- } else if (resource instanceof IRemoteResource) {
- IRemoteResource remote = (IRemoteResource) resource;
+ } else if(resource instanceof ISubscriberResource) {
+ ISubscriberResource remote = (ISubscriberResource)resource;
if (!remote.isContainer()) {
- return new BufferedInputStream(remote.getContents(monitor));
+ return new BufferedInputStream(remote.getStorage(monitor).getContents());
}
}
return null;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberResource.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberResource.java
new file mode 100644
index 000000000..915788ac9
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberResource.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.core.subscribers;
+
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.core.TeamException;
+
+/**
+ * This interface provides access to a resource that is controlled
+ * by a particular subscriber. The resource may be local or remote.
+ *
+ * @since 3.0
+ */
+public interface ISubscriberResource {
+
+ /**
+ * Answers a string that describes the name of the subscriber resource. The name may be
+ * displayed to the user.
+ *
+ * @return name of the subscriber resource.
+ */
+ public String getName();
+
+ /**
+ * Answers if the remote element may have children.
+ *
+ * @return <code>true</code> if the remote element may have children and
+ * <code>false</code> otherwise.
+ */
+ public boolean isContainer();
+
+ /**
+ * Return an instance of IStorage or <code>null</code> if the subscriber resource
+ * does not have contents (i.e. is a folder). Since the <code>ISorage#getContents()</code>
+ * method does not accept an IProgressMonitor, this method must ensure that the contents
+ * access by the resulting IStorage is cahced locally (hence the IProgressMonitor
+ * argument to this method). If the subscriber resource is local, this is not an issue
+ * but if the subscriber resource is remote, then implementations of this method should
+ * ensure that the resulting IStorage is accessing locally cached contents and is not
+ * contacting the server.
+ * @return
+ */
+ public IStorage getStorage(IProgressMonitor monitor) throws TeamException;
+
+ /**
+ * Return a content identifier that is used to differentiate versions
+ * or revisions of the same resource.
+ *
+ * @return a String that identifies the version of the subscriber resource
+ * @throws TeamException
+ */
+ public String getContentIdentifier() throws TeamException;
+
+ /**
+ * Returns whether the subscriber resource is equal to the provided object.
+ * @param object
+ * @return
+ */
+ public boolean equals(Object object);
+
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteContentsCache.java
index 210ca912b..20d4e04b8 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCache.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteContentsCache.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.core.sync;
+package org.eclipse.team.core.subscribers;
import java.io.File;
import java.util.ArrayList;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCacheEntry.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteContentsCacheEntry.java
index 3e66789d3..2204e6090 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteContentsCacheEntry.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteContentsCacheEntry.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.core.sync;
+package org.eclipse.team.core.subscribers;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
@@ -97,11 +97,11 @@ public class RemoteContentsCacheEntry {
}
}
- private void endOperation() {
+ private synchronized void endOperation() {
cache.getLock().release();
}
- private void beginOperation() {
+ private synchronized void beginOperation() {
cache.getLock().acquire();
}
@@ -173,13 +173,7 @@ public class RemoteContentsCacheEntry {
* This method is sychronized to ensure atomic setting of the bytes.
* @param bytes
*/
- public void setSyncBytes(byte[] bytes) {
- try {
- beginOperation();
- syncBytes = bytes;
- } finally {
- endOperation();
- }
+ public synchronized void setSyncBytes(byte[] bytes) {
syncBytes = bytes;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteSynchronizer.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteSynchronizer.java
deleted file mode 100644
index 545985450..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteSynchronizer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.core.subscribers;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-
-/**
- * A remote synchronizer provides API to access a handle for a resource resource
- * associated with a local resource (that may or may not exist locally).
- * API is also provided to trigger a refresh in order to cache the remote state
- * for later retrieval.
- */
-public abstract class RemoteSynchronizer {
-
- /**
- * Return a remote resource handle created from the remote sync bytes associated
- * with the local resource for this synchronizer.
- *
- * @param resource the local resource
- * @return the IRemoteResource handle for a remote resource
- * @throws TeamException
- */
- public abstract IRemoteResource getRemoteResource(IResource resource) throws TeamException;
-
- /**
- * Return whether the given resource has a corresponding remote resource that
- * is known to exist (at the last point in time that a refresh was performed).
- *
- * @param resource the local resource handle
- * @return <code>true</code> if a corrrespondin remote resource is know to exist
- * @throws TeamException
- */
- public abstract boolean hasRemote(IResource resource) throws TeamException;
-
- /**
- * Refreshes the contents of the resource synchronizer and returns the list
- * of resources whose remote synchronization state changed since the last refresh.
- * The <code>cacheFileContentsHint</code> indicates that the user of this synchronizer
- * will be using the file contents. Subclasses can decide
- * whether to cache file contents during the refresh or to
- * allow them to be fetched when request.
- *
- * @param resource the resource to refresh
- * @param depth the depth of the operation
- * @param cacheFileContentsHint a hint which indicates whether file contents will be used
- * @param monitor the progress monitor
- * @return the resources whose remote has changed since the last refresh
- * @throws TeamException
- */
- public abstract IResource[] refresh(IResource resource, int depth, boolean cacheFileContentsHint, IProgressMonitor monitor) throws TeamException;
-
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java
index 664eb325a..3188b0145 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java
@@ -1,14 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
package org.eclipse.team.core.subscribers;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.core.Policy;
@@ -41,6 +45,8 @@ import org.eclipse.team.internal.core.Policy;
* [Issue: "Gender changes" are also an interesting aspect...
* ]
* </p>
+ *
+ * @since 3.0
*/
public class SyncInfo implements IAdaptable {
@@ -121,12 +127,19 @@ public class SyncInfo implements IAdaptable {
*/
public static final int MANUAL_CONFLICT = 64;
+ /**
+ * Sync constant (value 128) indicating that the local resource is not controlled
+ * by the subscriber. This can occur for either an OUTGOING | ADDITION or a CONFLICTING | ADDITION.
+ * Uncontrolled resources may be excluded from the operations of ITeamOperation (except control).
+ */
+ public static final int UNCONTROLLED = 128;
+
/*====================================================================
* Members:
*====================================================================*/
private IResource local;
- private IRemoteResource base;
- private IRemoteResource remote;
+ private ISubscriberResource base;
+ private ISubscriberResource remote;
private TeamSubscriber subscriber;
private int syncKind;
@@ -134,7 +147,7 @@ public class SyncInfo implements IAdaptable {
/**
* Construct a sync info object.
*/
- public SyncInfo(IResource local, IRemoteResource base, IRemoteResource remote, TeamSubscriber subscriber) throws TeamException {
+ public SyncInfo(IResource local, ISubscriberResource base, ISubscriberResource remote, TeamSubscriber subscriber) throws TeamException {
this.local = local;
this.base = base;
this.remote = remote;
@@ -173,7 +186,7 @@ public class SyncInfo implements IAdaptable {
*
* @return a remote resource handle, or <code>null</code>
*/
- public IRemoteResource getBase() {
+ public ISubscriberResource getBase() {
return base;
}
@@ -188,7 +201,7 @@ public class SyncInfo implements IAdaptable {
*
* @return a remote resource handle, or <code>null</code>
*/
- public IRemoteResource getRemote() {
+ public ISubscriberResource getRemote() {
return remote;
}
@@ -243,19 +256,19 @@ public class SyncInfo implements IAdaptable {
if (!equalObjects(local1, local2)) return false;
// Next, ensure the base resources are equal
- IRemoteResource base1 = null;
+ ISubscriberResource base1 = null;
if (node1.getBase() != null)
base1 = node1.getBase();
- IRemoteResource base2 = null;
+ ISubscriberResource base2 = null;
if (node2.getBase() != null)
base2 = node2.getBase();
if (!equalObjects(base1, base2)) return false;
// Finally, ensure the remote resources are equal
- IRemoteResource remote1 = null;
+ ISubscriberResource remote1 = null;
if (node1.getRemote() != null)
remote1 = node1.getRemote();
- IRemoteResource remote2 = null;
+ ISubscriberResource remote2 = null;
if (node2.getRemote() != null)
remote2 = node2.getRemote();
if (!equalObjects(remote1, remote2)) return false;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java
index a678241ac..d5df84e13 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java
@@ -16,7 +16,6 @@ import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.core.TeamPlugin;
/**
@@ -86,25 +85,6 @@ abstract public class TeamSubscriber {
abstract public IResource[] roots();
/**
- * Returns a handle to the remote resource corresponding to the given
- * resource, or <code>null</code> if there is no corresponding resource
- * edition.
- * <p>
- * This is a fast operation; the repository is not contacted.
- * </p>
- *
- * @param resource
- * the resource
- * @return a server resource
- * @exception CoreException
- * if this request fails. Reasons include:
- * <ul>
- * <li>???</li>
- * </ul>
- */
- abstract public IRemoteResource getRemoteResource(IResource resource) throws TeamException;
-
- /**
* Returns synchronization info for the given resource, or <code>null</code>
* if there is no synchronization info because the subscriber does not
* apply to this resource.
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriberSyncInfoCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriberSyncInfoCollector.java
index f6d2b99cf..629a4f350 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriberSyncInfoCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriberSyncInfoCollector.java
@@ -12,6 +12,7 @@ package org.eclipse.team.core.subscribers;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.core.subscribers.SubscriberEventHandler;
@@ -47,12 +48,17 @@ public class TeamSubscriberSyncInfoCollector implements IResourceChangeListener,
return set.getSyncSet();
}
- public void waitForCollector() {
- try {
- eventHandler.getEventHandlerJob().join();
- } catch (InterruptedException e) {
- // continue
+ public void waitForCollector(IProgressMonitor monitor) {
+ monitor.worked(1);
+ // wait for the event handler to process changes.
+ while(eventHandler.getEventHandlerJob().getState() != Job.NONE) {
+ monitor.worked(1);
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ }
}
+ monitor.worked(1);
}
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/DescendantSynchronizationCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/DescendantSynchronizationCache.java
new file mode 100644
index 000000000..de8e2c06d
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/DescendantSynchronizationCache.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.core.subscribers.utils;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.core.TeamException;
+
+/**
+ * A descendant sychronization cache stores the remote synchronization bytes.
+ * It does so in an optimal way by storing the bytes only for those resources
+ * whose remote differ from the base bytes stored in the base synchronization cache.
+ */
+public abstract class DescendantSynchronizationCache extends SynchronizationCache {
+ SynchronizationCache baseCache, remoteCache;
+
+ public DescendantSynchronizationCache(SynchronizationCache baseCache, SynchronizationCache remoteCache) {
+ this.baseCache = baseCache;
+ this.remoteCache = remoteCache;
+ }
+
+ /**
+ * This method will dispose the remote cache but not the base cache.
+ *
+ * @see org.eclipse.team.core.subscribers.helpers.SynchronizationCache#dispose()
+ */
+ public void dispose() {
+ remoteCache.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.AbstractSynchronizationCache#getSyncBytes(org.eclipse.core.resources.IResource)
+ */
+ public byte[] getSyncBytes(IResource resource) throws TeamException {
+ byte[] remoteBytes = remoteCache.getSyncBytes(resource);
+ byte[] baseBytes = baseCache.getSyncBytes(resource);
+ if (baseBytes == null) {
+ // There is no base so use the remote bytes
+ return remoteBytes;
+ }
+ if (remoteBytes == null) {
+ if (isRemoteKnown(resource)) {
+ // The remote is known to not exist
+ // TODO: The check for NO_REMOTE does not take into consideration the line-of-descent
+ return remoteBytes;
+ } else {
+ // The remote was either never queried or was the same as the base.
+ // In either of these cases, the base bytes are used.
+ return baseBytes;
+ }
+ }
+ if (isDescendant(resource, baseBytes, remoteBytes)) {
+ // Only use the remote bytes if they are later on the same line-of-descent as the base
+ return remoteBytes;
+ }
+ // Use the base sbytes since the remote bytes must be stale (i.e. are
+ // not on the same line-of-descent
+ return baseBytes;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.AbstractSynchronizationCache#setSyncBytes(org.eclipse.core.resources.IResource, byte[])
+ */
+ public boolean setSyncBytes(IResource resource, byte[] bytes) throws TeamException {
+ byte[] baseBytes = baseCache.getSyncBytes(resource);
+ if (baseBytes != null && equals(baseBytes, bytes)) {
+ // Remove the existing bytes so the base will be used (thus saving space)
+ return remoteCache.removeSyncBytes(resource, IResource.DEPTH_ZERO);
+ } else {
+ return remoteCache.setSyncBytes(resource, bytes);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.AbstractSynchronizationCache#removeSyncBytes(org.eclipse.core.resources.IResource, int)
+ */
+ public boolean removeSyncBytes(IResource resource, int depth) throws TeamException {
+ return remoteCache.removeSyncBytes(resource, depth);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.AbstractSynchronizationCache#isRemoteKnown(org.eclipse.core.resources.IResource)
+ */
+ public boolean isRemoteKnown(IResource resource) throws TeamException {
+ return remoteCache.isRemoteKnown(resource);
+ }
+
+ /**
+ * This method indicates whether the remote bytes are a later revision or version
+ * on the same line-of-descent as the base. A line of descent may be a branch or a fork
+ * (depending on the terminology used by the versioing server).
+ * @param resource the local resource
+ * @param baseBytes the base bytes for the local resoource
+ * @param remoteBytes the remote bytes for the local resoource
+ * @return whether the remote bytes are later on the same line-of-descent as the base bytes
+ */
+ protected abstract boolean isDescendant(IResource resource, byte[] baseBytes, byte[] remoteBytes) throws TeamException;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.AbstractSynchronizationCache#setRemoteDoesNotExist(org.eclipse.core.resources.IResource)
+ */
+ public boolean setRemoteDoesNotExist(IResource resource) throws TeamException {
+ return remoteCache.setRemoteDoesNotExist(resource);
+ }
+
+ /**
+ * @return Returns the baseCache.
+ */
+ protected SynchronizationCache getBaseCache() {
+ return baseCache;
+ }
+
+ /**
+ * @return Returns the remoteCache.
+ */
+ protected SynchronizationCache getRemoteCache() {
+ return remoteCache;
+ }
+
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SyncTreeSubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SyncTreeSubscriber.java
new file mode 100644
index 000000000..b9532d5b6
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SyncTreeSubscriber.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.core.subscribers.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.*;
+
+/**
+ * A specialization of TeamSubscriber that provides some additional logic for creating
+ * <code>SyncInfo</code> from <code>ISubscriberResource</code> instances and for
+ * adding comparison criteria. The <code>members()</code> also assumes that remote
+ * instances are stored in the <code>ISynchronizer</code>.
+ */
+public abstract class SyncTreeSubscriber extends TeamSubscriber {
+
+ public abstract ISubscriberResource getRemoteResource(IResource resource) throws TeamException;
+
+ public abstract ISubscriberResource getBaseResource(IResource resource) throws TeamException;
+
+ /**
+ * Return whether the given local resource has a corresponding remote resource
+ * @param resource the local resource
+ * @return <code>true</code> if the locla resource has a corresponding remote
+ */
+ protected abstract boolean hasRemote(IResource resource) throws TeamException;
+
+ public SyncInfo getSyncInfo(IResource resource) throws TeamException {
+ if (!isSupervised(resource)) return null;
+ ISubscriberResource remoteResource = getRemoteResource(resource);
+ ISubscriberResource baseResource = getBaseResource(resource);
+ return getSyncInfo(resource, baseResource, remoteResource);
+ }
+
+ /**
+ * Method that creates an instance of SyncInfo for the provider local, base and remote.
+ * Can be overiden by subclasses.
+ * @param local
+ * @param base
+ * @param remote
+ * @param monitor
+ * @return
+ */
+ protected SyncInfo getSyncInfo(IResource local, ISubscriberResource base, ISubscriberResource remote) throws TeamException {
+ return new SyncInfo(local, base, remote, this);
+ }
+
+ public IResource[] members(IResource resource) throws TeamException {
+ if(resource.getType() == IResource.FILE) {
+ return new IResource[0];
+ }
+ try {
+ // Filter and return only phantoms associated with the remote synchronizer.
+ IResource[] members;
+ try {
+ members = ((IContainer)resource).members(true /* include phantoms */);
+ } catch (CoreException e) {
+ if (!isSupervised(resource) || e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
+ // The resource is no longer supervised or doesn't exist in any form
+ // so ignore the exception and return that there are no members
+ return new IResource[0];
+ }
+ throw e;
+ }
+ List filteredMembers = new ArrayList(members.length);
+ for (int i = 0; i < members.length; i++) {
+ IResource member = members[i];
+
+ // TODO: consider that there may be several sync states on this resource. There
+ // should instead be a method to check for the existance of a set of sync types on
+ // a resource.
+ if(member.isPhantom() && !hasRemote(member)) {
+ continue;
+ }
+
+ // TODO: Is this a valid use of isSupervised
+ if (isSupervised(resource)) {
+ filteredMembers.add(member);
+ }
+ }
+ return (IResource[]) filteredMembers.toArray(new IResource[filteredMembers.size()]);
+ } catch (CoreException e) {
+ throw TeamException.asTeamException(e);
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationCache.java
new file mode 100644
index 000000000..e45bacd9c
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationCache.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.core.subscribers.utils;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.core.TeamException;
+
+/**
+ * This class defines the API for a synchronization bytes cache. Synchronization
+ * bytes are associated with a local resource handle.
+ * It also has API that differentiates the case of no existing remote for
+ * a local resource from that of the remote state never having been queried
+ * for that local resource.
+ */
+public abstract class SynchronizationCache {
+
+ /**
+ * Dispose of any cached sync bytes when this cache is no longer needed.
+ */
+ public abstract void dispose();
+
+ /**
+ * Return the remote sync bytes cached for the given local resource.
+ * A return value of <code>null</code> can mean either that the
+ * remote has never been fetched or that it doesn't exist. The method
+ * <code>isRemoteKnown(IResource)</code> should be used to differentiate
+ * these two cases.
+ * @param resource the local resource
+ * @return the synchronization bytes for a corresponding remote resource
+ * @throws TeamException
+ */
+ public abstract byte[] getSyncBytes(IResource resource) throws TeamException;
+
+ /**
+ * Set the remote sync bytes for the given resource. The bytes should never be
+ * <code>null</code>. If it is known that the remote does not exist,
+ * <code>setRemoteDoesNotExist(IResource)</code> should be invoked. If the sync
+ * bytes for the remote are stale and should be removed, <code>removeSyncBytes()</code>
+ * should be called.
+ * @param resource the local resource
+ * @param bytes the synchronization bytes for a corresponding remote resource
+ * @return <code>true</code> if the sync bytes changed
+ * @throws TeamException
+ */
+ public abstract boolean setSyncBytes(IResource resource, byte[] bytes) throws TeamException;
+
+ /**
+ * Remove the remote bytes cached for the given local resource. After this
+ * operation <code>isRemoteKnown(resource)</code> will return <code>false</code>
+ * and <code>getSyncBytes(resource)</code> will return <code>null</code> for the
+ * resource (and potentially it's children depending on the value of the depth parameter.
+ * @param resource the local resource
+ * @parem depth the depth of the operation (@see IResource)
+ * @return <code>true</code> if there were bytes present which were removed
+ * @throws TeamException
+ */
+ public abstract boolean removeSyncBytes(IResource resource, int depth) throws TeamException;
+
+ /**
+ * Return true if the remote resources associated with the given local
+ * resource has been fetched. This method is useful for those cases when
+ * there are no sync bytes for a remote resource and the client wants to
+ * know if this means that the remote does exist (i.e. this method returns
+ * <code>true</code>) or the remote has not been fetched (i.e. this method returns
+ * <code>false</code>).
+ * @param resource the local resource
+ * @throws TeamException
+ */
+ public abstract boolean isRemoteKnown(IResource resource) throws TeamException;
+
+ /**
+ * This method should be invoked by a client to indicate that it is known that
+ * there is no remote resource associated with the local resource. After this method
+ * is invoked, <code>isRemoteKnown(resource)</code> will return <code>true</code> and
+ * <code>getSyncBytes(resource)</code> will return <code>null</code>.
+ * @param resource the local resource
+ * @return <code>true</code> if this changes the remote sync bytes
+ */
+ public abstract boolean setRemoteDoesNotExist(IResource resource) throws TeamException;
+
+ /**
+ * Helper method to compare two byte arrays for equality
+ * @param syncBytes1 the first byte array
+ * @param syncBytes2 the second byte array
+ * @return whetehr the two arrays are equal (i.e. same content)
+ */
+ protected boolean equals(byte[] syncBytes1, byte[] syncBytes2) {
+ if (syncBytes1 == null) {
+ return syncBytes2 == null;
+ } else if (syncBytes2 == null) {
+ return false;
+ }
+ if (syncBytes1.length != syncBytes2.length) return false;
+ for (int i = 0; i < syncBytes1.length; i++) {
+ if (syncBytes1[i] != syncBytes2[i]) return false;
+ }
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationCacheRefreshOperation.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationCacheRefreshOperation.java
new file mode 100644
index 000000000..976e52662
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationCacheRefreshOperation.java
@@ -0,0 +1,272 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.core.subscribers.utils;
+
+import java.util.*;
+
+import org.eclipse.core.internal.jobs.JobManager;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.ISubscriberResource;
+import org.eclipse.team.internal.core.Assert;
+import org.eclipse.team.internal.core.Policy;
+
+/**
+ * This abstract superclass provides the logic for refreshing the synchronization bytes for
+ * remote resources that correspond to local resources. This class provides the logic to traverse
+ * the local and remote resource trees in order to cache the remote synchronization bytes in
+ * a <code>SynchronizationCache</code>. It also accumulates and returns all local resources
+ * for which the corresponding remote has changed.
+ */
+public abstract class SynchronizationCacheRefreshOperation {
+
+ protected abstract SynchronizationCache getSynchronizationCache();
+
+ public IResource[] refresh(IResource[] resources, int depth, boolean cacheFileContentsHint, IProgressMonitor monitor) throws TeamException {
+ List changedResources = new ArrayList();
+ monitor.beginTask(null, 100 * resources.length);
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ IResource[] changed = refresh(resource, depth, cacheFileContentsHint, Policy.subMonitorFor(monitor, 100));
+ changedResources.addAll(Arrays.asList(changed));
+ }
+ monitor.done();
+ if (changedResources == null) return new IResource[0];
+ return (IResource[]) changedResources.toArray(new IResource[changedResources.size()]);
+ }
+
+ protected IResource[] refresh(IResource resource, int depth, boolean cacheFileContentsHint, IProgressMonitor monitor) throws TeamException {
+ IResource[] changedResources = null;
+ monitor.beginTask(null, 100);
+ ISchedulingRule rule = resource.getProject();
+ try {
+ // Get a scheduling rule on the project since CVS may obtain a lock higher then
+ // the resource itself.
+ JobManager.getInstance().beginRule(rule, monitor);
+ if (!resource.getProject().isAccessible()) {
+ // The project is closed so silently skip it
+ return new IResource[0];
+ }
+
+ monitor.setTaskName(Policy.bind("RemoteTagSynchronizer.0", resource.getFullPath().makeRelative().toString()));
+
+ // build the remote tree only if an initial tree hasn't been provided
+ ISubscriberResource tree = getRemoteTree(resource, depth, cacheFileContentsHint, Policy.subMonitorFor(monitor, 70));
+
+ // update the known remote handles
+ IProgressMonitor sub = Policy.infiniteSubMonitorFor(monitor, 30);
+ try {
+ sub.beginTask(null, 64);
+ changedResources = collectChanges(resource, tree, depth, sub);
+ } finally {
+ sub.done();
+ }
+ } finally {
+ JobManager.getInstance().endRule(rule);
+ monitor.done();
+ }
+ if (changedResources == null) return new IResource[0];
+ return changedResources;
+ }
+
+ public IResource[] collectChanges(IResource local, ISubscriberResource remote, int depth, IProgressMonitor monitor) throws TeamException {
+ List changedResources = new ArrayList();
+ collectChanges(local, remote, changedResources, depth, monitor);
+ return (IResource[]) changedResources.toArray(new IResource[changedResources.size()]);
+ }
+
+ protected void collectChanges(IResource local, ISubscriberResource remote, Collection changedResources, int depth, IProgressMonitor monitor) throws TeamException {
+ SynchronizationCache cache = getSynchronizationCache();
+ byte[] newRemoteBytes = getRemoteSyncBytes(local, remote);
+ boolean changed;
+ if (newRemoteBytes == null) {
+ changed = cache.setRemoteDoesNotExist(local);
+ } else {
+ changed = cache.setSyncBytes(local, newRemoteBytes);
+ }
+ if (changed) {
+ changedResources.add(local);
+ }
+ if (depth == IResource.DEPTH_ZERO) return;
+ Map children = mergedMembers(local, remote, monitor);
+ for (Iterator it = children.keySet().iterator(); it.hasNext();) {
+ IResource localChild = (IResource) it.next();
+ ISubscriberResource remoteChild = (ISubscriberResource)children.get(localChild);
+ collectChanges(localChild, remoteChild, changedResources,
+ depth == IResource.DEPTH_INFINITE ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO,
+ monitor);
+ }
+
+ // Look for resources that have sync bytes but are not in the resources we care about
+ IResource[] resources = getChildrenWithSyncBytes(local);
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if (!children.containsKey(resource)) {
+ // These sync bytes are stale. Purge them
+ cache.removeSyncBytes(resource, IResource.DEPTH_INFINITE);
+ changedResources.add(resource);
+ }
+ }
+ }
+
+ /**
+ * Return all the children of the local resource, including phantoms, that have synchronozation bytes
+ * associated with them in the synchronization cache of this operation.
+ * @param local the local resource
+ * @return all children that have sychronization bytes.
+ * @throws TeamException
+ */
+ protected IResource[] getChildrenWithSyncBytes(IResource local) throws TeamException {
+ try {
+ if (local.getType() != IResource.FILE && (local.exists() || local.isPhantom())) {
+ IResource[] allChildren = ((IContainer)local).members(true /* include phantoms */);
+ List childrenWithSyncBytes = new ArrayList();
+ for (int i = 0; i < allChildren.length; i++) {
+ IResource resource = allChildren[i];
+ if (getSynchronizationCache().getSyncBytes(resource) != null) {
+ childrenWithSyncBytes.add(resource);
+ }
+ }
+ return (IResource[]) childrenWithSyncBytes.toArray(
+ new IResource[childrenWithSyncBytes.size()]);
+ }
+ } catch (CoreException e) {
+ throw TeamException.asTeamException(e);
+ }
+ return new IResource[0];
+ }
+
+ protected Map mergedMembers(IResource local, ISubscriberResource remote, IProgressMonitor progress) throws TeamException {
+
+ // {IResource -> IRemoteResource}
+ Map mergedResources = new HashMap();
+
+ ISubscriberResource[] remoteChildren;
+ if (remote == null) {
+ remoteChildren = new ISubscriberResource[0];
+ } else {
+ remoteChildren = getRemoteChildren(remote, progress);
+ }
+
+
+ IResource[] localChildren = getLocalChildren(local);
+
+ if (remoteChildren.length > 0 || localChildren.length > 0) {
+ Set allSet = new HashSet(20);
+ Map localSet = null;
+ Map remoteSet = null;
+
+ if (localChildren.length > 0) {
+ localSet = new HashMap(10);
+ for (int i = 0; i < localChildren.length; i++) {
+ IResource localChild = localChildren[i];
+ String name = localChild.getName();
+ localSet.put(name, localChild);
+ allSet.add(name);
+ }
+ }
+
+ if (remoteChildren.length > 0) {
+ remoteSet = new HashMap(10);
+ for (int i = 0; i < remoteChildren.length; i++) {
+ ISubscriberResource remoteChild = remoteChildren[i];
+ String name = remoteChild.getName();
+ remoteSet.put(name, remoteChild);
+ allSet.add(name);
+ }
+ }
+
+ Iterator e = allSet.iterator();
+ while (e.hasNext()) {
+ String keyChildName = (String) e.next();
+
+ if (progress != null) {
+ if (progress.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ // XXX show some progress?
+ }
+
+ IResource localChild =
+ localSet != null ? (IResource) localSet.get(keyChildName) : null;
+
+ ISubscriberResource remoteChild =
+ remoteSet != null ? (ISubscriberResource) remoteSet.get(keyChildName) : null;
+
+ if (localChild == null) {
+ // there has to be a remote resource available if we got this far
+ Assert.isTrue(remoteChild != null);
+ boolean isContainer = remoteChild.isContainer();
+ localChild = getResourceChild(local /* parent */, keyChildName, isContainer);
+ }
+ mergedResources.put(localChild, remoteChild);
+ }
+ }
+ return mergedResources;
+ }
+
+ /**
+ * Get the remote sync bytes from the given remote resource handle.
+ * @param local the local resource
+ * @param remote the corresponding remote resource
+ * @return the synchronization bytes for the remote resource.
+ */
+ protected abstract byte[] getRemoteSyncBytes(IResource local, ISubscriberResource remote) throws TeamException;
+
+ /**
+ * Get the remote children of the given remote resource handle.
+ * @param remote the remote resource
+ * @param progress a progress monitor
+ * @return an array of the children of the renmote resource.
+ */
+ protected abstract ISubscriberResource[] getRemoteChildren(ISubscriberResource remote, IProgressMonitor progress) throws TeamException;
+
+ /**
+ * Get the local children that are of interest to the subscriber for the given local resource.
+ * @param parent the local resource
+ * @return the children of the local resource
+ */
+ protected abstract IResource[] getLocalChildren(IResource parent) throws TeamException;
+
+ /**
+ * Get the root of the remote tree corresponding to the given resource. This method may build the tree
+ * or may just return the root, in which the remote tree will be built during the collectChanges phase.
+ * @param resource the local resource
+ * @param depth the depth of the refresh
+ * @param cacheFileContentsHint a hint that indicates that remote contents may be needed
+ * when comparing local and remote resources.
+ * @param monitor a progress monitor
+ * @return the remote resource corresponding to the given local resource
+ */
+ protected abstract ISubscriberResource getRemoteTree(IResource resource, int depth, boolean cacheFileContentsHint, IProgressMonitor monitor) throws TeamException;
+
+ /**
+ * Create a corresponding local resource handle for a remote resource that does not yet have a
+ * corresponding local resource taht exists.
+ * @param parent the local parent
+ * @param childName the name of the local resource
+ * @param isContainer the type of resource (file or folder)
+ * @return a local resource handle
+ */
+ protected IResource getResourceChild(IResource parent, String childName, boolean isContainer) {
+ if (parent.getType() == IResource.FILE) {
+ return null;
+ }
+ if (isContainer) {
+ return ((IContainer) parent).getFolder(new Path(childName));
+ } else {
+ return ((IContainer) parent).getFile(new Path(childName));
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteBytesSynchronizer.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationSyncBytesCache.java
index 315f4d6a9..c3cc46bc5 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/RemoteBytesSynchronizer.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SynchronizationSyncBytesCache.java
@@ -8,37 +8,29 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.core.subscribers;
+package org.eclipse.team.core.subscribers.utils;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ISynchronizer;
-import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.core.Assert;
/**
- * A remote bytes sychronizer is a remote synchronizer that caches the
- * remote sync bytes using the org.eclipse.core.resources.ISynchronizer.
- * It also has API that differentiates the case of no existing remote for
- * a local resource from that of the remote state never having been queried
- * for that local resource.
+ * This class provides a concrete synchronization cache that uses the
+ * <code>org.eclipse.core.resources.ISynchronizer</code>.
*/
-public abstract class RemoteBytesSynchronizer extends RemoteSynchronizer {
-
+public class SynchronizationSyncBytesCache extends SynchronizationCache {
+
private static final byte[] NO_REMOTE = new byte[0];
protected QualifiedName syncName;
- public RemoteBytesSynchronizer(QualifiedName name) {
+ public SynchronizationSyncBytesCache(QualifiedName name) {
syncName = name;
getSynchronizer().add(syncName);
}
- /**
- * Dispose of any cached sync bytes.
- */
public void dispose() {
getSynchronizer().remove(getSyncName());
}
@@ -47,17 +39,10 @@ public abstract class RemoteBytesSynchronizer extends RemoteSynchronizer {
return ResourcesPlugin.getWorkspace().getSynchronizer();
}
- protected QualifiedName getSyncName() {
+ public QualifiedName getSyncName() {
return syncName;
}
- /**
- * Return the remote sync bytes cached for the given local resource.
- * A return value of <code>null</code> can mean either that the
- * remote has never been fetched or that it doesn't exist. The method
- * <code>isRemoteKnown(IResource)</code> should be used to differentiate
- * these two cases.
- */
public byte[] getSyncBytes(IResource resource) throws TeamException {
byte[] syncBytes = internalGetSyncBytes(resource);
if (syncBytes != null && equals(syncBytes, NO_REMOTE)) {
@@ -75,17 +60,6 @@ public abstract class RemoteBytesSynchronizer extends RemoteSynchronizer {
}
}
- /**
- * Set the remote sync bytes for the given resource. The bytes should never be
- * <code>null</code>. If it is known that the remote does not exist,
- * <code>setRemoteDoesNotExist(IResource)</code> should be invoked. If the sync
- * bytes for the remote are stale and should be removed, <code>removeSyncBytes()</code>
- * should be called.
- * @param resource
- * @param bytes
- * @return <code>true</code> if the sync bytes changed
- * @throws TeamException
- */
public boolean setSyncBytes(IResource resource, byte[] bytes) throws TeamException {
Assert.isNotNull(bytes);
byte[] oldBytes = internalGetSyncBytes(resource);
@@ -98,13 +72,6 @@ public abstract class RemoteBytesSynchronizer extends RemoteSynchronizer {
}
}
- /**
- * Remove the remote bytes cached for the given local resource. After this
- * operation <code>isRemoteKnown(resource)</code> will return <code>false</code>
- * and <code>getSyncBytes(resource)</code> will return <code>null</code> for the
- * resource (and potentially it's children depending on the value of the depth parameter.
- * @return <code>true</code> if there were bytes present which were removed
- */
public boolean removeSyncBytes(IResource resource, int depth) throws TeamException {
if (resource.exists() || resource.isPhantom()) {
try {
@@ -119,14 +86,6 @@ public abstract class RemoteBytesSynchronizer extends RemoteSynchronizer {
return false;
}
- /**
- * Return true if the remote resources associated with the given local
- * resource has been fetched. This method is useful for those cases when
- * there are no sync bytes for a remote resource and the client wants to
- * know if this means that the remote does exist (i.e. this method returns
- * <code>true</code>) or the remote has not been fetched (i.e. this method returns
- * <code>false</code>).
- */
public boolean isRemoteKnown(IResource resource) throws TeamException {
return internalGetSyncBytes(resource) != null;
}
@@ -138,23 +97,8 @@ public abstract class RemoteBytesSynchronizer extends RemoteSynchronizer {
* <code>getSyncBytes(resource)</code> will return <code>null</code>.
* @return <code>true</code> if this changes the remote sync bytes
*/
- protected boolean setRemoteDoesNotExist(IResource resource) throws TeamException {
+ public boolean setRemoteDoesNotExist(IResource resource) throws TeamException {
return setSyncBytes(resource, NO_REMOTE);
}
- private boolean equals(byte[] syncBytes, byte[] oldBytes) {
- if (syncBytes.length != oldBytes.length) return false;
- for (int i = 0; i < oldBytes.length; i++) {
- if (oldBytes[i] != syncBytes[i]) return false;
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.RemoteSynchronizer#hasRemote(org.eclipse.core.resources.IResource)
- */
- public boolean hasRemote(IResource resource) throws TeamException {
- return getSyncBytes(resource) != null;
- }
-
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java
index 82bf0d998..90e5c154a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java
@@ -10,20 +10,17 @@
*******************************************************************************/
package org.eclipse.team.internal.core;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFileModificationValidator;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.team.core.Team;
public class DefaultFileModificationValidator implements IFileModificationValidator {
private static final Status OK = Team.OK_STATUS;
private IStatus getDefaultStatus(IFile file) {
- return file.isReadOnly()
- ? new Status(Status.ERROR, TeamPlugin.ID, IResourceStatus.READ_ONLY_LOCAL, Policy.bind("FileModificationValidator.fileIsReadOnly", file.getFullPath().toString()), null) //$NON-NLS-1$
+ return
+ file.isReadOnly()
+ ? new Status(IStatus.ERROR, TeamPlugin.ID, IResourceStatus.READ_ONLY_LOCAL, Policy.bind("FileModificationValidator.fileIsReadOnly", file.getFullPath().toString()), null) //$NON-NLS-1$
: OK;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DeploymentProviderManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DeploymentProviderManager.java
new file mode 100644
index 000000000..7c73245dc
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DeploymentProviderManager.java
@@ -0,0 +1,353 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.core;
+
+import java.io.*;
+import java.util.*;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.ILock;
+import org.eclipse.team.core.*;
+import org.eclipse.team.internal.core.registry.DeploymentProviderDescriptor;
+import org.eclipse.team.internal.core.registry.DeploymentProviderRegistry;
+
+public class DeploymentProviderManager implements IDeploymentProviderManager {
+
+ // key for remembering if state has been loaded for a project
+ private final static QualifiedName STATE_LOADED_KEY = new QualifiedName("org.eclipse.team.core.deployment", "state_restored_key");
+
+ // {project -> list of Mapping}
+ private Map mappings = new HashMap(5);
+
+ // registry for deployment provider extensions
+ private DeploymentProviderRegistry registry;
+
+ // lock to ensure that map/unmap and getProvider support concurrency
+ private static final ILock mappingLock = Platform.getJobManager().newLock();
+
+ // persistence constants
+ private final static String CTX_PROVIDERS = "deploymentProviders"; //$NON-NLS-1$
+ private final static String CTX_PROVIDER = "provider"; //$NON-NLS-1$
+ private final static String CTX_ID = "id"; //$NON-NLS-1$
+ private final static String CTX_PATH = "container_path"; //$NON-NLS-1$
+ private final static String CTX_PROVIDER_DATA = "data"; //$NON-NLS-1$
+ private final static String FILENAME = ".deployments"; //$NON-NLS-1$
+
+ static class Mapping {
+ private DeploymentProviderDescriptor descriptor;
+ private DeploymentProvider provider;
+ private IContainer container;
+ private IMemento savedState;
+
+ Mapping(DeploymentProviderDescriptor descriptor, IContainer container) {
+ this.descriptor = descriptor;
+ this.container = container;
+ }
+ public DeploymentProvider getProvider() throws TeamException {
+ if(provider == null) {
+ try {
+ this.provider = descriptor.createProvider();
+ this.provider.setContainer(container);
+ this.provider.restoreState(savedState);
+ this.savedState = null;
+ } catch (CoreException e) {
+ throw TeamException.asTeamException(e);
+ }
+ }
+ return provider;
+ }
+ public void setProvider(DeploymentProvider provider) {
+ this.provider = provider;
+ this.savedState = null;
+ }
+ public IContainer getContainer() {
+ return container;
+ }
+ public DeploymentProviderDescriptor getDescription() {
+ return descriptor;
+ }
+ public void setProviderState(IMemento savedState) {
+ this.savedState = savedState;
+ }
+ }
+
+ public DeploymentProviderManager() {
+ registry = new DeploymentProviderRegistry();
+ }
+
+ public void map(IContainer container, DeploymentProvider deploymentProvider) throws TeamException {
+ try {
+ mappingLock.acquire();
+ if (!deploymentProvider.isMultipleMappingsSupported()) {
+ // don't allow is overlapping deployment providers of the same type
+ checkOverlapping(container, deploymentProvider.getID());
+ }
+
+ // extension point descriptor must exist
+ DeploymentProviderDescriptor descriptor = registry.find(deploymentProvider.getID());
+ if(descriptor == null) {
+ throw new TeamException("Cannot map provider " + deploymentProvider.getID() + ". It's extension point description cannot be found.");
+ }
+
+ // create the new mapping
+ Mapping m = internalMap(container, descriptor);
+ m.setProvider(deploymentProvider);
+ deploymentProvider.setContainer(container);
+ deploymentProvider.init();
+
+ saveState(container.getProject());
+ // TODO: what kind of event is generated when one is mapped?
+ } finally {
+ mappingLock.release();
+ }
+ }
+
+ public void unmap(IContainer container, DeploymentProvider teamProvider) throws TeamException {
+ try {
+ mappingLock.acquire();
+ IProject project = container.getProject();
+ List projectMaps = internalGetMappings(container);
+ Mapping[] m = internalGetMappingsFor(container, teamProvider.getID());
+ for (int i = 0; i < m.length; i++) {
+ Mapping mapping = m[i];
+ if (mapping.getProvider() == teamProvider) {
+ projectMaps.remove(mapping);
+ if(projectMaps.isEmpty()) {
+ mappings.remove(project);
+ }
+ }
+ }
+
+ // dispose of provider
+ teamProvider.dispose();
+ saveState(container.getProject());
+
+ // TODO: what kind of event is sent when unmapped?
+ } finally {
+ mappingLock.release();
+ }
+ }
+
+ public DeploymentProvider[] getMappings(IResource resource) {
+ List projectMappings = internalGetMappings(resource);
+ String fullPath = resource.getFullPath().toString();
+ List result = new ArrayList();
+ if(projectMappings != null) {
+ for (Iterator it = projectMappings.iterator(); it.hasNext();) {
+ Mapping m = (Mapping) it.next();
+ if(fullPath.startsWith(m.getContainer().getFullPath().toString())) {
+ try {
+ // lazy initialize of provider must be supported
+ // TODO: It is possible that the provider has been unmap concurrently
+ result.add(m.getProvider());
+ } catch (CoreException e) {
+ TeamPlugin.log(e);
+ }
+ }
+ }
+ }
+ return (DeploymentProvider[]) result.toArray(new DeploymentProvider[result.size()]);
+ }
+
+ public DeploymentProvider[] getMappings(IResource resource, String id) {
+ Mapping[] m = internalGetMappingsFor(resource, id);
+ List result = new ArrayList();
+ for (int i = 0; i < m.length; i++) {
+ Mapping mapping = m[i];
+ try {
+ // lazy initialize of provider must be supported
+ // TODO: It is possible that the provider has been unmap concurrently
+ result.add(mapping.getProvider());
+ } catch (TeamException e) {
+ TeamPlugin.log(e);
+ }
+ }
+
+ DeploymentProvider[] providers = (DeploymentProvider[]) result.toArray(new DeploymentProvider[result.size()]);
+ // Ensure that multiple providers are not mapped if it is not supported
+ // by the provider type. This could occur if the deployment configuration
+ // was loaded from a repository or modified manually
+ if (providers.length > 1 && !providers[0].isMultipleMappingsSupported()) {
+ // Log and ignore all but one of the mappings
+ TeamPlugin.log(IStatus.WARNING, "Resource {0} is mapped to multiple deployment providers of type {1}." +resource +id, null);
+ return new DeploymentProvider[] { providers[0] };
+ }
+ return providers;
+ }
+
+ public boolean getMappedTo(IResource resource, String id) {
+ return internalGetMappingsFor(resource, id).length > 0;
+ }
+
+ private void checkOverlapping(IContainer container, String id) throws TeamException {
+ List projectMappings = internalGetMappings(container);
+ String fullPath = container.getFullPath().toString();
+ if(projectMappings != null) {
+ for (Iterator it = projectMappings.iterator(); it.hasNext();) {
+ Mapping m = (Mapping) it.next();
+ String first = m.getContainer().getFullPath().toString();
+ if(fullPath.startsWith(first) || first.startsWith(fullPath)) {
+ if (m.getDescription().getId().equals(id)) {
+ throw new TeamException(container.getFullPath().toString() + " is already mapped to " + m.getDescription().getId());
+ }
+ }
+ }
+ }
+ }
+
+ private Mapping internalMap(IContainer container, DeploymentProviderDescriptor description) {
+ Mapping newMapping = new Mapping(description, container);
+ IProject project = container.getProject();
+ List projectMaps = (List)mappings.get(project);
+ if(projectMaps == null) {
+ projectMaps = new ArrayList();
+ mappings.put(project, projectMaps);
+ }
+ projectMaps.add(newMapping);
+ return newMapping;
+ }
+
+ /*
+ * Loads all the mappings associated with the resource's project.
+ */
+ private List internalGetMappings(IResource resource) {
+ try {
+ mappingLock.acquire();
+ IProject project = resource.getProject();
+ List m = (List)mappings.get(project);
+ try {
+ if(project.getSessionProperty(STATE_LOADED_KEY) != null) {
+ return m;
+ }
+ restoreState(project);
+ project.setSessionProperty(STATE_LOADED_KEY, "true");
+ } catch (TeamException e) {
+ } catch (CoreException e) {
+ }
+ return (List)mappings.get(project);
+ } finally {
+ mappingLock.release();
+ }
+ }
+
+ private Mapping[] internalGetMappingsFor(IResource resource, String id) {
+ List projectMappings = internalGetMappings(resource);
+ List result = new ArrayList();
+ String fullPath = resource.getFullPath().toString();
+ if(projectMappings != null) {
+ for (Iterator it = projectMappings.iterator(); it.hasNext();) {
+ Mapping m = (Mapping) it.next();
+ // mapping can be initialize without having provider loaded yet!
+ if(m.getDescription().getId().equals(id) && fullPath.startsWith(m.getContainer().getFullPath().toString())) {
+ result.add(m);
+ }
+ }
+ }
+ return (Mapping[]) result.toArray(new Mapping[result.size()]);
+ }
+
+ /**
+ * Saves a file containing the list of participant ids that are registered with this
+ * manager. Each participant is also given the chance to save it's state.
+ */
+ private void saveState(IProject project) throws TeamException {
+
+ // TODO: have to handle the whole overwritten - editing crap with this file!!
+ try {
+ XMLMemento xmlMemento = XMLMemento.createWriteRoot(CTX_PROVIDERS);
+ List providers = (List)mappings.get(project);
+ if(providers == null) {
+ IFile settingsFile = project.getFile(FILENAME);
+ if(settingsFile.exists()) {
+ settingsFile.delete(true /* force */, true /* keep history */, null);
+ }
+ } else {
+ for (Iterator it2 = providers.iterator(); it2.hasNext(); ) {
+ Mapping mapping = (Mapping) it2.next();
+ IMemento node = xmlMemento.createChild(CTX_PROVIDER);
+ node.putString(CTX_ID, mapping.getDescription().getId());
+ node.putString(CTX_PATH, mapping.getContainer().getProjectRelativePath().toString());
+ mapping.getProvider().saveState(node.createChild(CTX_PROVIDER_DATA));
+ }
+ IFile settingsFile = project.getFile(FILENAME);
+ if(! settingsFile.exists()) {
+ settingsFile.create(new ByteArrayInputStream(new byte[0]), true, null);
+ }
+ Writer writer = new BufferedWriter(new FileWriter(settingsFile.getLocation().toFile()));
+ try {
+ xmlMemento.save(writer);
+ } finally {
+ writer.close();
+ settingsFile.refreshLocal(IResource.DEPTH_ZERO, null);
+ }
+ }
+ } catch (IOException e) {
+ //TeamPlugin.log(e); //$NON-NLS-1$
+ } catch(CoreException ce) {
+ throw TeamException.asTeamException(ce);
+ }
+ }
+
+ private void restoreState(IProject project) throws TeamException, CoreException {
+ // TODO: have to handle the whole overwritten - editing crap with this file!!
+ IFile file = project.getFile(FILENAME);
+ if(! file.exists()) return;
+ Reader reader;
+ try {
+ reader = new BufferedReader(new FileReader(file.getLocation().toFile()));
+ } catch (FileNotFoundException e) {
+ return;
+ }
+ List participants = new ArrayList();
+ IMemento memento = XMLMemento.createReadRoot(reader);
+ IMemento[] providers = memento.getChildren(CTX_PROVIDER);
+ for (int i = 0; i < providers.length; i++) {
+ IMemento memento2 = providers[i];
+ String id = memento2.getString(CTX_ID);
+ IPath location = new Path(memento2.getString(CTX_PATH));
+
+ if(! project.exists(location)) {
+ TeamPlugin.log(IStatus.ERROR, "resource no longer exists", null);
+ }
+ IContainer container = location.isEmpty() ? (IContainer)project : project.getFolder(location);
+ DeploymentProviderDescriptor desc = registry.find(id);
+ if(desc != null) {
+ Mapping m = internalMap(container, desc);
+ m.setProviderState(memento2.getChild(CTX_PROVIDER_DATA));
+ } else {
+ TeamPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.9", id), null); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.IDeploymentProviderManager#getDeploymentProviderRoots(java.lang.String)
+ */
+ public IResource[] getDeploymentProviderRoots(String id) {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ Set roots = new HashSet();
+ for (int i = 0; i < projects.length; i++) {
+ IProject project = projects[i];
+ List mappings = internalGetMappings(project);
+ if (mappings != null) {
+ for (Iterator iter = mappings.iterator(); iter.hasNext();) {
+ Mapping mapping = (Mapping) iter.next();
+ if (id == null || mapping.getDescription().getId().equals(id)) {
+ roots.add(mapping.getContainer());
+ }
+ }
+ }
+ }
+ return (IResource[]) roots.toArray(new IResource[roots.size()]);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Sorter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Sorter.java
new file mode 100644
index 000000000..475370c94
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Sorter.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.core;
+
+/**
+ * The SortOperation takes a collection of objects and returns
+ * a sorted collection of these objects. Concrete instances of this
+ * class provide the criteria for the sorting of the objects based on
+ * the type of the objects.
+ */
+public abstract class Sorter {
+ /**
+ * Returns true is elementTwo is 'greater than' elementOne
+ * This is the 'ordering' method of the sort operation.
+ * Each subclass overides this method with the particular
+ * implementation of the 'greater than' concept for the
+ * objects being sorted.
+ */
+ public abstract boolean compare(Object elementOne, Object elementTwo);
+ /**
+ * Sort the objects in sorted collection and return that collection.
+ */
+ private Object[] quickSort(Object[] sortedCollection, int left, int right) {
+ int originalLeft = left;
+ int originalRight = right;
+ Object mid = sortedCollection[ (left + right) / 2];
+ do {
+ while (compare(sortedCollection[left], mid))
+ left++;
+ while (compare(mid, sortedCollection[right]))
+ right--;
+ if (left <= right) {
+ Object tmp = sortedCollection[left];
+ sortedCollection[left] = sortedCollection[right];
+ sortedCollection[right] = tmp;
+ left++;
+ right--;
+ }
+ } while (left <= right);
+ if (originalLeft < right)
+ sortedCollection = quickSort(sortedCollection, originalLeft, right);
+ if (left < originalRight)
+ sortedCollection = quickSort(sortedCollection, left, originalRight);
+ return sortedCollection;
+ }
+ /**
+ * Return a new sorted collection from this unsorted collection.
+ * Sort using quick sort.
+ */
+ public Object[] sort(Object[] unSortedCollection) {
+ int size = unSortedCollection.length;
+ Object[] sortedCollection = new Object[size];
+ //copy the array so can return a new sorted collection
+ System.arraycopy(unSortedCollection, 0, sortedCollection, 0, size);
+ if (size > 1)
+ quickSort(sortedCollection, 0, size - 1);
+ return sortedCollection;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/XMLMemento.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/XMLMemento.java
new file mode 100644
index 000000000..8d8984c24
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/XMLMemento.java
@@ -0,0 +1,407 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.core;
+
+import java.io.*;
+import java.util.ArrayList;
+
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.team.core.IMemento;
+import org.eclipse.team.core.TeamException;
+import org.w3c.dom.*;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * This class represents the default implementation of the
+ * <code>IMemento</code> interface.
+ * <p>
+ * This class is not intended to be extended by clients.
+ * </p>
+ * [Note: This class has been copied from org.eclipse.ui to get a quick and
+ * dirty xml input/output code. This should be purged once the settings
+ * work is complete]
+ * @see IMemento
+ */
+public final class XMLMemento implements IMemento {
+ private Document factory;
+ private Element element;
+
+ /**
+ * Creates a <code>Document</code> from the <code>Reader</code>
+ * and returns a memento on the first <code>Element</code> for reading
+ * the document.
+ * <p>
+ * Same as calling createReadRoot(reader, null)
+ * </p>
+ *
+ * @param reader the <code>Reader</code> used to create the memento's document
+ * @return a memento on the first <code>Element</code> for reading the document
+ * @throws <code>WorkbenchException</code> if IO problems, invalid format, or no element.
+ */
+ public static XMLMemento createReadRoot(Reader reader) throws TeamException {
+ return createReadRoot(reader, null);
+ }
+
+ /**
+ * Creates a <code>Document</code> from the <code>Reader</code>
+ * and returns a memento on the first <code>Element</code> for reading
+ * the document.
+ *
+ * @param reader the <code>Reader</code> used to create the memento's document
+ * @param baseDir the directory used to resolve relative file names
+ * in the XML document. This directory must exist and include the
+ * trailing separator. The directory format, including the separators,
+ * must be valid for the platform. Can be <code>null</code> if not
+ * needed.
+ * @return a memento on the first <code>Element</code> for reading the document
+ * @throws <code>WorkbenchException</code> if IO problems, invalid format, or no element.
+ */
+ public static XMLMemento createReadRoot(Reader reader, String baseDir) throws TeamException {
+ String messageKey = "XMLMemento.noElement"; //$NON-NLS-1$
+ Exception exception = null;
+
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder parser = factory.newDocumentBuilder();
+ InputSource source = new InputSource(reader);
+ if (baseDir != null)
+ source.setSystemId(baseDir);
+ Document document = parser.parse(source);
+ NodeList list = document.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+ if (node instanceof Element)
+ return new XMLMemento(document, (Element) node);
+ }
+ } catch (ParserConfigurationException e) {
+ exception = e;
+ messageKey = "XMLMemento.parserConfigError"; //$NON-NLS-1$
+ } catch (IOException e) {
+ exception = e;
+ messageKey = "XMLMemento.ioError"; //$NON-NLS-1$
+ } catch (SAXException e) {
+ exception = e;
+ messageKey = "XMLMemento.formatError"; //$NON-NLS-1$
+ }
+
+ String problemText = null;
+ if (exception != null)
+ problemText = exception.getMessage();
+ //if (problemText == null || problemText.length() == 0)
+ // problemText = TeamException.getString(messageKey);
+ throw new TeamException(problemText);
+ }
+
+ /**
+ * Returns a root memento for writing a document.
+ *
+ * @param type the element node type to create on the document
+ * @return the root memento for writing a document
+ */
+ public static XMLMemento createWriteRoot(String type) {
+ Document document;
+ try {
+ document = DocumentBuilderFactory
+ .newInstance()
+ .newDocumentBuilder()
+ .newDocument();
+ Element element = document.createElement(type);
+ document.appendChild(element);
+ return new XMLMemento(document, element);
+ }
+ catch (ParserConfigurationException e) {
+ throw new Error(e);
+ }
+ }
+
+ /**
+ * Creates a memento for the specified document and element.
+ * <p>
+ * Clients should use <code>createReadRoot</code> and
+ * <code>createWriteRoot</code> to create the initial
+ * memento on a document.
+ * </p>
+ *
+ * @param document the document for the memento
+ * @param element the element node for the memento
+ */
+ public XMLMemento(Document document, Element element) {
+ super();
+ this.factory = document;
+ this.element = element;
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public IMemento createChild(String type) {
+ Element child = factory.createElement(type);
+ element.appendChild(child);
+ return new XMLMemento(factory, child);
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public IMemento createChild(String type, String id) {
+ Element child = factory.createElement(type);
+ child.setAttribute(TAG_ID, id == null ? "" : id); //$NON-NLS-1$
+ element.appendChild(child);
+ return new XMLMemento(factory, child);
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public IMemento copyChild(IMemento child) {
+ Element childElement = ((XMLMemento) child).element;
+ Element newElement = (Element) factory.importNode(childElement, true);
+ element.appendChild(newElement);
+ return new XMLMemento(factory, newElement);
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public IMemento getChild(String type) {
+
+ // Get the nodes.
+ NodeList nodes = element.getChildNodes();
+ int size = nodes.getLength();
+ if (size == 0)
+ return null;
+
+ // Find the first node which is a child of this node.
+ for (int nX = 0; nX < size; nX++) {
+ Node node = nodes.item(nX);
+ if (node instanceof Element) {
+ Element element = (Element) node;
+ if (element.getNodeName().equals(type))
+ return new XMLMemento(factory, element);
+ }
+ }
+
+ // A child was not found.
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public IMemento[] getChildren(String type) {
+
+ // Get the nodes.
+ NodeList nodes = element.getChildNodes();
+ int size = nodes.getLength();
+ if (size == 0)
+ return new IMemento[0];
+
+ // Extract each node with given type.
+ ArrayList list = new ArrayList(size);
+ for (int nX = 0; nX < size; nX++) {
+ Node node = nodes.item(nX);
+ if (node instanceof Element) {
+ Element element = (Element) node;
+ if (element.getNodeName().equals(type))
+ list.add(element);
+ }
+ }
+
+ // Create a memento for each node.
+ size = list.size();
+ IMemento[] results = new IMemento[size];
+ for (int x = 0; x < size; x++) {
+ results[x] = new XMLMemento(factory, (Element) list.get(x));
+ }
+ return results;
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public Float getFloat(String key) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null)
+ return null;
+ String strValue = attr.getValue();
+ try {
+ return new Float(strValue);
+ } catch (NumberFormatException e) {
+ TeamPlugin.log(IStatus.ERROR, "Memento problem - Invalid float for key: " //$NON-NLS-1$
+ + key + " value: " + strValue, null); //$NON-NLS-1$
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public String getID() {
+ return element.getAttribute(TAG_ID);
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public Integer getInteger(String key) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null)
+ return null;
+ String strValue = attr.getValue();
+ try {
+ return new Integer(strValue);
+ } catch (NumberFormatException e) {
+ TeamPlugin.log(IStatus.ERROR, "Memento problem - invalid integer for key: " + key //$NON-NLS-1$
+ + " value: " + strValue, null); //$NON-NLS-1$
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public String getString(String key) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null)
+ return null;
+ return attr.getValue();
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public String getTextData() {
+ Text textNode = getTextNode();
+ if (textNode != null) {
+ return textNode.getData();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the Text node of the memento. Each memento is allowed only
+ * one Text node.
+ *
+ * @return the Text node of the memento, or <code>null</code> if
+ * the memento has no Text node.
+ */
+ private Text getTextNode() {
+ // Get the nodes.
+ NodeList nodes = element.getChildNodes();
+ int size = nodes.getLength();
+ if (size == 0)
+ return null;
+ for (int nX = 0; nX < size; nX++) {
+ Node node = nodes.item(nX);
+ if (node instanceof Text) {
+ return (Text) node;
+ }
+ }
+ // a Text node was not found
+ return null;
+ }
+
+ /**
+ * Places the element's attributes into the document.
+ */
+ private void putElement(Element element) {
+ NamedNodeMap nodeMap = element.getAttributes();
+ int size = nodeMap.getLength();
+ for (int i = 0; i < size; i++) {
+ Attr attr = (Attr) nodeMap.item(i);
+ putString(attr.getName(), attr.getValue());
+ }
+
+ NodeList nodes = element.getChildNodes();
+ size = nodes.getLength();
+ for (int i = 0; i < size; i++) {
+ Node node = nodes.item(i);
+ if (node instanceof Element) {
+ XMLMemento child = (XMLMemento) createChild(node.getNodeName());
+ child.putElement((Element) node);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public void putFloat(String key, float f) {
+ element.setAttribute(key, String.valueOf(f));
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public void putInteger(String key, int n) {
+ element.setAttribute(key, String.valueOf(n));
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public void putMemento(IMemento memento) {
+ putElement(((XMLMemento) memento).element);
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public void putString(String key, String value) {
+ if (value == null)
+ return;
+ element.setAttribute(key, value);
+ }
+
+ /* (non-Javadoc)
+ * Method declared in IMemento.
+ */
+ public void putTextData(String data) {
+ Text textNode = getTextNode();
+ if (textNode == null) {
+ textNode = factory.createTextNode(data);
+ element.appendChild(textNode);
+ } else {
+ textNode.setData(data);
+ }
+ }
+
+ /**
+ * Saves this memento's document current values to the
+ * specified writer.
+ *
+ * @param writer the writer used to save the memento's document
+ * @throws IOException if there is a problem serializing the document to the stream.
+ */
+ public void save(Writer writer) throws IOException {
+ Result result = new StreamResult(writer);
+ Source source = new DOMSource(factory);
+ try {
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
+ transformer.transform(source, result);
+ }
+ catch (TransformerConfigurationException e) {
+ throw (IOException) (new IOException().initCause(e));
+ }
+ catch (TransformerException e) {
+ throw (IOException) (new IOException().initCause(e));
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderDescriptor.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderDescriptor.java
new file mode 100644
index 000000000..980c73871
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderDescriptor.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.core.registry;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.core.DeploymentProvider;
+
+public class DeploymentProviderDescriptor {
+
+ public static final String ATT_ID = "id"; //$NON-NLS-1$
+ public static final String ATT_NAME = "name"; //$NON-NLS-1$
+ public static final String ATT_CLASS = "class"; //$NON-NLS-1$
+
+ private String name;
+ private String className;
+ private String id;
+ private String description;
+
+ private IConfigurationElement configElement;
+
+ /**
+ * Create a new ViewDescriptor for an extension.
+ */
+ public DeploymentProviderDescriptor(IConfigurationElement e, String desc) throws CoreException {
+ configElement = e;
+ description = desc;
+ loadFromExtension();
+ }
+
+
+ public IConfigurationElement getConfigurationElement() {
+ return configElement;
+ }
+
+ public DeploymentProvider createProvider() throws CoreException {
+ return (DeploymentProvider)configElement.createExecutableExtension(ATT_CLASS);
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ private void loadFromExtension() throws CoreException {
+ String identifier = configElement.getAttribute(ATT_ID);
+ name = configElement.getAttribute(ATT_NAME);
+ className = configElement.getAttribute(ATT_CLASS);
+
+ // Sanity check.
+ if ((name == null) || (className == null) || (identifier == null)) {
+ throw new CoreException(new Status(IStatus.ERROR, configElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier(), 0, "Invalid extension (missing label or class name): " + id, //$NON-NLS-1$
+ null));
+ }
+
+ id = identifier;
+ }
+
+ /**
+ * Returns a string representation of this descriptor. For debugging
+ * purposes only.
+ */
+ public String toString() {
+ return "Team Provider(" + getId() + ")"; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderRegistry.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderRegistry.java
new file mode 100644
index 000000000..09beff082
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/DeploymentProviderRegistry.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.core.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.internal.core.TeamPlugin;
+
+public class DeploymentProviderRegistry extends RegistryReader {
+
+ private final static String PT_TEAMPROVIDER = "deployment"; //$NON-NLS-1$
+ private Map providers = new HashMap();
+ private String extensionId;
+
+ public DeploymentProviderRegistry() {
+ super();
+ this.extensionId = PT_TEAMPROVIDER;
+ readRegistry(Platform.getPluginRegistry(), TeamPlugin.ID, PT_TEAMPROVIDER);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.registry.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ protected boolean readElement(IConfigurationElement element) {
+ if (element.getName().equals(extensionId)) {
+ String descText = getDescription(element);
+ DeploymentProviderDescriptor desc;
+ try {
+ desc = new DeploymentProviderDescriptor(element, descText);
+ providers.put(desc.getId(), desc);
+ } catch (CoreException e) {
+ TeamPlugin.log(e);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public DeploymentProviderDescriptor[] getTeamProviderDescriptors() {
+ return (DeploymentProviderDescriptor[])providers.values().toArray(new DeploymentProviderDescriptor[providers.size()]);
+ }
+
+ public DeploymentProviderDescriptor find(String id) {
+ return (DeploymentProviderDescriptor)providers.get(id);
+ }
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/RegistryReader.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/RegistryReader.java
new file mode 100644
index 000000000..afb5dbef1
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/registry/RegistryReader.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.core.registry;
+
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.internal.core.Sorter;
+import org.eclipse.team.internal.core.TeamPlugin;
+
+public abstract class RegistryReader {
+ protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
+ protected static Hashtable extensionPoints = new Hashtable();
+ /**
+ * The constructor.
+ */
+ protected RegistryReader() {
+ }
+ /**
+ * This method extracts description as a subelement of the given element.
+ *
+ * @return description string if defined, or empty string if not.
+ */
+ protected String getDescription(IConfigurationElement config) {
+ IConfigurationElement[] children = config.getChildren(TAG_DESCRIPTION);
+ if (children.length >= 1) {
+ return children[0].getValue();
+ }
+ return ""; //$NON-NLS-1$
+ }
+ /**
+ * Logs the error in the workbench log using the provided text and the
+ * information in the configuration element.
+ */
+ protected void logError(IConfigurationElement element, String text) {
+ IExtension extension = element.getDeclaringExtension();
+ IPluginDescriptor descriptor = extension.getDeclaringPluginDescriptor();
+ StringBuffer buf = new StringBuffer();
+ buf.append("Plugin " + descriptor.getUniqueIdentifier() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-2$//$NON-NLS-1$
+ buf.append("\n" + text); //$NON-NLS-1$
+ TeamPlugin.log(IStatus.ERROR, buf.toString(), null);
+ }
+ /**
+ * Logs a very common registry error when a required attribute is missing.
+ */
+ protected void logMissingAttribute(IConfigurationElement element, String attributeName) {
+ logError(element, "Required attribute '" + attributeName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$
+ }
+
+ /**
+ * Logs a very common registry error when a required child is missing.
+ */
+ protected void logMissingElement(IConfigurationElement element, String elementName) {
+ logError(element, "Required sub element '" + elementName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$
+ }
+
+ /**
+ * Logs a registry error when the configuration element is unknown.
+ */
+ protected void logUnknownElement(IConfigurationElement element) {
+ logError(element, "Unknown extension tag found: " + element.getName()); //$NON-NLS-1$
+ }
+ /**
+ * Apply a reproducable order to the list of extensions provided, such that
+ * the order will not change as extensions are added or removed.
+ */
+ protected IExtension[] orderExtensions(IExtension[] extensions) {
+ // By default, the order is based on plugin id sorted
+ // in ascending order. The order for a plugin providing
+ // more than one extension for an extension point is
+ // dependent in the order listed in the XML file.
+ Sorter sorter = new Sorter() {
+ public boolean compare(Object extension1, Object extension2) {
+ String s1 = ((IExtension) extension1).getDeclaringPluginDescriptor().getUniqueIdentifier();
+ String s2 = ((IExtension) extension2).getDeclaringPluginDescriptor().getUniqueIdentifier();
+ //Return true if elementTwo is 'greater than' elementOne
+ return s2.compareToIgnoreCase(s1) > 0;
+ }
+ };
+
+ Object[] sorted = sorter.sort(extensions);
+ IExtension[] sortedExtension = new IExtension[sorted.length];
+ System.arraycopy(sorted, 0, sortedExtension, 0, sorted.length);
+ return sortedExtension;
+ }
+ /**
+ * Implement this method to read element's attributes. If children should
+ * also be read, then implementor is responsible for calling <code>readElementChildren</code>.
+ * Implementor is also responsible for logging missing attributes.
+ *
+ * @return true if element was recognized, false if not.
+ */
+ protected abstract boolean readElement(IConfigurationElement element);
+ /**
+ * Read the element's children. This is called by the subclass' readElement
+ * method when it wants to read the children of the element.
+ */
+ protected void readElementChildren(IConfigurationElement element) {
+ readElements(element.getChildren());
+ }
+ /**
+ * Read each element one at a time by calling the subclass implementation
+ * of <code>readElement</code>.
+ *
+ * Logs an error if the element was not recognized.
+ */
+ protected void readElements(IConfigurationElement[] elements) {
+ for (int i = 0; i < elements.length; i++) {
+ if (!readElement(elements[i]))
+ logUnknownElement(elements[i]);
+ }
+ }
+ /**
+ * Read one extension by looping through its configuration elements.
+ */
+ protected void readExtension(IExtension extension) {
+ readElements(extension.getConfigurationElements());
+ }
+ /**
+ * Start the registry reading process using the supplied plugin ID and
+ * extension point.
+ */
+ public void readRegistry(IPluginRegistry registry, String pluginId, String extensionPoint) {
+ String pointId = pluginId + "-" + extensionPoint; //$NON-NLS-1$
+ IExtension[] extensions = (IExtension[]) extensionPoints.get(pointId);
+ if (extensions == null) {
+ IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
+ if (point == null)
+ return;
+ extensions = point.getExtensions();
+ extensionPoints.put(pointId, extensions);
+ }
+ for (int i = 0; i < extensions.length; i++)
+ readExtension(extensions[i]);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
index 02ed6dbb6..1eaf73a93 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
@@ -16,7 +16,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.subscribers.BackgroundEventHandler.Event;
import org.eclipse.team.internal.core.Policy;
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
index ade5da706..3dd14c3b1 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
@@ -17,9 +17,9 @@ import org.eclipse.core.runtime.*;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.MergedSynchronizer;
-import org.eclipse.team.internal.ccvs.core.syncinfo.RemoteTagSynchronizer;
+import org.eclipse.team.core.subscribers.utils.SynchronizationCache;
+import org.eclipse.team.core.subscribers.utils.SynchronizationSyncBytesCache;
+import org.eclipse.team.internal.ccvs.core.syncinfo.CVSSynchronizationCache;
/**
* A CVSMergeSubscriber is responsible for maintaining the remote trees for a merge into
@@ -45,9 +45,9 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
private CVSTag start, end;
private List roots;
- private RemoteTagSynchronizer remoteSynchronizer;
- private RemoteBytesSynchronizer mergedSynchronizer;
- private RemoteTagSynchronizer baseSynchronizer;
+ private SynchronizationCache remoteSynchronizer;
+ private SynchronizationSyncBytesCache mergedSynchronizer;
+ private SynchronizationCache baseSynchronizer;
private static final byte[] NO_REMOTE = new byte[0];
@@ -56,8 +56,8 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
this.comparisonCriteria = new ContentComparisonCriteria(false /* don't ignore whitespace */);
}
- protected IResource[] refreshRemote(IResource resource, int depth, IProgressMonitor monitor) throws TeamException {
- IResource[] remoteChanges = super.refreshRemote(resource, depth, monitor);
+ protected IResource[] refreshRemote(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
+ IResource[] remoteChanges = super.refreshRemote(resources, depth, monitor);
adjustMergedResources(remoteChanges);
return remoteChanges;
}
@@ -88,15 +88,15 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
private void initialize() {
QualifiedName id = getId();
String syncKeyPrefix = id.getLocalName();
- remoteSynchronizer = new RemoteTagSynchronizer(syncKeyPrefix + end.getName(), end);
- baseSynchronizer = new RemoteTagSynchronizer(syncKeyPrefix + start.getName(), start);
- mergedSynchronizer = new MergedSynchronizer(syncKeyPrefix + "0merged"); //$NON-NLS-1$
+ remoteSynchronizer = new CVSSynchronizationCache(new QualifiedName(SYNC_KEY_QUALIFIER, syncKeyPrefix + end.getName()));
+ baseSynchronizer = new CVSSynchronizationCache(new QualifiedName(SYNC_KEY_QUALIFIER, syncKeyPrefix + start.getName()));
+ mergedSynchronizer = new SynchronizationSyncBytesCache(new QualifiedName(SYNC_KEY_QUALIFIER, syncKeyPrefix + "0merged")); //$NON-NLS-1$
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().addListener(this);
}
- protected SyncInfo getSyncInfo(IResource local, IRemoteResource base, IRemoteResource remote) throws TeamException {
+ protected SyncInfo getSyncInfo(IResource local, ISubscriberResource base, ISubscriberResource remote) throws TeamException {
return new CVSMergeSyncInfo(local, base, remote, this);
}
@@ -116,8 +116,7 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
/* (non-Javadoc)
* @see org.eclipse.team.core.sync.TeamSubscriber#cancel()
*/
- public void cancel() {
- super.cancel();
+ public void cancel() {
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
remoteSynchronizer.dispose();
baseSynchronizer.dispose();
@@ -132,24 +131,10 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
}
/* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getRemoteSynchronizer()
- */
- protected RemoteSynchronizer getRemoteSynchronizer() {
- return remoteSynchronizer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getBaseSynchronizer()
- */
- protected RemoteSynchronizer getBaseSynchronizer() {
- return baseSynchronizer;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.team.core.sync.TeamSubscriber#isSupervised(org.eclipse.core.resources.IResource)
*/
public boolean isSupervised(IResource resource) throws TeamException {
- return getBaseSynchronizer().hasRemote(resource) || getRemoteSynchronizer().hasRemote(resource);
+ return getBaseSynchronizationCache().getSyncBytes(resource) != null || getRemoteSynchronizationCache().getSyncBytes(resource) != null;
}
public CVSTag getStartTag() {
@@ -240,5 +225,33 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
*/
public IComparisonCriteria getDefaultComparisonCriteria() {
return comparisonCriteria;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getRemoteTag()
+ */
+ protected CVSTag getRemoteTag() {
+ return getEndTag();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getBaseTag()
+ */
+ protected CVSTag getBaseTag() {
+ return getStartTag();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getBaseSynchronizationCache()
+ */
+ protected SynchronizationCache getBaseSynchronizationCache() {
+ return baseSynchronizer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getRemoteSynchronizationCache()
+ */
+ protected SynchronizationCache getRemoteSynchronizationCache() {
+ return remoteSynchronizer;
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSyncInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSyncInfo.java
index e743f71b7..2e9615455 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSyncInfo.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSyncInfo.java
@@ -9,9 +9,7 @@ package org.eclipse.team.internal.ccvs.core;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.core.sync.IRemoteResource;
+import org.eclipse.team.core.subscribers.*;
/**
* @author JLemieux
@@ -48,7 +46,7 @@ public class CVSMergeSyncInfo extends CVSSyncInfo {
return kind;
}
- public CVSMergeSyncInfo(IResource local, IRemoteResource base, IRemoteResource remote, TeamSubscriber subscriber) throws TeamException {
+ public CVSMergeSyncInfo(IResource local, ISubscriberResource base, ISubscriberResource remote, TeamSubscriber subscriber) throws TeamException {
super(local, base, remote, subscriber);
}
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 cccd01e34..d8cab884a 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
@@ -38,7 +38,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.Team;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.RemoteContentsCache;
+import org.eclipse.team.core.subscribers.RemoteContentsCache;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.client.Command.QuietOption;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java
index 9a1cd33e8..6898416c9 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java
@@ -13,7 +13,6 @@ package org.eclipse.team.internal.ccvs.core;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.subscribers.IComparisonCriteria;
-import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
@@ -25,10 +24,10 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
* @see ComparisonCriteria#compare(Object, Object, IProgressMonitor)
*/
public boolean compare(Object e1, Object e2) {
- if(e1 instanceof IResource && e2 instanceof IRemoteResource) {
- return compare((IResource)e1, (IRemoteResource)e2);
- } else if(e1 instanceof IRemoteResource && e2 instanceof IRemoteResource) {
- return compare((IRemoteResource)e1, (IRemoteResource)e2);
+ if(e1 instanceof IResource && e2 instanceof ICVSRemoteResource) {
+ return compare((IResource)e1, (ICVSRemoteResource)e2);
+ } else if(e1 instanceof ICVSRemoteResource && e2 instanceof ICVSRemoteResource) {
+ return compare((ICVSRemoteResource)e1, (ICVSRemoteResource)e2);
}
return false;
}
@@ -36,7 +35,7 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
/**
* @see RemoteSyncElement#timestampEquals(IRemoteResource, IRemoteResource)
*/
- protected boolean compare(IRemoteResource e1, IRemoteResource e2) {
+ protected boolean compare(ICVSRemoteResource e1, ICVSRemoteResource e2) {
if(e1.isContainer()) {
if(e2.isContainer()) {
return true;
@@ -49,7 +48,7 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
/**
* @see RemoteSyncElement#timestampEquals(IResource, IRemoteResource)
*/
- protected boolean compare(IResource e1, IRemoteResource e2) {
+ protected boolean compare(IResource e1, ICVSRemoteResource e2) {
if(e1.getType() != IResource.FILE) {
if(e2.isContainer()) {
return true;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java
index e46fbaeb6..011510d19 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java
@@ -15,9 +15,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.core.sync.IRemoteResource;
+import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.internal.ccvs.core.client.Update;
import org.eclipse.team.internal.ccvs.core.resources.*;
import org.eclipse.team.internal.ccvs.core.syncinfo.*;
@@ -38,7 +36,7 @@ public class CVSSyncInfo extends SyncInfo {
private static final int REMOTE_DOES_NOT_EXIST = 4;
private static final int SYNC_INFO_CONFLICTS = 5;
- public CVSSyncInfo(IResource local, IRemoteResource base, IRemoteResource remote, TeamSubscriber subscriber) throws TeamException {
+ public CVSSyncInfo(IResource local, ISubscriberResource base, ISubscriberResource remote, TeamSubscriber subscriber) throws TeamException {
super(local, base, remote, subscriber);
}
@@ -97,7 +95,7 @@ public class CVSSyncInfo extends SyncInfo {
// 2. Set the CVS specific sync type based on the workspace sync state provided
// by the CVS server.
- IRemoteResource remote = getRemote();
+ ISubscriberResource remote = getRemote();
if(remote!=null && (kind & SyncInfo.PSEUDO_CONFLICT) == 0) {
RemoteResource cvsRemote = (RemoteResource)remote;
int type = cvsRemote.getWorkspaceSyncState();
@@ -317,8 +315,8 @@ public class CVSSyncInfo extends SyncInfo {
}
public String toString() {
- IRemoteResource base = getBase();
- IRemoteResource remote = getRemote();
+ ISubscriberResource base = getBase();
+ ISubscriberResource remote = getRemote();
StringBuffer result = new StringBuffer(super.toString());
result.append("Local: "); //$NON-NLS-1$
result.append(getLocal().toString());
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java
index 8bb686e24..444d2c287 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java
@@ -12,19 +12,23 @@ package org.eclipse.team.internal.ccvs.core;
import java.util.*;
-import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.runtime.*;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.core.subscribers.utils.*;
+import org.eclipse.team.internal.ccvs.core.resources.*;
+import org.eclipse.team.internal.ccvs.core.syncinfo.CVSRefreshOperation;
/**
* This class provides common funtionality for three way sychronizing
* for CVS.
*/
-public abstract class CVSSyncTreeSubscriber extends TeamSubscriber {
+public abstract class CVSSyncTreeSubscriber extends SyncTreeSubscriber {
+
+ public static final String SYNC_KEY_QUALIFIER = "org.eclipse.team.cvs"; //$NON-NLS-1$
private QualifiedName id;
private String name;
@@ -58,49 +62,6 @@ public abstract class CVSSyncTreeSubscriber extends TeamSubscriber {
}
/* (non-Javadoc)
- * @see org.eclipse.team.core.sync.TeamSubscriber#members(org.eclipse.core.resources.IResource)
- */
- public IResource[] members(IResource resource) throws TeamException {
- if(resource.getType() == IResource.FILE) {
- return new IResource[0];
- }
- try {
- // Filter and return only phantoms associated with the remote synchronizer.
- IResource[] members;
- try {
- members = ((IContainer)resource).members(true /* include phantoms */);
- } catch (CoreException e) {
- if (!isSupervised(resource) || e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
- // The resource is no longer supervised or doesn't exist in any form
- // so ignore the exception and return that there are no members
- return new IResource[0];
- }
- throw e;
- }
- List filteredMembers = new ArrayList(members.length);
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
-
- // TODO: consider that there may be several sync states on this resource. There
- // should instead be a method to check for the existance of a set of sync types on
- // a resource.
- if(member.isPhantom() && !getRemoteSynchronizer().hasRemote(member)) {
- continue;
- }
-
- // TODO: Is this a valid use of isSupervised
- if (isSupervised(resource)) {
- filteredMembers.add(member);
- }
- }
- return (IResource[]) filteredMembers.toArray(new IResource[filteredMembers.size()]);
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
-
- }
-
- /* (non-Javadoc)
* @see org.eclipse.team.core.sync.TeamSubscriber#roots()
*/
public IResource[] roots() {
@@ -108,40 +69,19 @@ public abstract class CVSSyncTreeSubscriber extends TeamSubscriber {
}
/* (non-Javadoc)
- * @see org.eclipse.team.core.sync.ISyncTreeSubscriber#getRemoteResource(org.eclipse.core.resources.IResource)
- */
- public IRemoteResource getRemoteResource(IResource resource) throws TeamException {
- return getRemoteSynchronizer().getRemoteResource(resource);
- }
-
- public IRemoteResource getBaseResource(IResource resource) throws TeamException {
- return getBaseSynchronizer().getRemoteResource(resource);
- }
-
- /**
- * Return the synchronizer that provides the remote resources
- */
- protected abstract RemoteSynchronizer getRemoteSynchronizer();
- /**
- * Return the synchronizer that provides the base resources
- */
- protected abstract RemoteSynchronizer getBaseSynchronizer();
-
- /* (non-Javadoc)
* @see org.eclipse.team.core.sync.ISyncTreeSubscriber#getSyncInfo(org.eclipse.core.resources.IResource)
*/
public SyncInfo getSyncInfo(IResource resource) throws TeamException {
if (!isSupervised(resource)) return null;
- IRemoteResource remoteResource = getRemoteResource(resource);
if(resource.getType() == IResource.FILE) {
- IRemoteResource baseResource = getBaseResource(resource);
- return getSyncInfo(resource, baseResource, remoteResource);
+ return super.getSyncInfo(resource);
} else {
// In CVS, folders do not have a base. Hence, the remote is used as the base.
+ ISubscriberResource remoteResource = getRemoteResource(resource);
return getSyncInfo(resource, remoteResource, remoteResource);
}
}
-
+
/**
* Method that creates an instance of SyncInfo for the provider local, base and remote.
* Can be overiden by subclasses.
@@ -151,8 +91,8 @@ public abstract class CVSSyncTreeSubscriber extends TeamSubscriber {
* @param monitor
* @return
*/
- protected SyncInfo getSyncInfo(IResource local, IRemoteResource base, IRemoteResource remote) throws TeamException {
- return new CVSSyncInfo(local, base, remote, this);
+ protected SyncInfo getSyncInfo(IResource local, ISubscriberResource base, ISubscriberResource remote) throws TeamException {
+ return new CVSSyncInfo(local, base, remote, this);
}
/* (non-Javadoc)
@@ -187,8 +127,8 @@ public abstract class CVSSyncTreeSubscriber extends TeamSubscriber {
int baseWork = getCacheFileContentsHint() ? 10 : 30;
int remoteWork = 100;
monitor.beginTask(null, baseWork + remoteWork);
- IResource[] baseChanges = refreshBase(resource, depth, Policy.subMonitorFor(monitor, baseWork));
- IResource[] remoteChanges = refreshRemote(resource, depth, Policy.subMonitorFor(monitor, remoteWork));
+ IResource[] baseChanges = refreshBase(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, baseWork));
+ IResource[] remoteChanges = refreshRemote(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, remoteWork));
Set allChanges = new HashSet();
allChanges.addAll(Arrays.asList(remoteChanges));
@@ -202,18 +142,32 @@ public abstract class CVSSyncTreeSubscriber extends TeamSubscriber {
monitor.done();
}
}
- protected IResource[] refreshBase(IResource resource, int depth, IProgressMonitor monitor) throws TeamException {
- return getBaseSynchronizer().refresh(resource, depth, getCacheFileContentsHint(), monitor);
+
+ /**
+ * TODO: Temporary
+ */
+ protected boolean getCacheFileContentsHint() {
+ return false;
}
- protected IResource[] refreshRemote(IResource resource, int depth, IProgressMonitor monitor) throws TeamException {
- return getRemoteSynchronizer().refresh(resource, depth, getCacheFileContentsHint(), monitor);
+ protected IResource[] refreshBase(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
+ return new CVSRefreshOperation(getBaseSynchronizationCache(), null, getBaseTag()).refresh(resources, depth, getCacheFileContentsHint(), monitor);
}
- private boolean getCacheFileContentsHint() {
- return false;
+ protected IResource[] refreshRemote(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
+ return new CVSRefreshOperation(getRemoteSynchronizationCache(), getBaseSynchronizationCache(), getRemoteTag()).refresh(resources, depth, getCacheFileContentsHint(), monitor);
}
+ /**
+ * Return the tag associated with the base tree. t is used by the refreshBase method.
+ */
+ protected abstract CVSTag getRemoteTag();
+
+ /**
+ * Return the tag associated with the base tree. t is used by the refreshRemote method.
+ */
+ protected abstract CVSTag getBaseTag();
+
/* (non-Javadoc)
* @see org.eclipse.team.core.sync.ISyncTreeSubscriber#isSupervised(org.eclipse.core.resources.IResource)
*/
@@ -226,7 +180,7 @@ public abstract class CVSSyncTreeSubscriber extends TeamSubscriber {
ICVSResource cvsThing = CVSWorkspaceRoot.getCVSResourceFor(resource);
if (cvsThing.isIgnored()) {
// An ignored resource could have an incoming addition (conflict)
- return getRemoteSynchronizer().hasRemote(resource);
+ return hasRemote(resource);
}
return true;
} catch (TeamException e) {
@@ -245,18 +199,60 @@ public abstract class CVSSyncTreeSubscriber extends TeamSubscriber {
public boolean isThreeWay() {
return true;
}
+
+ public ISubscriberResource getRemoteResource(IResource resource) throws TeamException {
+ return getRemoteResource(resource, getRemoteSynchronizationCache());
+ }
- /* (non-Javadoc)
- * @see org.eclipse.team.core.sync.TeamSubscriber#isCancellable()
+ public ISubscriberResource getBaseResource(IResource resource) throws TeamException {
+ return getRemoteResource(resource, getBaseSynchronizationCache());
+ }
+
+ /**
+ * Return the synchronization cache that provides access to the base sychronization bytes.
*/
- public boolean isCancellable() {
- return false;
+ protected abstract SynchronizationCache getBaseSynchronizationCache();
+
+ /**
+ * Return the synchronization cache that provides access to the base sychronization bytes.
+ */
+ protected abstract SynchronizationCache getRemoteSynchronizationCache();
+
+ private ISubscriberResource getRemoteResource(IResource resource, SynchronizationCache cache) throws TeamException {
+ byte[] remoteBytes = cache.getSyncBytes(resource);
+ if (remoteBytes == null) {
+ // There is no remote handle for this resource
+ return null;
+ } else {
+ // TODO: This code assumes that the type of the remote resource
+ // matches that of the local resource. This may not be true.
+ if (resource.getType() == IResource.FILE) {
+ byte[] parentBytes = cache.getSyncBytes(resource.getParent());
+ if (parentBytes == null) {
+ CVSProviderPlugin.log(new CVSException(
+ Policy.bind("ResourceSynchronizer.missingParentBytesOnGet", getSyncName(cache).toString(), resource.getFullPath().toString())));
+ // Assume there is no remote and the problem is a programming error
+ return null;
+ }
+ return RemoteFile.fromBytes(resource, remoteBytes, parentBytes);
+ } else {
+ return RemoteFolder.fromBytes(resource, remoteBytes);
+ }
+ }
+ }
+
+ private String getSyncName(SynchronizationCache cache) {
+ if (cache instanceof SynchronizationSyncBytesCache) {
+ return ((SynchronizationSyncBytesCache)cache).getSyncName().toString();
+ }
+ return cache.getClass().getName();
}
/* (non-Javadoc)
- * @see org.eclipse.team.core.sync.TeamSubscriber#cancel()
+ * @see org.eclipse.team.core.subscribers.helpers.SyncTreeSubscriber#hasRemote(org.eclipse.core.resources.IResource)
*/
- public void cancel() {
- // noop
+ protected boolean hasRemote(IResource resource) throws TeamException {
+ return getRemoteSynchronizationCache().getSyncBytes(resource) != null;
}
+
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
index 8dc06e45d..e451917d3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
@@ -13,26 +13,15 @@ package org.eclipse.team.internal.ccvs.core;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.subscribers.RemoteSynchronizer;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamDelta;
-import org.eclipse.team.core.sync.IRemoteResource;
+import org.eclipse.team.core.subscribers.utils.SynchronizationCache;
+import org.eclipse.team.core.subscribers.utils.SynchronizationSyncBytesCache;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.OptimizedRemoteSynchronizer;
-import org.eclipse.team.internal.ccvs.core.syncinfo.RemoteTagSynchronizer;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
+import org.eclipse.team.internal.ccvs.core.syncinfo.*;
import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
/**
@@ -40,7 +29,8 @@ import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
*/
public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IResourceStateChangeListener {
- private OptimizedRemoteSynchronizer remoteSynchronizer;
+ private SynchronizationCache remoteSynchronizer;
+ private SynchronizationCache baseSynchronizer;
private IComparisonCriteria comparisonCriteria;
// qualified name for remote sync info
@@ -50,7 +40,10 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
super(id, name, description);
// install sync info participant
- remoteSynchronizer = new OptimizedRemoteSynchronizer(REMOTE_RESOURCE_KEY);
+ baseSynchronizer = new CVSBaseSynchronizationCache();
+ remoteSynchronizer = new CVSDescendantSynchronizationCache(
+ baseSynchronizer,
+ new SynchronizationSyncBytesCache(new QualifiedName(SYNC_KEY_QUALIFIER, REMOTE_RESOURCE_KEY)));
ResourceStateChangeListeners.getListener().addResourceStateChangeListener(this);
@@ -99,7 +92,7 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
if (remoteSynchronizer.isRemoteKnown(resource)) {
// The remote is known not to exist. If the local resource is
// managed then this information is stale
- if (getBaseSynchronizer().hasRemote(resource)) {
+ if (getBaseSynchronizationCache().getSyncBytes(resource) != null) {
if (canModifyWorkspace) {
remoteSynchronizer.removeSyncBytes(resource, IResource.DEPTH_ZERO);
} else {
@@ -108,7 +101,7 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
}
}
} else {
- byte[] localBytes = remoteSynchronizer.getBaseSynchronizer().getSyncBytes(resource);
+ byte[] localBytes = baseSynchronizer.getSyncBytes(resource);
if (localBytes == null || !isLaterRevision(remoteBytes, localBytes)) {
if (canModifyWorkspace) {
remoteSynchronizer.removeSyncBytes(resource, IResource.DEPTH_ZERO);
@@ -119,7 +112,7 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
}
} else if (resource.getType() == IResource.FOLDER) {
// If the base has sync info for the folder, purge the remote bytes
- if (getBaseSynchronizer().hasRemote(resource) && canModifyWorkspace) {
+ if (getBaseSynchronizationCache().getSyncBytes(resource) != null && canModifyWorkspace) {
remoteSynchronizer.removeSyncBytes(resource, IResource.DEPTH_ZERO);
}
}
@@ -179,20 +172,6 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
TeamDelta delta = new TeamDelta(this, TeamDelta.PROVIDER_DECONFIGURED, project);
fireTeamResourceChange(new TeamDelta[] {delta});
}
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getRemoteSynchronizer()
- */
- protected RemoteSynchronizer getRemoteSynchronizer() {
- return remoteSynchronizer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getBaseSynchronizer()
- */
- protected RemoteSynchronizer getBaseSynchronizer() {
- return remoteSynchronizer.getBaseSynchronizer();
- }
/* (non-Javadoc)
* @see org.eclipse.team.core.sync.TeamSubscriber#getAllOutOfSync(org.eclipse.core.resources.IResource[], int, org.eclipse.core.runtime.IProgressMonitor)
@@ -266,31 +245,51 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
return remoteSynchronizer.isRemoteKnown(resource);
}
+ public void setRemote(IProject project, ISubscriberResource remote, IProgressMonitor monitor) throws TeamException {
+ // TODO: This exposes internal behavior to much
+ IResource[] changedResources =
+ new CVSRefreshOperation(remoteSynchronizer, baseSynchronizer, null).collectChanges(project, remote, IResource.DEPTH_INFINITE, monitor);
+ if (changedResources.length != 0) {
+ fireTeamResourceChange(TeamDelta.asSyncChangedDeltas(this, changedResources));
+ }
+ }
+
+ protected IResource[] refreshBase(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
+ // TODO Ensure that file contents are cached for modified local files
+ try {
+ monitor.beginTask(null, 100);
+ return new IResource[0];
+ } finally {
+ monitor.done();
+ }
+ }
+
/* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.TeamSubscriber#getRemoteResource(org.eclipse.core.resources.IResource)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getRemoteTag()
*/
- public IRemoteResource getRemoteResource(IResource resource) throws TeamException {
- IRemoteResource remote = super.getRemoteResource(resource);
- if (resource.getType() == IResource.FILE && remote instanceof ICVSRemoteFile) {
- byte[] remoteBytes = ((ICVSRemoteFile)remote).getSyncBytes();
- byte[] localBytes = CVSWorkspaceRoot.getCVSFileFor((IFile)resource).getSyncBytes();
- if (localBytes != null && remoteBytes != null) {
- if (!ResourceSyncInfo.isLaterRevisionOnSameBranch(remoteBytes, localBytes)) {
- // The remote bytes are stale so ignore the remote and use the base
- return getBaseResource(resource);
- }
- }
- }
- return remote;
+ protected CVSTag getRemoteTag() {
+ return null;
}
- public void setRemote(IProject project, IRemoteResource remote, IProgressMonitor monitor) throws TeamException {
- List changedResources = new ArrayList();
- ((RemoteTagSynchronizer)getRemoteSynchronizer()).collectChanges(project, remote, changedResources, IResource.DEPTH_INFINITE, monitor);
- if (!changedResources.isEmpty()) {
- IResource[] changes = (IResource[]) changedResources.toArray(new IResource[changedResources.size()]);
- fireTeamResourceChange(TeamDelta.asSyncChangedDeltas(this, changes));
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getBaseTag()
+ */
+ protected CVSTag getBaseTag() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getBaseSynchronizationCache()
+ */
+ protected SynchronizationCache getBaseSynchronizationCache() {
+ return baseSynchronizer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getRemoteSynchronizationCache()
+ */
+ protected SynchronizationCache getRemoteSynchronizationCache() {
+ return remoteSynchronizer;
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java
index fd0e29abc..61c1916cb 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java
@@ -11,6 +11,8 @@
package org.eclipse.team.internal.ccvs.core;
+import java.io.InputStream;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
@@ -26,6 +28,14 @@ import org.eclipse.team.core.TeamException;
public interface ICVSRemoteFile extends ICVSRemoteResource, ICVSFile {
/**
+ * Returns a stream over the contents of this remote element.
+ *
+ * @param progress a progress monitor to indicate the duration of the operation, or
+ * <code>null</code> if progress reporting is not required.
+ */
+ public InputStream getContents(IProgressMonitor progress) throws TeamException;
+
+ /**
* Get the log entry for the revision the remote file represents.
* This method will return null until after the getContents(IProgressMonitor)
* method is called (i.e. the call to getContents also fetches the entry.
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java
index c69a64eff..cfab718cd 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java
@@ -24,7 +24,15 @@ import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
*
* Clients are not expected to implement this interface.
*/
-public interface ICVSRemoteResource extends IRemoteResource, ICVSResource {
+public interface ICVSRemoteResource extends ICVSResource, IRemoteResource {
+
+ /**
+ * Answers if the remote element may have children.
+ *
+ * @return <code>true</code> if the remote element may have children and
+ * <code>false</code> otherwise.
+ */
+ public boolean isContainer();
/**
* Return the repository
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
index 237191eea..d90290c9e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
@@ -12,49 +12,19 @@ package org.eclipse.team.internal.ccvs.core.resources;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
+import java.util.*;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.core.sync.RemoteContentsCache;
-import org.eclipse.team.core.sync.RemoteContentsCacheEntry;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.core.Policy;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Log;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.Command.QuietOption;
+import org.eclipse.team.core.subscribers.*;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.client.*;
+import org.eclipse.team.internal.ccvs.core.client.Command.*;
import org.eclipse.team.internal.ccvs.core.client.listeners.LogListener;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
+import org.eclipse.team.internal.ccvs.core.syncinfo.*;
import org.eclipse.team.internal.ccvs.core.util.Assert;
/**
@@ -687,4 +657,11 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
public void doneReceivingContents() {
fetching = false;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.ISubscriberResource#getStorage(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStorage getStorage(IProgressMonitor monitor) throws TeamException {
+ return getBufferedStorage(monitor);
+ }
}
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 59c08034f..cd1fb18ec 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
@@ -17,28 +17,11 @@ import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
-import org.eclipse.team.internal.ccvs.core.Policy;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.Update;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.client.*;
import org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.client.listeners.IUpdateMessageListener;
@@ -630,4 +613,11 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
return super.isManaged() && isCVSFolder();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.ISubscriberResource#getStorage(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStorage getStorage(IProgressMonitor monitor) throws TeamException {
+ return null;
+ }
+
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java
index 1c36389b9..b5965f637 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java
@@ -15,6 +15,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.ISubscriberResource;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
@@ -32,7 +33,7 @@ import org.eclipse.team.internal.ccvs.core.util.Util;
* resources that reside in a CVS repository but have not necessarily been loaded
* locally.
*/
-public abstract class RemoteResource extends PlatformObject implements ICVSRemoteResource {
+public abstract class RemoteResource extends PlatformObject implements ICVSRemoteResource, ISubscriberResource {
protected RemoteFolder parent;
protected String name;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaseSynchronizer.java
deleted file mode 100644
index 2863e4673..000000000
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/BaseSynchronizer.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.core.syncinfo;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.RemoteSynchronizer;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-
-/**
- * A base sychronizer provides access to the base sync bytes for the
- * resources in the local workspace
- */
-public class BaseSynchronizer extends RemoteSynchronizer {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSynchronizer#getSyncBytes(org.eclipse.core.resources.IResource)
- */
- public byte[] getSyncBytes(IResource resource) throws CVSException {
- if (resource.getType() == IResource.FILE) {
- // For a file, return the entry line
- byte[] bytes = EclipseSynchronizer.getInstance().getSyncBytes(resource);
- if (bytes != null) {
- // Use the base sync info (i.e. no deletion or addition)
- if (ResourceSyncInfo.isDeletion(bytes)) {
- bytes = ResourceSyncInfo.convertFromDeletion(bytes);
- } else if (ResourceSyncInfo.isAddition(bytes)) {
- bytes = null;
- }
- }
- return bytes;
- } else {
- // For a folder, return the folder sync info bytes
- FolderSyncInfo info = EclipseSynchronizer.getInstance().getFolderSync((IContainer)resource);
- if (info == null) return null;
- return info.getBytes();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSynchronizer#getSyncName()
- */
- protected QualifiedName getSyncName() {
- return new QualifiedName(CVSProviderPlugin.ID, "workspace"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSynchronizer#refresh(org.eclipse.core.resources.IResource[], int, boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IResource[] refresh(
- IResource resource,
- int depth,
- boolean cacheFileContentsHint,
- IProgressMonitor monitor)
- throws TeamException {
-
- // TODO Ensure that file contents are cached for modified local files
- try {
- monitor.beginTask(null, 100);
- return new IResource[0];
- } finally {
- monitor.done();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSynchronizer#getRemoteResource(org.eclipse.core.resources.IResource)
- */
- public IRemoteResource getRemoteResource(IResource resource) throws TeamException {
- return CVSWorkspaceRoot.getRemoteResourceFor(resource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.RemoteSynchronizer#hasRemote(org.eclipse.core.resources.IResource)
- */
- public boolean hasRemote(IResource resource) throws TeamException {
- return getSyncBytes(resource) != null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSBaseSynchronizationCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSBaseSynchronizationCache.java
new file mode 100644
index 000000000..e722e2082
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSBaseSynchronizationCache.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.core.syncinfo;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.utils.SynchronizationCache;
+import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
+
+
+public class CVSBaseSynchronizationCache extends SynchronizationCache {
+ public void dispose() {
+ // Do nothing
+ }
+ public byte[] getSyncBytes(IResource resource) throws TeamException {
+ if (resource.getType() == IResource.FILE) {
+ // For a file, return the entry line
+ byte[] bytes = EclipseSynchronizer.getInstance().getSyncBytes(resource);
+ if (bytes != null) {
+ // Use the base sync info (i.e. no deletion or addition)
+ if (ResourceSyncInfo.isDeletion(bytes)) {
+ bytes = ResourceSyncInfo.convertFromDeletion(bytes);
+ } else if (ResourceSyncInfo.isAddition(bytes)) {
+ bytes = null;
+ }
+ }
+ return bytes;
+ } else {
+ // For a folder, return the folder sync info bytes
+ FolderSyncInfo info = EclipseSynchronizer.getInstance().getFolderSync((IContainer)resource);
+ if (info == null) return null;
+ return info.getBytes();
+ }
+ }
+ public boolean isRemoteKnown(IResource resource) throws TeamException {
+ return getSyncBytes(resource) != null;
+ }
+ public boolean removeSyncBytes(IResource resource, int depth) throws TeamException {
+ throw new UnsupportedOperationException();
+ }
+ public boolean setSyncBytes(IResource resource, byte[] bytes) throws TeamException {
+ throw new UnsupportedOperationException();
+ }
+ public boolean setRemoteDoesNotExist(IResource resource) throws TeamException {
+ throw new UnsupportedOperationException();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSDescendantSynchronizationCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSDescendantSynchronizationCache.java
new file mode 100644
index 000000000..785d757c5
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSDescendantSynchronizationCache.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.core.syncinfo;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.utils.*;
+import org.eclipse.team.internal.ccvs.core.*;
+
+/**
+ * CVS sycnrhonization cache that ignores stale remote bytes
+ */
+public class CVSDescendantSynchronizationCache extends DescendantSynchronizationCache {
+
+ public CVSDescendantSynchronizationCache(SynchronizationCache baseCache, SynchronizationSyncBytesCache remoteCache) {
+ super(baseCache, remoteCache);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.DescendantSynchronizationCache#isDescendant(org.eclipse.core.resources.IResource, byte[], byte[])
+ */
+ protected boolean isDescendant(IResource resource, byte[] baseBytes, byte[] remoteBytes) throws TeamException {
+ if (resource.getType() != IResource.FILE) return true;
+ try {
+ return ResourceSyncInfo.isLaterRevisionOnSameBranch(remoteBytes, baseBytes);
+ } catch (CVSException e) {
+ throw TeamException.asTeamException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.helpers.SynchronizationCache#setSyncBytes(org.eclipse.core.resources.IResource, byte[])
+ */
+ public boolean setSyncBytes(IResource resource, byte[] bytes) throws TeamException {
+ boolean changed = super.setSyncBytes(resource, bytes);
+ if (resource.getType() == IResource.FILE && getSyncBytes(resource) != null && !parentHasSyncBytes(resource)) {
+ // Log a warning if there is no sync bytes available for the resource's
+ // parent but there is valid sync bytes for the child
+ CVSProviderPlugin.log(new TeamException(Policy.bind("ResourceSynchronizer.missingParentBytesOnSet", ((SynchronizationSyncBytesCache)getRemoteCache()).getSyncName().toString(), resource.getFullPath().toString())));
+ }
+ return changed;
+ }
+
+ /**
+ * Indicates whether the parent of the given local resource has sync bytes for its
+ * corresponding remote resource. The parent bytes of a remote resource are required
+ * (by CVS) to create a handle to the remote resource.
+ */
+ protected boolean parentHasSyncBytes(IResource resource) throws TeamException {
+ if (resource.getType() == IResource.PROJECT) return true;
+ return (getSyncBytes(resource.getParent()) != null);
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSRefreshOperation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSRefreshOperation.java
new file mode 100644
index 000000000..498556c5e
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSRefreshOperation.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.core.syncinfo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.ISubscriberResource;
+import org.eclipse.team.core.subscribers.utils.SynchronizationCache;
+import org.eclipse.team.core.subscribers.utils.SynchronizationCacheRefreshOperation;
+import org.eclipse.team.core.sync.IRemoteResource;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;
+
+/**
+ * CVS Specific refresh operation
+ */
+public class CVSRefreshOperation extends SynchronizationCacheRefreshOperation {
+
+ private SynchronizationCache cache, baseCache;
+ private CVSTag tag;
+
+ public CVSRefreshOperation(SynchronizationCache cache, SynchronizationCache baseCache, CVSTag tag) {
+ this.tag = tag;
+ this.cache = cache;
+ this.baseCache = cache;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.RefreshOperation#getSynchronizationCache()
+ */
+ protected SynchronizationCache getSynchronizationCache() {
+ return cache;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.RefreshOperation#getRemoteSyncBytes(org.eclipse.core.resources.IResource, org.eclipse.team.core.subscribers.ISubscriberResource)
+ */
+ protected byte[] getRemoteSyncBytes(IResource local, ISubscriberResource remote) throws TeamException {
+ if (remote != null) {
+ return ((RemoteResource)remote).getSyncBytes();
+ } else {
+ if (local.getType() == IResource.FOLDER && baseCache != null) {
+ // If there is no remote, use the local sync for the folder
+ return baseCache.getSyncBytes(local);
+ }
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.RefreshOperation#getRemoteChildren(org.eclipse.team.core.subscribers.ISubscriberResource, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected ISubscriberResource[] getRemoteChildren(ISubscriberResource remote, IProgressMonitor progress) throws TeamException {
+ IRemoteResource[] children = remote != null ? (IRemoteResource[])((RemoteResource)remote).members(progress) : new IRemoteResource[0];
+ ISubscriberResource[] result = new ISubscriberResource[children.length];
+ for (int i = 0; i < children.length; i++) {
+ result[i] = (ISubscriberResource)children[i];
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.RefreshOperation#getLocalChildren(org.eclipse.core.resources.IResource)
+ */
+ protected IResource[] getLocalChildren(IResource local) throws TeamException {
+ IResource[] localChildren = null;
+ if( local.getType() != IResource.FILE && (local.exists() || local.isPhantom())) {
+ // Include all non-ignored resources including outgoing deletions
+ ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)local);
+ // Look inside existing folders and phantoms that are CVS folders
+ if (local.exists() || cvsFolder.isCVSFolder()) {
+ ICVSResource[] cvsChildren = cvsFolder.members(ICVSFolder.MANAGED_MEMBERS | ICVSFolder.UNMANAGED_MEMBERS);
+ List resourceChildren = new ArrayList();
+ for (int i = 0; i < cvsChildren.length; i++) {
+ ICVSResource cvsResource = cvsChildren[i];
+ resourceChildren.add(cvsResource.getIResource());
+ }
+ localChildren = (IResource[]) resourceChildren.toArray(new IResource[resourceChildren.size()]);
+ }
+ }
+ if (localChildren == null) {
+ localChildren = new IResource[0];
+ }
+ return localChildren;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.RefreshOperation#buildRemoteTree(org.eclipse.core.resources.IResource, int, boolean, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected ISubscriberResource getRemoteTree(IResource resource, int depth, boolean cacheFileContentsHint, IProgressMonitor monitor) throws TeamException {
+ // TODO: we are currently ignoring the depth parameter because the build remote tree is
+ // by default deep!
+ return (ISubscriberResource)CVSWorkspaceRoot.getRemoteTree(resource, tag, cacheFileContentsHint, monitor);
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSRemoteSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSRemoteSynchronizer.java
deleted file mode 100644
index 36396bbdf..000000000
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSRemoteSynchronizer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.core.syncinfo;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.RemoteBytesSynchronizer;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.Policy;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;
-
-/**
- * CVS specific remote synchronizer behavior
- */
-public abstract class CVSRemoteSynchronizer extends RemoteBytesSynchronizer {
-
- public static final String SYNC_KEY_QUALIFIER = "org.eclipse.team.cvs"; //$NON-NLS-1$
-
- public CVSRemoteSynchronizer(String id) {
- super(new QualifiedName(SYNC_KEY_QUALIFIER, id));
- }
-
- public IRemoteResource getRemoteResource(IResource resource) throws TeamException {
- byte[] remoteBytes = getSyncBytes(resource);
- if (remoteBytes == null) {
- // There is no remote handle for this resource
- return null;
- } else {
- // TODO: This code assumes that the type of the remote resource
- // matches that of the local resource. This may not be true.
- if (resource.getType() == IResource.FILE) {
- byte[] parentBytes = getSyncBytes(resource.getParent());
- if (parentBytes == null) {
- CVSProviderPlugin.log(new CVSException(
- Policy.bind("ResourceSynchronizer.missingParentBytesOnGet", getSyncName().toString(), resource.getFullPath().toString()))); //$NON-NLS-1$
- // Assume there is no remote and the problem is a programming error
- return null;
- }
- return RemoteFile.fromBytes(resource, remoteBytes, parentBytes);
- } else {
- return RemoteFolder.fromBytes(resource, remoteBytes);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.syncinfo.RemoteSynchronizer#setSyncBytes(org.eclipse.core.resources.IResource, byte[])
- */
- public boolean setSyncBytes(IResource resource, byte[] bytes) throws TeamException {
- boolean changed = super.setSyncBytes(resource, bytes);
- if (resource.getType() == IResource.FILE && getSyncBytes(resource) != null && !parentHasSyncBytes(resource)) {
- // Log a warning if there is no sync bytes available for the resource's
- // parent but there is valid sync bytes for the child
- CVSProviderPlugin.log(new TeamException(Policy.bind("ResourceSynchronizer.missingParentBytesOnSet", getSyncName().toString(), resource.getFullPath().toString()))); //$NON-NLS-1$
- }
- return changed;
- }
-
- /**
- * Indicates whether the parent of the given local resource has sync bytes for its
- * corresponding remote resource. The parent bytes of a remote resource are required
- * (by CVS) to create a handle to the remote resource.
- */
- protected boolean parentHasSyncBytes(IResource resource) throws TeamException {
- if (resource.getType() == IResource.PROJECT) return true;
- return (getSyncBytes(resource.getParent()) != null);
- }
-
- /**
- * Return the sync bytes associated with the remote resource. A return
- * value of <code>null</code> indicates that the remote resource does not exist.
- */
- protected byte[] getRemoteSyncBytes(IResource local, IRemoteResource remote) throws TeamException {
- if (remote != null) {
- return ((RemoteResource)remote).getSyncBytes();
- } else {
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSSynchronizationCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSSynchronizationCache.java
new file mode 100644
index 000000000..239b82230
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSSynchronizationCache.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.core.syncinfo;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.utils.SynchronizationSyncBytesCache;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.internal.ccvs.core.Policy;
+
+/**
+ * Override <code>SynchronizationSyncBytesCache</code> to log an error
+ * if there are no parent bytes for a file.
+ */
+public class CVSSynchronizationCache extends SynchronizationSyncBytesCache {
+
+ public CVSSynchronizationCache(QualifiedName name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.helpers.SynchronizationCache#setSyncBytes(org.eclipse.core.resources.IResource, byte[])
+ */
+ public boolean setSyncBytes(IResource resource, byte[] bytes) throws TeamException {
+ boolean changed = super.setSyncBytes(resource, bytes);
+ if (resource.getType() == IResource.FILE && getSyncBytes(resource) != null && !parentHasSyncBytes(resource)) {
+ // Log a warning if there is no sync bytes available for the resource's
+ // parent but there is valid sync bytes for the child
+ CVSProviderPlugin.log(new TeamException(Policy.bind("ResourceSynchronizer.missingParentBytesOnSet", getSyncName().toString(), resource.getFullPath().toString())));
+ }
+ return changed;
+ }
+
+ /**
+ * Indicates whether the parent of the given local resource has sync bytes for its
+ * corresponding remote resource. The parent bytes of a remote resource are required
+ * (by CVS) to create a handle to the remote resource.
+ */
+ protected boolean parentHasSyncBytes(IResource resource) throws TeamException {
+ if (resource.getType() == IResource.PROJECT) return true;
+ return (getSyncBytes(resource.getParent()) != null);
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/MergedSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/MergedSynchronizer.java
deleted file mode 100644
index 089c10985..000000000
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/MergedSynchronizer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.core.syncinfo;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.RemoteBytesSynchronizer;
-import org.eclipse.team.core.sync.IRemoteResource;
-
-/**
- * This synchronizer keeps track of which resources have been merged.
- * It is to be used only by the CVSMergeSubscriber.
- */
-public class MergedSynchronizer extends RemoteBytesSynchronizer {
-
- public MergedSynchronizer(String id) {
- super(new QualifiedName(CVSRemoteSynchronizer.SYNC_KEY_QUALIFIER, id));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSynchronizer#getRemoteResource(org.eclipse.core.resources.IResource)
- */
- public IRemoteResource getRemoteResource(IResource resource) throws TeamException {
- throw new UnsupportedOperationException();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.sync.ResourceSynchronizer#refresh(org.eclipse.core.resources.IResource[], int, boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IResource[] refresh(IResource resource, int depth, boolean cacheFileContentsHint, IProgressMonitor monitor) throws TeamException {
- try {
- monitor.beginTask(null, 100);
- return new IResource[0];
- } finally {
- monitor.done();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/OptimizedRemoteSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/OptimizedRemoteSynchronizer.java
deleted file mode 100644
index 8065edc0b..000000000
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/OptimizedRemoteSynchronizer.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.core.syncinfo;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-
-/**
- * The optimized remote synchronizer uses the base sync info when the remote
- * is unknown
- */
-public class OptimizedRemoteSynchronizer extends RemoteTagSynchronizer {
-
- // The local synchronizer is used for cases where the remote is unknown
- private BaseSynchronizer baseSynchronizer = new BaseSynchronizer();
-
- public OptimizedRemoteSynchronizer(String id) {
- this(id, null /* use the tag in the local workspace resources */);
- }
-
- public OptimizedRemoteSynchronizer(String id, CVSTag tag) {
- super(id, tag);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSynchronizer#getSyncBytes(org.eclipse.core.resources.IResource)
- */
- public byte[] getSyncBytes(IResource resource) throws TeamException {
- byte[] bytes = internalGetSyncBytes(resource);
- if ((bytes == null) && !isRemoteKnown(resource)) {
- // The remote was never known so use the base
- bytes = baseSynchronizer.getSyncBytes(resource);
- }
- return bytes;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.syncinfo.RemoteSynchronizer#setSyncBytes(org.eclipse.core.resources.IResource, byte[])
- */
- public boolean setSyncBytes(IResource resource, byte[] bytes) throws TeamException {
- byte[] baseBytes = baseSynchronizer.getSyncBytes(resource);
- if (baseBytes != null && Util.equals(baseBytes, bytes)) {
- // Remove the existing bytes so the base will be used (thus saving space)
- return removeSyncBytes(resource, IResource.DEPTH_ZERO);
- } else {
- return super.setSyncBytes(resource, bytes);
- }
- }
-
- public BaseSynchronizer getBaseSynchronizer() {
- return baseSynchronizer;
- }
-
- /*
- * Return the bytes for the remote resource if there is a remote that differs
- * from the local.
- */
- private byte[] internalGetSyncBytes(IResource resource) throws TeamException {
- return super.getSyncBytes(resource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.syncinfo.RemoteTagSynchronizer#getRemoteSyncBytes(org.eclipse.core.resources.IResource, org.eclipse.team.internal.ccvs.core.ICVSRemoteResource)
- */
- protected byte[] getRemoteSyncBytes(IResource local, ICVSRemoteResource remote) throws TeamException {
- if (remote == null && local.getType() == IResource.FOLDER) {
- // If there is no remote, use the local sync for the folder
- return baseSynchronizer.getSyncBytes(local);
- }
- return super.getRemoteSyncBytes(local, remote);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteResourceFactory.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteResourceFactory.java
deleted file mode 100644
index 21518f888..000000000
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteResourceFactory.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.core.syncinfo;
-
-/**
- * @author Administrator
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class RemoteResourceFactory {
-
-}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java
deleted file mode 100644
index 30e547230..000000000
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.core.syncinfo;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.internal.jobs.JobManager;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.Policy;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.util.Assert;
-
-/**
- * This RemoteSynchronizr uses a CVS Tag to fetch the remote tree
- */
-public class RemoteTagSynchronizer extends CVSRemoteSynchronizer {
-
- private CVSTag tag;
-
- public RemoteTagSynchronizer(String id, CVSTag tag) {
- super(id);
- this.tag = tag;
- }
-
- public void collectChanges(IResource local, IRemoteResource remote, Collection changedResources, int depth, IProgressMonitor monitor) throws TeamException {
- byte[] remoteBytes = getRemoteSyncBytes(local, remote);
- boolean changed;
- if (remoteBytes == null) {
- changed = setRemoteDoesNotExist(local);
- } else {
- changed = setSyncBytes(local, remoteBytes);
- }
- if (changed) {
- changedResources.add(local);
- }
- if (depth == IResource.DEPTH_ZERO) return;
- Map children = mergedMembers(local, remote, monitor);
- for (Iterator it = children.keySet().iterator(); it.hasNext();) {
- IResource localChild = (IResource) it.next();
- IRemoteResource remoteChild = (IRemoteResource)children.get(localChild);
- collectChanges(localChild, remoteChild, changedResources,
- depth == IResource.DEPTH_INFINITE ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO,
- monitor);
- }
-
- // Look for resources that have sync bytes but are not in the resources we care about
- IResource[] resources = getChildrenWithSyncBytes(local);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (!children.containsKey(resource)) {
- // These sync bytes are stale. Purge them
- removeSyncBytes(resource, IResource.DEPTH_INFINITE);
- changedResources.add(resource);
- }
- }
- }
-
- protected Map mergedMembers(IResource local, IRemoteResource remote, IProgressMonitor progress) throws TeamException {
-
- // {IResource -> IRemoteResource}
- Map mergedResources = new HashMap();
-
- IRemoteResource[] remoteChildren = getRemoteChildren(remote, progress);
-
- IResource[] localChildren = getLocalChildren(local);
-
- if (remoteChildren.length > 0 || localChildren.length > 0) {
- Set allSet = new HashSet(20);
- Map localSet = null;
- Map remoteSet = null;
-
- if (localChildren.length > 0) {
- localSet = new HashMap(10);
- for (int i = 0; i < localChildren.length; i++) {
- IResource localChild = localChildren[i];
- String name = localChild.getName();
- localSet.put(name, localChild);
- allSet.add(name);
- }
- }
-
- if (remoteChildren.length > 0) {
- remoteSet = new HashMap(10);
- for (int i = 0; i < remoteChildren.length; i++) {
- IRemoteResource remoteChild = remoteChildren[i];
- String name = remoteChild.getName();
- remoteSet.put(name, remoteChild);
- allSet.add(name);
- }
- }
-
- Iterator e = allSet.iterator();
- while (e.hasNext()) {
- String keyChildName = (String) e.next();
-
- if (progress != null) {
- if (progress.isCanceled()) {
- throw new OperationCanceledException();
- }
- // XXX show some progress?
- }
-
- IResource localChild =
- localSet != null ? (IResource) localSet.get(keyChildName) : null;
-
- IRemoteResource remoteChild =
- remoteSet != null ? (IRemoteResource) remoteSet.get(keyChildName) : null;
-
- if (localChild == null) {
- // there has to be a remote resource available if we got this far
- Assert.isTrue(remoteChild != null);
- boolean isContainer = remoteChild.isContainer();
- localChild = getResourceChild(local /* parent */, keyChildName, isContainer);
- }
- mergedResources.put(localChild, remoteChild);
- }
- }
- return mergedResources;
- }
-
- private IRemoteResource[] getRemoteChildren(IRemoteResource remote, IProgressMonitor progress) throws TeamException {
- return remote != null ? remote.members(progress) : new IRemoteResource[0];
- }
-
- private IResource[] getLocalChildren(IResource local) throws TeamException {
- IResource[] localChildren = null;
- if( local.getType() != IResource.FILE && (local.exists() || local.isPhantom())) {
- // Include all non-ignored resources including outgoing deletions
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)local);
- // Look inside existing folders and phantoms that are CVS folders
- if (local.exists() || cvsFolder.isCVSFolder()) {
- ICVSResource[] cvsChildren = cvsFolder.members(ICVSFolder.MANAGED_MEMBERS | ICVSFolder.UNMANAGED_MEMBERS);
- List resourceChildren = new ArrayList();
- for (int i = 0; i < cvsChildren.length; i++) {
- ICVSResource cvsResource = cvsChildren[i];
- resourceChildren.add(cvsResource.getIResource());
- }
- localChildren = (IResource[]) resourceChildren.toArray(new IResource[resourceChildren.size()]);
- }
- }
- if (localChildren == null) {
- localChildren = new IResource[0];
- }
- return localChildren;
- }
-
- private IResource[] getChildrenWithSyncBytes(IResource local) throws TeamException {
- try {
- if (local.getType() != IResource.FILE && (local.exists() || local.isPhantom())) {
- IResource[] allChildren = ((IContainer)local).members(true /* include phantoms */);
- List childrenWithSyncBytes = new ArrayList();
- for (int i = 0; i < allChildren.length; i++) {
- IResource resource = allChildren[i];
- if (internalGetSyncBytes(resource) != null) {
- childrenWithSyncBytes.add(resource);
- }
- }
- return (IResource[]) childrenWithSyncBytes.toArray(
- new IResource[childrenWithSyncBytes.size()]);
- }
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- return new IResource[0];
- }
-
- private byte[] internalGetSyncBytes(IResource resource) throws TeamException {
- return super.getSyncBytes(resource);
- }
-
- /*
- * Returns a handle to a non-existing resource.
- */
- private IResource getResourceChild(IResource parent, String childName, boolean isContainer) {
- if (parent.getType() == IResource.FILE) {
- return null;
- }
- if (isContainer) {
- return ((IContainer) parent).getFolder(new Path(childName));
- } else {
- return ((IContainer) parent).getFile(new Path(childName));
- }
- }
-
- public IResource[] refresh(IResource resource, int depth, boolean cacheFileContentsHint, IProgressMonitor monitor) throws TeamException {
- List changedResources = new ArrayList();
- ISchedulingRule rule = resource.getProject();
- monitor.beginTask(null, 100);
- try {
- // Get a scheduling rule on the project since CVS may obtain a lock higher then
- // the resource itself.
- JobManager.getInstance().beginRule(rule, monitor);
- if (!resource.getProject().isAccessible()) {
- // The project is closed so silently skip it
- return new IResource[0];
- }
-
- monitor.setTaskName(Policy.bind("RemoteTagSynchronizer.0", resource.getFullPath().makeRelative().toString())); //$NON-NLS-1$
-
- // build the remote tree only if an initial tree hasn't been provided
- IRemoteResource tree = buildRemoteTree(resource, depth, cacheFileContentsHint, Policy.subMonitorFor(monitor, 70));
-
- // update the known remote handles
- IProgressMonitor sub = Policy.infiniteSubMonitorFor(monitor, 30);
- try {
- sub.beginTask(null, 64);
- collectChanges(resource, tree, changedResources, depth, sub);
- } finally {
- sub.done();
- }
- } finally {
- JobManager.getInstance().endRule(rule);
- monitor.done();
- }
- IResource[] changes = (IResource[]) changedResources.toArray(new IResource[changedResources.size()]);
- return changes;
- }
-
- /**
- * Build a remote tree for the given parameters.
- */
- protected ICVSRemoteResource buildRemoteTree(IResource resource, int depth, boolean cacheFileContentsHint, IProgressMonitor monitor) throws TeamException {
- // TODO: we are currently ignoring the depth parameter because the build remote tree is
- // by default deep!
- return CVSWorkspaceRoot.getRemoteTree(resource, tag, cacheFileContentsHint, monitor);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/.project b/bundles/org.eclipse.team.cvs.ui/.project
index 7abb228e6..2e8b0ec7f 100644
--- a/bundles/org.eclipse.team.cvs.ui/.project
+++ b/bundles/org.eclipse.team.cvs.ui/.project
@@ -4,7 +4,6 @@
<comment></comment>
<projects>
<project>org.eclipse.compare</project>
- <project>org.eclipse.core.boot</project>
<project>org.eclipse.core.resources</project>
<project>org.eclipse.core.resources.spysupport</project>
<project>org.eclipse.core.runtime</project>
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index 5138f4970..cb3a4c145 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -14,11 +14,20 @@ package org.eclipse.team.internal.ccvs.ui;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -31,7 +40,11 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.internal.ccvs.core.CVSStatus;
+import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
+import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.ui.console.CVSOutputConsole;
import org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory;
@@ -43,7 +56,10 @@ import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.ui.*;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -705,6 +721,15 @@ public class CVSUIPlugin extends AbstractUIPlugin {
}
/**
+ * Returns the system speed setting. This is mainly used to determine to enable/disable
+ * certain CVS features.
+ * @since 3.0
+ */
+ public static int getPlatformPerformance() {
+ return Platform.getPlugin(Platform.PI_RUNTIME).getPluginPreferences().getInt(Platform.PREF_PLATFORM_PERFORMANCE);
+ }
+
+ /**
* This is a convenience method to show the CVS workspace subscriber in the sync view.
* The working set of the workspace participant will be set to the provided working set
* and the provided resources will be refreshed.
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
deleted file mode 100644
index 0e0e73135..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ui.sync.MergeResource;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-
-public class MergeEditorInput extends CVSSyncCompareInput {
- CVSTag start;
- CVSTag end;
-
- public MergeEditorInput(IResource[] resources, CVSTag start, CVSTag end) {
- // we have to perform content comparison since files in different branches
- // may have different revisions but the same contents. Consider these files
- // for merge purposes as equal.
- super(resources, IRemoteSyncElement.GRANULARITY_CONTENTS);
- this.start = start;
- this.end = end;
- }
- public Viewer createDiffViewer(Composite parent) {
- Viewer viewer = super.createDiffViewer(parent);
- getViewer().syncModeChanged(SyncView.SYNC_MERGE);
- return viewer;
- }
- protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
- IResource[] resources = getResources();
- IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length];
- int work = 100 * resources.length;
- monitor.beginTask(null, work);
- try {
- for (int i = 0; i < trees.length; i++) {
- IResource resource = resources[i];
- IRemoteResource base = CVSWorkspaceRoot.getRemoteTree(resource, start, Policy.subMonitorFor(monitor, 50));
- IRemoteResource remote = CVSWorkspaceRoot.getRemoteTree(resource, end, Policy.subMonitorFor(monitor, 50));
- trees[i] = new CVSRemoteSyncElement(true /*three way*/, resource, base, remote);
- }
- } finally {
- monitor.done();
- }
- return trees;
- }
- public CVSTag getStartTag() {
- return start;
- }
- public CVSTag getEndTag() {
- return end;
- }
- public String getTitle() {
- return Policy.bind("MergeEditorInput.title", start.getName(), end.getName()); //$NON-NLS-1$
- }
- protected void contentsChanged(ICompareInput source) {
- }
-
- /*
- * Override collectResourceChanges to only determine the true sync state for incomming changes
- */
- protected IDiffElement collectResourceChanges(IDiffContainer parent, IRemoteSyncElement tree, IProgressMonitor pm) throws TeamException {
- if ( ! tree.isContainer()) {
- CVSRemoteSyncElement cvsTree = (CVSRemoteSyncElement)tree;
- RemoteFile base = (RemoteFile)cvsTree.getBase();
- RemoteFile remote = (RemoteFile)cvsTree.getRemote();
- if (base != null && remote != null && base.getRevision().equals(remote.getRevision())) {
- // If the base and remote are the same, we don't have an incomming change
- MergeResource mergeResource = new MergeResource(tree);
- TeamFile file = new TeamFile(parent, mergeResource, IRemoteSyncElement.IN_SYNC, getShell());
- return file;
- }
- }
- return super.collectResourceChanges(parent, tree, pm);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/OverrideUpdateMergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/OverrideUpdateMergeAction.java
deleted file mode 100644
index 80c87f613..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/OverrideUpdateMergeAction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-
-public class OverrideUpdateMergeAction extends UpdateMergeAction {
- public OverrideUpdateMergeAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
- /*
- * Override removeNonApplicableNodes because conflicting nodes should not be removed from this set.
- */
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeOutgoingNodes();
- set.removeIncomingNodes();
- }
- protected boolean isEnabled(ITeamNode node) {
- // The force update action is enabled only for conflicting and outgoing changes
- SyncSet set = new SyncSet(new StructuredSelection(node));
- return (set.hasConflicts() && hasRealChanges(node, new int[] { ITeamNode.CONFLICTING }));
- }
- /**
- * @see MergeAction#getHelpContextID()
- */
- protected String getHelpContextID() {
- return IHelpContextIds.MERGE_FORCED_UPDATE_ACTION;
- }
-
- /**
- * This method is the same as the inherited methd but it does not unmanage
- * because merging should leave the files as outgoing deletions
- *
- * @see org.eclipse.team.internal.ccvs.ui.sync.UpdateSyncAction#runLocalDeletions(ITeamNode[], RepositoryManager, IProgressMonitor)
- */
- protected void runLocalDeletions(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException, CoreException {
- monitor.beginTask(null, nodes.length * 100);
- for (int i = 0; i < nodes.length; i++) {
- ITeamNode node = nodes[i];
- CVSRemoteSyncElement element = CVSSyncCompareInput.getSyncElementFrom(node);
- deleteAndKeepHistory(element.getLocal(), Policy.subMonitorFor(monitor, 100));
- }
- monitor.done();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java
deleted file mode 100644
index 80239455c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ccvs.ui.sync.UpdateSyncAction;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-
-/*
- * To be done:
- * 1. add another action that allows a force merge merging since we can't tell the manual vs automatic conflicts when building the sync tree.
- * 2. fix progress monitoring
- */
-public class UpdateMergeAction extends UpdateSyncAction {
- public UpdateMergeAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected void runUpdateDeletions(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- runUpdateDeep(nodes, manager, monitor);
- }
-
- /*
- * @see UpdateSyncAction#runUpdateDeep(IProgressMonitor, List, RepositoryManager)
- * incoming-change
- * incoming-deletion
- */
- protected void runUpdateDeep(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- ITeamNode[] incoming = removeOutgoing(nodes);
- monitor.beginTask(null, 1000 * incoming.length);
- try {
- for (int i = 0; i < incoming.length; i++) {
- CVSRemoteSyncElement element = CVSSyncCompareInput.getSyncElementFrom(incoming[i]);
- if(element!=null) {
- makeRemoteLocal(element, new SubProgressMonitor(monitor, 1000));
- }
- }
- } finally {
- monitor.done();
- }
- }
-
- /*
- * @see UpdateSyncAction#runUpdateIgnoreLocalShallow(IProgressMonitor, List, RepositoryManager)
- * incoming-addition
- * incoming-conflict (no-merge)
- */
- protected void runUpdateIgnoreLocalShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- runUpdateDeep(nodes, manager, monitor);
- }
-
- /*
- * @see UpdateSyncAction#runUpdateShallow(ITeamNode[], RepositoryManager, IProgressMonitor)
- * incoming-conflict (auto-mergeable)
- */
- protected void runUpdateShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- mergeWithLocal(nodes, manager, false, monitor);
- }
-
- protected void mergeWithLocal(ITeamNode[] nodes, RepositoryManager manager, boolean createBackup, IProgressMonitor monitor) throws TeamException {
- CVSTag startTag = ((MergeEditorInput)getDiffModel()).getStartTag();
- CVSTag endTag = ((MergeEditorInput)getDiffModel()).getEndTag();
-
- Command.LocalOption[] options = new Command.LocalOption[] {
- Command.DO_NOT_RECURSE,
- Update.makeArgumentOption(Update.JOIN, startTag.getName()),
- Update.makeArgumentOption(Update.JOIN, endTag.getName()) };
-
- // run a join update using the start and end tags and the join points
- manager.update(getIResourcesFrom(nodes), options, createBackup, monitor);
- }
-
- private ITeamNode[] removeOutgoing(ITeamNode[] nodes) {
- // no filter done yet
- return nodes;
- }
-
- /*
- * If called on a new folder, the folder will become an outgoing addition.
- */
- private void makeRemoteLocal(CVSRemoteSyncElement element, IProgressMonitor monitor) throws CVSException {
- IRemoteResource remote = element.getRemote();
- final IResource local = element.getLocal();
- try {
- if(remote==null) {
- local.delete(false, monitor);
- } else {
- if(remote.isContainer()) {
- if(!local.exists()) {
- ((IFolder)local).create(false /*don't force*/, true /*local*/, monitor);
- }
- } else {
- monitor.beginTask(null, 200);
- try {
- IFile localFile = (IFile)local;
- if(local.exists()) {
- localFile.setContents(remote.getContents(Policy.subMonitorFor(monitor, 100)), false /*don't force*/, true /*keep history*/, Policy.subMonitorFor(monitor, 100));
- } else {
- if (!localFile.getParent().exists()) {
- ensureParentExists(localFile);
- }
- localFile.create(remote.getContents(Policy.subMonitorFor(monitor, 100)), false /*don't force*/, Policy.subMonitorFor(monitor, 100));
- }
- } finally {
- monitor.done();
- }
- }
- }
- } catch(CoreException e) {
- throw new CVSException(Policy.bind("UpdateMergeActionProblems_merging_remote_resources_into_workspace_1"), e); //$NON-NLS-1$
- }
- }
-
- private void ensureParentExists(IResource resource) throws CoreException {
- IContainer parent = resource.getParent();
- if (!parent.exists()) {
- ensureParentExists(parent);
- IFolder folder = (IFolder)parent;
- folder.create(false, true, null);
- }
- }
- /**
- * @see MergeAction#getHelpContextID()
- */
- protected String getHelpContextID() {
- return IHelpContextIds.MERGE_UPDATE_ACTION;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateWithForcedJoinAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateWithForcedJoinAction.java
deleted file mode 100644
index 3f8777a8d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateWithForcedJoinAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.util.Assert;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-
-/*
- * Used only in the merge editor. This action allows the user to select a single conflict and use
- * the cvs update -j command to merge the changes. This is required because when building the
- * sync tree for a merge the cvs command 'cvs -n update -j -j' does not tell us which files
- * can be auto-merged. This action then allows the user to run the merge without having to
- * individually select each difference and use the 'copy right to left' buttons.
- */
-public class UpdateWithForcedJoinAction extends UpdateMergeAction {
- public UpdateWithForcedJoinAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- /*
- * @see UpdateSyncAction#runUpdateDeep(ITeamNode[], RepositoryManager, IProgressMonitor)
- */
- protected void runUpdateDeep(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- // cannot be called from this action
- Assert.isTrue(false);
- }
-
- /*
- * @see UpdateSyncAction#runUpdateIgnoreLocalShallow(ITeamNode[], RepositoryManager, IProgressMonitor)
- */
- protected void runUpdateIgnoreLocalShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- // force an update -j -j to be called on the conflict
- mergeWithLocal(nodes, manager, true, monitor);
- }
-
- /*
- * @see UpdateSyncAction#runUpdateShallow(ITeamNode[], RepositoryManager, IProgressMonitor)
- */
- protected void runUpdateShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- // cannot be called from this action
- Assert.isTrue(false);
- }
-
- /*
- * @see MergeAction#isEnabled(ITeamNode)
- */
- protected boolean isEnabled(ITeamNode node) {
- int kind = node.getKind();
- if ((node.getChangeDirection() == IRemoteSyncElement.CONFLICTING) &&
- (kind & IRemoteSyncElement.AUTOMERGE_CONFLICT) == 0) {
- return true;
- } else {
- return false;
- }
- }
- /*
- * @see UpdateSyncAction#promptForConflicts()
- */
- protected boolean promptForConflicts() {
- // don't prompt for overriding conflicts, because this action is simply merging and creating a backup copy of the original file.
- return true;
- }
-
- /*
- * Override removeNonApplicableNodes because conflicting nodes should not be removed from this set.
- */
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeOutgoingNodes();
- set.removeIncomingNodes();
- }
- /**
- * @see MergeAction#getHelpContextID()
- */
- protected String getHelpContextID() {
- return IHelpContextIds.MERGE_UPDATE_WITH_JOIN_ACTION;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ICVSRunnableContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ICVSRunnableContext.java
index 64adcea1c..7e72aa83c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ICVSRunnableContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ICVSRunnableContext.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
/**
- * An ICVSRunnableContext is used to provide the context for a CVS operation.
+ * An ITeamRunnableContext is used to provide the context for a Team operation.
* The hierarchy of contexts is used to configure the following:
* 1) whether the operation is run in the background as a job
* 2) whether the operation modifies the workspace
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
index 6d8018a03..e505a4cf1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
@@ -18,6 +18,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
@@ -48,7 +49,7 @@ public class ReconcileProjectOperation extends CVSOperation {
ICVSRemoteFolder remote = CheckoutToRemoteFolderOperation.checkoutRemoteFolder(getShell(), folder, Policy.subMonitorFor(monitor, 100));
// TODO: make -in-sync should also be done by the subscriber
makeFoldersInSync(project, remote, Policy.subMonitorFor(monitor, 100));
- CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().setRemote(project, remote,Policy.subMonitorFor(monitor, 100));
+ CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().setRemote(project, (ISubscriberResource)remote, Policy.subMonitorFor(monitor, 100));
Display.getDefault().asyncExec(new Runnable() {
public void run() {
CVSUIPlugin.showInSyncView(getShell(), null, 0 /* no mode in particular */);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
index d8bf409a4..9fc520e66 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
@@ -17,11 +17,8 @@ import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.core.subscribers.SyncInfoFilter.OrSyncInfoFilter;
import org.eclipse.team.core.subscribers.SyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Update;
@@ -157,7 +154,7 @@ public class MergeUpdateAction extends SafeUpdateAction {
* If called on a new folder, the folder will become an outgoing addition.
*/
private void makeRemoteLocal(SyncInfo info, IProgressMonitor monitor) throws TeamException {
- IRemoteResource remote = info.getRemote();
+ ISubscriberResource remote = info.getRemote();
IResource local = info.getLocal();
try {
if(remote==null) {
@@ -170,10 +167,10 @@ public class MergeUpdateAction extends SafeUpdateAction {
try {
IFile localFile = (IFile)local;
if(local.exists()) {
- localFile.setContents(remote.getContents(Policy.subMonitorFor(monitor, 100)), false /*don't force*/, true /*keep history*/, Policy.subMonitorFor(monitor, 100));
+ localFile.setContents(remote.getStorage(Policy.subMonitorFor(monitor, 100)).getContents(), false /*don't force*/, true /*keep history*/, Policy.subMonitorFor(monitor, 100));
} else {
ensureContainerExists(getParent(info));
- localFile.create(remote.getContents(Policy.subMonitorFor(monitor, 100)), false /*don't force*/, Policy.subMonitorFor(monitor, 100));
+ localFile.create(remote.getStorage(Policy.subMonitorFor(monitor, 100)).getContents(), false /*don't force*/, Policy.subMonitorFor(monitor, 100));
}
} finally {
monitor.done();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
index d2a548851..0252216b2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
@@ -20,9 +20,7 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.subscribers.SyncInfoFilter.*;
-import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -217,8 +215,8 @@ public abstract class SafeUpdateAction extends CVSSubscriberAction {
SyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),
new SyncInfoFilter() {
public boolean select(SyncInfo info) {
- IRemoteResource remote = info.getRemote();
- IRemoteResource base = info.getBase();
+ ISubscriberResource remote = info.getRemote();
+ ISubscriberResource base = info.getBase();
if (info.getLocal().exists()) {
// local != base and no remote will fail
return (base != null && remote == null);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java
deleted file mode 100644
index aac0b1902..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-
-/**
- * This is a CVS sync view action that will
- */
-public class AddSyncAction extends MergeAction {
- public AddSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected SyncSet run(SyncSet syncSet, IProgressMonitor monitor) {
- boolean result = saveIfNecessary();
- if (!result) return null;
-
- ITeamNode[] changed = syncSet.getChangedNodes();
- if (changed.length == 0) {
- return syncSet;
- }
- List additions = new ArrayList();
-
- try {
- for (int i = 0; i < changed.length; i++) {
- int kind = changed[i].getKind();
- // leave the added nodes in the sync view. Their sync state
- // won't change but the decoration should.
- IResource resource = changed[i].getResource();
- if ((kind & Differencer.DIRECTION_MASK) == ITeamNode.CONFLICTING) {
- if (resource.getType() == IResource.FOLDER) {
- makeInSync(changed[i]);
- } else {
- makeAdded(changed[i]);
- }
- } else {
- if (resource.getType() == IResource.FILE) {
- additions.add(resource);
- }
- }
- }
-
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- if (additions.size() != 0) {
- manager.add((IResource[])additions.toArray(new IResource[0]), monitor);
- }
-
- // for all files ensure that parent folders are made in sync after
- // the add completes.
- for (int i = 0; i < changed.length; i++) {
- ITeamNode node = changed[i];
- IResource resource = changed[i].getResource();
- if (resource.getType() == IResource.FILE) {
- syncSet.remove(node);
- }
- }
- } catch (final TeamException e) {
- handle(e);
- return null;
- }
-
- return syncSet;
- }
-
- protected void makeAdded(ITeamNode changed)
- throws TeamException, CVSException {
- // Fake the add locally since add command will fail
- makeInSync(changed.getParent());
- CVSRemoteSyncElement syncElement = (CVSRemoteSyncElement)((TeamFile)changed).getMergeResource().getSyncElement();
- ICVSResource remote = (ICVSResource)syncElement.getRemote();
- MutableResourceSyncInfo info = remote.getSyncInfo().cloneMutable();
- info.setTimeStamp(null);
- info.setAdded();
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)changed.getResource());
- cvsFile.setSyncInfo(info, ICVSFile.UNKNOWN);
- }
-
- /**
- * Enabled for folders and files that aren't added.
- */
- protected boolean isEnabled(ITeamNode node) {
- try {
- CVSSyncSet set = new CVSSyncSet(new StructuredSelection(node));
- set.removeConflictingNodes();
- return set.hasNonAddedChanges();
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return false;
- }
- }
-
- /**
- * Remove all nodes that aren't files and folders that need to be added.
- */
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeIncomingNodes();
- set.removeConflictingNodes();
- ((CVSSyncSet)set).removeAddedChanges();
- }
- /**
- * @see MergeAction#getHelpContextID()
- */
- protected String getHelpContextID() {
- return IHelpContextIds.SYNC_ADD_ACTION;
- }
-
- protected String getErrorTitle() {
- return Policy.bind("AddAction.addFailed"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
index 2b05f4192..38ee3e47f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
@@ -13,86 +13,38 @@ package org.eclipse.team.internal.ccvs.ui.sync;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.structuremergeviewer.DiffContainer;
-import org.eclipse.compare.structuremergeviewer.DiffElement;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.HistoryView;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.OverlayIconCache;
+import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.merge.OverrideUpdateMergeAction;
-import org.eclipse.team.internal.ccvs.ui.merge.UpdateMergeAction;
-import org.eclipse.team.internal.ccvs.ui.merge.UpdateWithForcedJoinAction;
import org.eclipse.team.internal.ui.OverlayIcon;
-import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer;
-import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.MergeResource;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.team.internal.ui.sync.TeamFile;
+import org.eclipse.team.internal.ui.sync.*;
import org.eclipse.ui.help.WorkbenchHelp;
public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
// Actions
- private UpdateSyncAction updateAction;
- private ForceUpdateSyncAction forceUpdateAction;
-
- private CommitSyncAction commitAction;
- private ForceCommitSyncAction forceCommitAction;
-
- private UpdateMergeAction updateMergeAction;
- private UpdateWithForcedJoinAction updateWithJoinAction;
- private OverrideUpdateMergeAction forceUpdateMergeAction;
-
- private IgnoreAction ignoreAction;
private HistoryAction showInHistory;
- private Action confirmMerge;
- private AddSyncAction addAction;
-
- private Action selectAdditions;
private Image conflictImage;
private static class DiffOverlayIcon extends OverlayIcon {
@@ -219,16 +171,7 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
this.overlay = overlay;
}
}
-
- private Image getConflictImage() {
- if(conflictImage != null)
- return conflictImage;
- final ImageDescriptor conflictDescriptor = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_MERGEABLE_CONFLICT);
- conflictImage = conflictDescriptor.createImage();
- return conflictImage;
- }
-
private void initializeLabelProvider() {
final LabelProvider oldProvider = (LabelProvider)getLabelProvider();
@@ -315,199 +258,15 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
if (showInHistory != null) {
manager.add(showInHistory);
}
- manager.add(new Separator());
- switch (getSyncMode()) {
- case SyncView.SYNC_INCOMING:
- updateAction.update(SyncView.SYNC_INCOMING);
- manager.add(updateAction);
- forceUpdateAction.update(SyncView.SYNC_INCOMING);
- manager.add(forceUpdateAction);
- manager.add(new Separator());
- confirmMerge.setEnabled(confirmMerge.isEnabled());
- manager.add(confirmMerge);
- break;
- case SyncView.SYNC_OUTGOING:
- addAction.update(SyncView.SYNC_OUTGOING);
- manager.add(addAction);
- commitAction.update(SyncView.SYNC_OUTGOING);
- manager.add(commitAction);
- forceCommitAction.update(SyncView.SYNC_OUTGOING);
- manager.add(forceCommitAction);
- ignoreAction.update();
- manager.add(ignoreAction);
- manager.add(new Separator());
- confirmMerge.setEnabled(confirmMerge.isEnabled());
- manager.add(confirmMerge);
- selectAdditions.setEnabled(selectAdditions.isEnabled());
- manager.add(selectAdditions);
- break;
- case SyncView.SYNC_BOTH:
- addAction.update(SyncView.SYNC_BOTH);
- manager.add(addAction);
- commitAction.update(SyncView.SYNC_BOTH);
- manager.add(commitAction);
- updateAction.update(SyncView.SYNC_BOTH);
- manager.add(updateAction);
- ignoreAction.update();
- manager.add(ignoreAction);
- manager.add(new Separator());
- forceCommitAction.update(SyncView.SYNC_BOTH);
- manager.add(forceCommitAction);
- forceUpdateAction.update(SyncView.SYNC_BOTH);
- manager.add(forceUpdateAction);
- manager.add(new Separator());
- confirmMerge.setEnabled( confirmMerge.isEnabled());
- manager.add(confirmMerge);
- break;
- case SyncView.SYNC_MERGE:
- updateMergeAction.update(SyncView.SYNC_INCOMING);
- forceUpdateMergeAction.update(SyncView.SYNC_INCOMING);
- updateWithJoinAction.update(SyncView.SYNC_INCOMING);
- manager.add(updateMergeAction);
- manager.add(forceUpdateMergeAction);
- manager.add(updateWithJoinAction);
- break;
- }
}
/**
* Creates the actions for this viewer.
*/
- private void initializeActions(final CVSSyncCompareInput diffModel) {
- Shell shell = getControl().getShell();
- commitAction = new CommitSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.commit"), shell); //$NON-NLS-1$
- forceCommitAction = new ForceCommitSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.forceCommit"), shell); //$NON-NLS-1$
- updateAction = new UpdateSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.update"), shell); //$NON-NLS-1$
- forceUpdateAction = new ForceUpdateSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.forceUpdate"), shell); //$NON-NLS-1$
- updateMergeAction = new UpdateMergeAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.update"), shell); //$NON-NLS-1$
- ignoreAction = new IgnoreAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.ignore"), shell); //$NON-NLS-1$
- updateWithJoinAction = new UpdateWithForcedJoinAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.mergeUpdate"), shell); //$NON-NLS-1$
- forceUpdateMergeAction = new OverrideUpdateMergeAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.forceUpdate"), shell); //$NON-NLS-1$
- addAction = new AddSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.addAction"), shell); //$NON-NLS-1$
-
- // Show in history view
+ private void initializeActions(final CVSSyncCompareInput diffModel) { // Show in history view
showInHistory = new HistoryAction(Policy.bind("CVSCatchupReleaseViewer.showInHistory")); //$NON-NLS-1$
WorkbenchHelp.setHelp(showInHistory, IHelpContextIds.SHOW_IN_RESOURCE_HISTORY);
addSelectionChangedListener(showInHistory);
-
- selectAdditions = new Action(Policy.bind("CVSCatchupReleaseViewer.Select_&Outgoing_Additions_1"), null) { //$NON-NLS-1$
- public boolean isEnabled() {
- DiffNode node = diffModel.getDiffRoot();
- IDiffElement[] elements = node.getChildren();
- for (int i = 0; i < elements.length; i++) {
- IDiffElement element = elements[i];
- if (element instanceof ITeamNode) {
- CVSSyncSet set = new CVSSyncSet(new StructuredSelection(element));
- try {
- if (set.hasNonAddedChanges()) return true;
- } catch (CVSException e) {
- // Log the error and enable the menu item
- CVSUIPlugin.log(e);
- return true;
- }
- } else {
- // unanticipated situation, just enable the action
- return true;
- }
- }
- return false;
- }
- public void run() {
- List additions = new ArrayList();
- DiffNode root = diffModel.getDiffRoot();
- visit(root, additions);
- setSelection(new StructuredSelection(additions));
- }
- private void visit(IDiffElement node, List additions) {
- try {
- if (node instanceof TeamFile) {
- TeamFile file = (TeamFile)node;
- if (file.getChangeDirection() == IRemoteSyncElement.OUTGOING) {
- if (file.getChangeType() == IRemoteSyncElement.ADDITION) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(file.getResource());
- if (cvsResource.isManaged()) return;
- additions.add(node);
- }
- }
- return;
- }
- if (node instanceof ChangedTeamContainer) {
- ChangedTeamContainer container = (ChangedTeamContainer)node;
- if (container.getChangeDirection() == IRemoteSyncElement.OUTGOING) {
- if (container.getChangeType() == IRemoteSyncElement.ADDITION) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(container.getResource());
- if (!((ICVSFolder)cvsResource).isCVSFolder()) {
- additions.add(node);
- }
- }
- }
-
- }
- if (node instanceof DiffContainer) {
- IDiffElement[] children = ((DiffContainer)node).getChildren();
- for (int i = 0; i < children.length; i++) {
- visit(children[i], additions);
- }
- }
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- };
- WorkbenchHelp.setHelp(selectAdditions, IHelpContextIds.SELECT_NEW_RESOURCES_ACTION);
-
- // confirm merge
- confirmMerge = new Action(Policy.bind("CVSCatchupReleaseViewer.confirmMerge"), null) { //$NON-NLS-1$
- public void run() {
- ISelection s = getSelection();
- if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
- return;
- }
- List needsMerge = new ArrayList();
- for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) {
- final Object element = it.next();
- if(element instanceof DiffElement) {
- mergeRecursive((IDiffElement)element, needsMerge);
- }
- }
- TeamFile[] files = (TeamFile[]) needsMerge.toArray(new TeamFile[needsMerge.size()]);
- if(files.length != 0) {
- try {
- for (int i = 0; i < files.length; i++) {
- TeamFile teamFile = (TeamFile)files[i];
- CVSUIPlugin.getPlugin().getRepositoryManager().merged(new IRemoteSyncElement[] {teamFile.getMergeResource().getSyncElement()});
- teamFile.merged();
- }
- } catch(TeamException e) {
- CVSUIPlugin.openError(getControl().getShell(), null, null, e);
- }
- }
- refresh();
- diffModel.updateStatusLine();
- }
-
- public boolean isEnabled() {
- ISelection s = getSelection();
- if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
- return false;
- }
- for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) {
- Object element = (Object) it.next();
- if(element instanceof TeamFile) {
- TeamFile file = (TeamFile)element;
- int direction = file.getChangeDirection();
- int type = file.getChangeType();
- if(direction == IRemoteSyncElement.INCOMING ||
- direction == IRemoteSyncElement.CONFLICTING) {
- continue;
- }
- }
- return false;
- }
- return true;
- }
- };
- WorkbenchHelp.setHelp(confirmMerge, IHelpContextIds.CONFIRM_MERGE_ACTION);
}
protected void mergeRecursive(IDiffElement element, List needsMerge) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareUnsharedInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareUnsharedInput.java
deleted file mode 100644
index 7d81f80d3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareUnsharedInput.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public class CVSSyncCompareUnsharedInput extends CVSSyncCompareInput {
-
- private ICVSRepositoryLocation location;
- private String moduleName;
- private CVSTag tag;
-
- public CVSSyncCompareUnsharedInput(IProject project, ICVSRepositoryLocation location, String moduleName, CVSTag tag) {
- super(new IResource[] { project });
- this.location = location;
- this.moduleName = moduleName;
- this.tag = tag;
- }
-
- protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
- IResource[] resources = getResources();
- IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length];
- int work = 1000 * resources.length;
- monitor.beginTask(null, work);
- try {
- for (int i = 0; i < trees.length; i++) {
- trees[i] = CVSWorkspaceRoot.getRemoteSyncTree((IProject)resources[i], location, moduleName, tag, Policy.subMonitorFor(monitor, 1000));
- }
- } finally {
- monitor.done();
- }
- return trees;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java
deleted file mode 100644
index 08703dd84..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-
-/**
- * Override ForceCommitSyncAction to only work on outgoing nodes
- */
-public class CommitSyncAction extends ForceCommitSyncAction {
- public CommitSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected boolean isEnabled(ITeamNode node) {
- // The commit action is enabled only for non-conflicting outgoing changes
- CVSSyncSet set = new CVSSyncSet(new StructuredSelection(node));
- return set.hasOutgoingChanges();
- }
-
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeConflictingNodes();
- set.removeIncomingNodes();
- }
- /**
- * @see MergeAction#getHelpContextID()
- */
- protected String getHelpContextID() {
- return IHelpContextIds.SYNC_COMMIT_ACTION;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java
deleted file mode 100644
index c4bd759b3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
-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.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-
-public class ForceCommitSyncAction extends MergeAction {
- public ForceCommitSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected SyncSet run(SyncSet syncSet, IProgressMonitor monitor) {
- boolean result = saveIfNecessary();
- if (!result) return null;
-
- // If there is a conflict in the syncSet, we need to prompt the user before proceeding.
- if (syncSet.hasConflicts() || syncSet.hasIncomingChanges()) {
- switch (promptForConflicts(syncSet)) {
- case 0:
- // Yes, synchronize conflicts as well
- break;
- case 1:
- // No, only synchronize non-conflicting changes.
- syncSet.removeConflictingNodes();
- syncSet.removeIncomingNodes();
- break;
- case 2:
- default:
- // Cancel
- return null;
- }
- }
- ITeamNode[] changed = syncSet.getChangedNodes();
- if (changed.length == 0) {
- return syncSet;
- }
-
- // accumulate any resources that are not under version control
- IResource[] unadded = null;
- if (syncSet instanceof CVSSyncSet) {
- CVSSyncSet cvsSyncSet = (CVSSyncSet)syncSet;
- try {
- if (cvsSyncSet.hasNonAddedChanges()) {
- ITeamNode[] nodes = cvsSyncSet.getNonAddedNodes();
- unadded = new IResource[nodes.length];
- for (int i = 0; i < nodes.length; i++) {
- unadded[i] = nodes[i].getResource();
- }
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- // prompt to get comment and any resources to be added to version control
- final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- IResource[] toBeAdded = promptForResourcesToBeAdded(manager, unadded);
- if (toBeAdded == null) return null; // User cancelled.
- final String comment = promptForComment(manager, syncSet.getResources());
- if (comment == null) return null; // User cancelled.
-
- // remove unshared resources that were not selected by the user
- if (unadded != null && unadded.length > 0) {
- List resourcesToRemove = new ArrayList(unadded.length);
- for (int i = 0; i < unadded.length; i++) {
- IResource unaddedResource = unadded[i];
- boolean included = false;
- for (int j = 0; j < toBeAdded.length; j++) {
- IResource resourceToAdd = toBeAdded[j];
- if (unaddedResource.equals(resourceToAdd)) {
- included = true;
- break;
- }
- }
- if (!included)
- resourcesToRemove.add(unaddedResource);
- }
- CVSSyncSet cvsSyncSet = (CVSSyncSet)syncSet;
- cvsSyncSet.removeNonAddedResources((IResource[]) resourcesToRemove.toArray(new IResource[resourcesToRemove.size()]));
- changed = syncSet.getChangedNodes();
- if (changed.length == 0) {
- return syncSet;
- }
- }
-
- final List commits = new ArrayList();
- final List additions = new ArrayList();
- final List deletions = new ArrayList();
- final List toMerge = new ArrayList();
- final List incoming = new ArrayList();
-
- // A list of diff elements in the sync set which are incoming folder additions
- final List parentCreationElements = new ArrayList();
- // A list of diff elements in the sync set which are folder conflicts
- final List parentConflictElements = new ArrayList();
-
- for (int i = 0; i < changed.length; i++) {
- int kind = changed[i].getKind();
- IResource resource = changed[i].getResource();
- if (resource.getType() == IResource.FILE) {
- commits.add(resource);
- }
- IDiffContainer parent = changed[i].getParent();
- if (parent != null) {
- int parentKind = changed[i].getParent().getKind();
- if (((parentKind & Differencer.CHANGE_TYPE_MASK) == Differencer.ADDITION) &&
- ((parentKind & Differencer.DIRECTION_MASK) == ITeamNode.INCOMING)) {
- parentCreationElements.add(parent);
- } else if ((parentKind & Differencer.DIRECTION_MASK) == ITeamNode.CONFLICTING) {
- parentConflictElements.add(parent);
- }
- }
- switch (kind & Differencer.DIRECTION_MASK) {
- case ITeamNode.INCOMING:
- // Incoming change. Make it outgoing before committing.
- incoming.add(changed[i]);
- break;
- case ITeamNode.OUTGOING:
- switch (kind & Differencer.CHANGE_TYPE_MASK) {
- case Differencer.ADDITION:
- // Outgoing addition. 'add' it before committing.
- additions.add(resource);
- break;
- case Differencer.DELETION:
- // Outgoing deletion. 'delete' it before committing.
- deletions.add(resource);
- break;
- case Differencer.CHANGE:
- // Outgoing change. Just commit it.
- break;
- }
- break;
- case ITeamNode.CONFLICTING:
- if (changed[i] instanceof TeamFile) {
- toMerge.add(((TeamFile)changed[i]).getMergeResource().getSyncElement());
- }
- break;
- }
- }
- try {
- // execute the operations in a single CVS runnable so sync changes are batched
- CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot()).run(
- new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- if (parentCreationElements.size() > 0) {
- // If a node has a parent that is an incoming folder creation, we have to
- // create that folder locally and set its sync info before we can get the
- // node itself. We must do this for all incoming folder creations (recursively)
- // in the case where there are multiple levels of incoming folder creations.
- Iterator it = parentCreationElements.iterator();
- while (it.hasNext()) {
- makeInSync((IDiffElement)it.next());
- }
- }
- if (parentConflictElements.size() > 0) {
- // If a node has a parent that is a folder conflict, that means that the folder
- // exists locally but has no sync info. In order to get the node, we have to
- // create the sync info for the folder (and any applicable parents) before we
- // get the node itself.
- Iterator it = parentConflictElements.iterator();
- while (it.hasNext()) {
- makeInSync((IDiffElement)it.next());
- }
- }
-
- // Handle any real incomming deletions by unmanaging them before adding
- Iterator it = incoming.iterator();
- Set incomingDeletions = new HashSet(incoming.size());
- while (it.hasNext()) {
- ITeamNode node = (ITeamNode)it.next();
- collectIncomingDeletions(node, incomingDeletions, monitor);
- if ((node instanceof TeamFile) && !additions.contains(node)) {
- CVSRemoteSyncElement element = (CVSRemoteSyncElement)((TeamFile)node).getMergeResource().getSyncElement();
- element.makeOutgoing(monitor);
- }
- }
- it = incomingDeletions.iterator();
- while (it.hasNext()) {
- ITeamNode node = (ITeamNode)it.next();
- CVSRemoteSyncElement syncElement;
- if (node instanceof TeamFile) {
- syncElement = (CVSRemoteSyncElement)((TeamFile)node).getMergeResource().getSyncElement();
- } else {
- syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)node).getMergeResource().getSyncElement();
- }
- additions.add(syncElement.getLocal());
- CVSWorkspaceRoot.getCVSResourceFor(syncElement.getLocal()).unmanage(null);
- }
-
- if (additions.size() != 0) {
- manager.add((IResource[])additions.toArray(new IResource[0]), monitor);
- }
- if (deletions.size() != 0) {
- manager.delete((IResource[])deletions.toArray(new IResource[0]), monitor);
- }
- if (toMerge.size() != 0) {
- manager.merged((IRemoteSyncElement[])toMerge.toArray(new IRemoteSyncElement[0]));
- }
- manager.commit((IResource[])commits.toArray(new IResource[commits.size()]), comment, monitor);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- }
- }, monitor);
- } catch (CVSException e) {
- handle(e);
- return null;
- }
-
- return syncSet;
- }
-
- protected boolean isEnabled(ITeamNode node) {
- // The force commit action is enabled only for conflicting and incoming changes
- CVSSyncSet set = new CVSSyncSet(new StructuredSelection(node));
- if (syncMode == SyncView.SYNC_OUTGOING) {
- return (set.hasConflicts() && hasRealChanges(node, new int[] { ITeamNode.CONFLICTING }));
- } else {
- return ((set.hasIncomingChanges() || set.hasConflicts()) && hasRealChanges(node, new int[] { ITeamNode.CONFLICTING, ITeamNode.INCOMING }));
- }
- }
-
- /**
- * Prompts the user to determine how conflicting changes should be handled.
- * Note: This method is designed to be overridden by test cases.
- * @return 0 to sync conflicts, 1 to sync all non-conflicts, 2 to cancel
- */
- protected int promptForConflicts(SyncSet syncSet) {
- String[] buttons = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL};
- String question = Policy.bind("CommitSyncAction.questionRelease"); //$NON-NLS-1$
- String title = Policy.bind("CommitSyncAction.titleRelease"); //$NON-NLS-1$
- String[] tips = new String[] {
- Policy.bind("CommitSyncAction.releaseAll"), //$NON-NLS-1$
- Policy.bind("CommitSyncAction.releasePart"), //$NON-NLS-1$
- Policy.bind("CommitSyncAction.cancelRelease") //$NON-NLS-1$
- };
- Shell shell = getShell();
- final ToolTipMessageDialog dialog = new ToolTipMessageDialog(shell, title, null, question, MessageDialog.QUESTION, buttons, tips, 0);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- return dialog.getReturnCode();
- }
-
- /**
- * Prompts the user for a release comment.
- * Note: This method is designed to be overridden by test cases.
- * @return the comment, or null to cancel
- */
- protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
- return manager.promptForComment(getShell(), resourcesToCommit);
- }
-
- protected IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
- return manager.promptForResourcesToBeAdded(getShell(), unadded);
- }
-
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeOutgoingNodes();
- if (syncMode != SyncView.SYNC_BOTH) {
- set.removeIncomingNodes();
- }
- }
-
- /*
- * Handle incoming folder deletion.
- *
- * Special handling is required in the case were a folder has been deleted remotely
- * (i.e using "rm -rf" on the server).
- *
- * We need to determine if there is a remote folder corresponding to this folder
- * If there isn't, we need to unmanage the local resource and then add the folder
- * Unfortunately, unmanaging may effect the state of the children which are also incoming deletions
- */
- private void collectIncomingDeletions(ITeamNode node, Set additions, IProgressMonitor monitor) throws TeamException {
- if (isIncomingDeletion(node) && ! additions.contains(node) && ! existsRemotely(node, monitor)) {
-
- // Make sure that the parent is handled
- IDiffContainer parent = node.getParent();
- if (isIncomingDeletion((ITeamNode)parent)) {
- collectIncomingDeletions((ITeamNode)parent, additions, monitor);
- }
-
- // Add the node to the list
- additions.add(node);
- }
- }
-
- private boolean isIncomingDeletion(ITeamNode node) {
- return (node.getChangeDirection() == ITeamNode.INCOMING && node.getChangeType() == Differencer.DELETION);
- }
-
- /*
- * For files, use the remote of the sync element to determine whether there is a remote or not.
- * For folders, if there is no remote in the tree check remotely in case the folder was pruned
- */
- private boolean existsRemotely(ITeamNode node, IProgressMonitor monitor) throws TeamException {
-
- CVSRemoteSyncElement syncElement;
- if (node instanceof TeamFile) {
- syncElement = (CVSRemoteSyncElement)((TeamFile)node).getMergeResource().getSyncElement();
- } else {
- syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)node).getMergeResource().getSyncElement();
- }
- if (syncElement.getRemote() != null) {
- return true;
- }
- if (syncElement.getLocal().getType() == IResource.FILE) {
- return false;
- }
- return CVSWorkspaceRoot.getRemoteResourceFor(syncElement.getLocal()).exists(monitor);
- }
- /**
- * @see MergeAction#getHelpContextID()
- */
- protected String getHelpContextID() {
- return IHelpContextIds.SYNC_FORCED_COMMIT_ACTION;
- }
-
- protected String getErrorTitle() {
- return Policy.bind("CommitAction.commitFailed"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceUpdateSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceUpdateSyncAction.java
deleted file mode 100644
index bd3b02042..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceUpdateSyncAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.SyncView;
-
-public class ForceUpdateSyncAction extends UpdateSyncAction {
-
- public ForceUpdateSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected boolean isEnabled(ITeamNode node) {
- // The force update action is enabled only for conflicting and outgoing changes
- SyncSet set = new SyncSet(new StructuredSelection(node));
- if (syncMode == SyncView.SYNC_INCOMING) {
- return (set.hasConflicts() && hasRealChanges(node, new int[] { ITeamNode.CONFLICTING }));
- } else {
- return ((set.hasOutgoingChanges() || set.hasConflicts()) && hasRealChanges(node, new int[] { ITeamNode.CONFLICTING, ITeamNode.OUTGOING }));
- }
- }
-
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeIncomingNodes();
- if (syncMode != SyncView.SYNC_BOTH) {
- set.removeOutgoingNodes();
- }
- }
-
- /**
- * @see MergeAction#getHelpContextID()
- */
- protected String getHelpContextID() {
- return IHelpContextIds.SYNC_FORCED_UPDATE_ACTION;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/IgnoreAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/IgnoreAction.java
deleted file mode 100644
index 61036eca1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/IgnoreAction.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.IgnoreResourcesDialog;
-import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-import org.eclipse.team.internal.ui.sync.UnchangedTeamContainer;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class IgnoreAction extends Action {
- Shell shell;
- private CVSSyncCompareInput diffModel;
- private ISelectionProvider selectionProvider;
-
- public IgnoreAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(label);
- this.shell = shell;
- this.diffModel = model;
- this.selectionProvider = sp;
- WorkbenchHelp.setHelp(this, IHelpContextIds.SYNC_IGNORE_ACTION);
- }
- public void run() {
- IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();
- if (selection.isEmpty()) return;
- // Do the update
- Object first = selection.getFirstElement();
- ICVSResource cvsResource = null;
- IResource resource = null;
- if (first instanceof TeamFile) {
- resource = ((TeamFile)first).getMergeResource().getResource();
- cvsResource = CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
- } else if (first instanceof ChangedTeamContainer) {
- resource = ((ChangedTeamContainer)first).getMergeResource().getResource();
- cvsResource = CVSWorkspaceRoot.getCVSFolderFor((IContainer) resource);
- }
- if (resource != null) {
- try {
- IgnoreResourcesDialog dialog = new IgnoreResourcesDialog(shell, new IResource[] {resource});
- if (dialog.open() != IgnoreResourcesDialog.OK) return;
- String pattern = dialog.getIgnorePatternFor(resource);
- cvsResource.setIgnoredAs(pattern);
- } catch (CVSException e) {
- CVSUIPlugin.openError(shell, null, null, e);
- return;
- }
- removeNodes(new SyncSet(selection).getChangedNodes());
- diffModel.refresh();
- }
- }
- /**
- * Enabled if only one item is selected and it is an outgoing addition.
- *
- * This may be a folder or a single file, which will be handled differently.
- */
- protected boolean isEnabled(Object[] nodes) {
- if (nodes.length != 1) return false;
- if (!(nodes[0] instanceof ITeamNode)) return false;
- ITeamNode node = (ITeamNode)nodes[0];
- if (node.getKind() != (ITeamNode.OUTGOING | IRemoteSyncElement.ADDITION)) return false;
- IResource resource = node.getResource();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- try {
- if (cvsResource.isManaged()) return false;
- if (cvsResource.isIgnored()) return false;
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return false;
- }
- return true;
- }
- public void update() {
- IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();
- setEnabled(isEnabled(selection.toArray()));
- }
- /**
- * The given nodes have been synchronized. Remove them from
- * the sync set.
- */
- private void removeNodes(final ITeamNode[] nodes) {
- // Update the model
- for (int i = 0; i < nodes.length; i++) {
- if (nodes[i].getClass() == UnchangedTeamContainer.class) {
- // Unchanged containers get removed automatically when all
- // children are removed
- continue;
- }
- if (nodes[i].getClass() == ChangedTeamContainer.class) {
- // If this node still has children, convert to an
- // unchanged container, then it will disappear when
- // all children have been removed.
- ChangedTeamContainer container = (ChangedTeamContainer)nodes[i];
- IDiffElement[] children = container.getChildren();
- if (children.length > 0) {
- IDiffContainer parent = container.getParent();
- UnchangedTeamContainer unchanged = new UnchangedTeamContainer(parent, container.getResource());
- for (int j = 0; j < children.length; j++) {
- unchanged.add(children[j]);
- }
- parent.removeToRoot(container);
- continue;
- }
- // No children, it will get removed below.
- }
- nodes[i].getParent().removeToRoot(nodes[i]);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java
deleted file mode 100644
index ec67075f3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-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.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.UnchangedTeamContainer;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Applies merge related actions to the selected ITeamNodes.
- */
-abstract class MergeAction extends Action {
- public static final int CHECKIN = 0;
- public static final int GET = 1;
- public static final int DELETE_REMOTE = 2;
- public static final int DELETE_LOCAL = 3;
-
- private CVSSyncCompareInput diffModel;
- private ISelectionProvider selectionProvider;
-
- protected int syncMode;
- private Shell shell;
-
- /**
- * Creates a MergeAction which works on selection and doesn't commit changes.
- */
- public MergeAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(label);
- this.diffModel = model;
- this.selectionProvider = sp;
- this.shell = shell;
- String helpContextId = getHelpContextID();
- if (helpContextId != null) {
- WorkbenchHelp.setHelp(this, helpContextId);
- }
- }
-
- /**
- * Method getHelpContextID.
- * @return String
- */
- protected String getHelpContextID() {
- return null;
- }
-
- protected Shell getShell() {
- return shell;
- }
-
- protected CVSSyncCompareInput getDiffModel() {
- return diffModel;
- }
-
- /**
- * Returns true if at least one node can perform the specified action.
- */
- private boolean isEnabled(Object[] nodes) {
- for (int i = 0; i < nodes.length; i++) {
- if (nodes[i] instanceof ITeamNode) {
- ITeamNode node = (ITeamNode)nodes[i];
- if (isEnabled(node)) {
- return true;
- }
- } else {
- if (nodes[i] instanceof IDiffContainer)
- if (isEnabled(((IDiffContainer)nodes[i]).getChildren()))
- return true;
- }
- }
- return false;
- }
-
- protected abstract boolean isEnabled(ITeamNode node);
-
- /**
- * Perform the sychronization operation.
- */
- public void run() {
- ISelection s = selectionProvider.getSelection();
- if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
- return;
- }
- final SyncSet set = new CVSSyncSet((IStructuredSelection)s);
- removeNonApplicableNodes(set, syncMode);
- final SyncSet[] result = new SyncSet[1];
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- result[0] = MergeAction.this.run(set, monitor);
- }
- };
- try {
- run(op);
- } catch (InterruptedException e) {
- }
- if (result[0] != null) {
- // all returned nodes that have a changed sync kind are assumed
- // to have been operated on and will be removed from the diff tree.
- removeNodes(result[0].getChangedNodes());
-
- // any node that claims that it's IN_SYNC will be automatically
- // filtered from the diff tree - see DiffElement.setKind().
- diffModel.updateView();
- }
- }
-
- protected abstract void removeNonApplicableNodes(SyncSet set, int syncMode);
-
- /**
- * The given nodes have been synchronized. Remove them from
- * the sync set.
- *
- * For folders that are outgoing deletions, we may need to leave the
- * folder as is or adjust the sync kind depending on the sync kind of
- * the folder's children.
- *
- * @see CVSSyncCompareInput#collectResourceChanges(IDiffContainer, IRemoteSyncElement, IProgressMonitor)
- */
- private void removeNodes(final ITeamNode[] nodes) {
- // Update the model
- Set outgoingFolderDeletions = new HashSet();
- for (int i = 0; i < nodes.length; i++) {
- if (nodes[i].getClass() == UnchangedTeamContainer.class) {
- // Unchanged containers get removed automatically when all
- // children are removed
- continue;
- }
- if (nodes[i].getClass() == ChangedTeamContainer.class) {
- // If this node still has children, convert to an
- // unchanged container, then it will disappear when
- // all children have been removed.
- ChangedTeamContainer container = (ChangedTeamContainer)nodes[i];
- IDiffElement[] children = container.getChildren();
- if (children.length > 0) {
- if (isLocallyDeletedFolder(container)) {
- // For locally deleted folders, we postpone the handling until all other children are removed
- outgoingFolderDeletions.add(container);
- } else {
- IDiffContainer parent = container.getParent();
- UnchangedTeamContainer unchanged = new UnchangedTeamContainer(parent, container.getResource());
- for (int j = 0; j < children.length; j++) {
- unchanged.add(children[j]);
- }
- parent.removeToRoot(container);
- }
- continue;
- }
- // No children, it will get removed below.
- } else if (nodes[i].getParent().getClass() == ChangedTeamContainer.class) {
- // If the parent is a locally deleted folder, we may want to update it's sync state as well
- if (isLocallyDeletedFolder(nodes[i].getParent())) {
- outgoingFolderDeletions.add(nodes[i].getParent());
- }
- }
- nodes[i].getParent().removeToRoot(nodes[i]);
- }
- // Remove any locally deleted folders from the sync tree as appropriate
- for (Iterator iter = outgoingFolderDeletions.iterator(); iter.hasNext();) {
- removeLocallyDeletedFolder((ChangedTeamContainer)iter.next());
- }
- }
-
- /**
- * Updates the action with the latest selection, setting enablement
- * as necessary.
- */
- public void update(int syncMode) {
- this.syncMode = syncMode;
- IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();
- setEnabled(isEnabled(selection.toArray()));
- }
-
- /**
- * Subclasses must implement this method, which performs action-specific code.
- *
- * It may return the sync set which was passed in, or null.
- */
- protected abstract SyncSet run(SyncSet syncSet, IProgressMonitor monitor);
-
- /**
- * Helper method to run a runnable in a progress monitor dialog, and display any errors.
- */
- protected void run(IRunnableWithProgress op) throws InterruptedException {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
- try {
- dialog.run(true, true, op);
- } catch (InvocationTargetException e) {
- handle(e);
- }
- }
-
- /**
- * Helper method. Check if a save is necessary. If it is, prompt the user to save.
- * Return true if all necessary saves have been performed, false otherwise.
- */
- protected boolean saveIfNecessary() {
- return getDiffModel().saveIfNecessary();
- }
-
- /**
- * Answer true if the given diff element represents a locally deleted CVS folder.
- * The sync state of locally deleted CVS folders is either outgoing deletion or
- * conflicting change.
- */
- protected boolean isLocallyDeletedFolder(IDiffElement element) {
- if ( ! (element.getType() == IDiffElement.FOLDER_TYPE)) return false;
- int kind = element.getKind();
- return (((kind & Differencer.CHANGE_TYPE_MASK) == Differencer.DELETION) &&
- ((kind & Differencer.DIRECTION_MASK) == ITeamNode.OUTGOING))
- || (((kind & Differencer.CHANGE_TYPE_MASK) == Differencer.CHANGE) &&
- ((kind & Differencer.DIRECTION_MASK) == ITeamNode.CONFLICTING));
- }
-
- /**
- * Recreate any parents that are outgoing folder deletions
- */
- protected void recreateLocallyDeletedFolder(IDiffElement element) throws TeamException {
- // Recursively make the parent element (and its parents) in sync.
- // Walk up and find the parents which need to be made in sync too. (For
- // each parent that doesn't already have sync info).
- if (element == null) return;
- if (element instanceof ChangedTeamContainer) {
- CVSRemoteSyncElement syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)element).getMergeResource().getSyncElement();
- // recreate the folder
- ICVSFolder cvsFolder = (ICVSFolder) CVSWorkspaceRoot.getCVSResourceFor(syncElement.getLocal());
- if (! cvsFolder.exists()) {
- recreateLocallyDeletedFolder(element.getParent());
- cvsFolder.mkdir();
- syncElement.makeInSync(Policy.monitorFor(null));
- ((ChangedTeamContainer)element).makeInSync();
- }
- }
- }
-
- /**
- * Adjust the sync kind of the locally deleted folder and remove
- * the folder if it doesn't contain any real changes
- */
- private void removeLocallyDeletedFolder(ChangedTeamContainer container) {
- boolean hasIncoming = hasRealChanges(container, new int[] { ITeamNode.INCOMING });
- boolean hasOutgoing = hasRealChanges(container, new int[] { ITeamNode.OUTGOING });
- boolean hasConflicting = hasRealChanges(container, new int[] { ITeamNode.CONFLICTING });
- IDiffContainer parent = container.getParent();
- if (hasConflicting || (hasOutgoing && hasIncoming)) {
- // Leave as a conflict
- return;
- } else if (hasOutgoing) {
- // Convert to an outgoing deletion
- container.setKind(ITeamNode.OUTGOING | Differencer.DELETION);
- } else if (hasIncoming) {
- container.setKind(ITeamNode.INCOMING | Differencer.ADDITION);
- } else {
- // The folder is empty, remove it
- if (parent != null) {
- parent.removeToRoot(container);
- }
- }
- // The parent may need adjusting as well
- if (parent != null && isLocallyDeletedFolder(parent)) {
- removeLocallyDeletedFolder((ChangedTeamContainer)parent);
- }
- }
-
- /**
- * Look for real changes of the given type. Real changes are those that
- * are not locally deleted folders that are persisted as phantoms
- * to report local file deletions to the server.
- */
- protected boolean hasRealChanges(IDiffElement node, int[] changeDirections) {
- // For regular nodes (i.e. not local folder deletions), check the sync kind of the node
- if ( ! isLocallyDeletedFolder(node)) {
- int direction = node.getKind() & Differencer.DIRECTION_MASK;
- for (int i = 0; i < changeDirections.length; i++) {
- if (direction == changeDirections[i]) {
- return true;
- }
- }
- }
- // For folders, check their children (if we didn't get a match above)
- if (node.getType() == ITypedElement.FOLDER_TYPE) {
- IDiffElement[] children = ((IDiffContainer)node).getChildren();
- for (int i = 0; i < children.length; i++) {
- if (hasRealChanges(children[i], changeDirections)) {
- return true;
- }
- }
- }
- // If no matches occured above, we don't have any "real" changes in the given directions
- return false;
- }
-
- /**
- * Recursively make the parent element (and its parents) in sync.
- * Walk up and find the parents which need to be made in sync too. (For
- * each parent that doesn't already have sync info).
- */
- protected void makeInSync(IDiffElement parentElement) throws TeamException {
- ArrayList v = new ArrayList();
- int parentKind = parentElement.getKind();
- int direction = parentKind & Differencer.DIRECTION_MASK;
- int change = parentKind & Differencer.CHANGE_TYPE_MASK;
- while ((change == Differencer.ADDITION) &&
- ((direction == ITeamNode.INCOMING) || (direction == ITeamNode.CONFLICTING))) {
- v.add(0, parentElement);
- parentElement = parentElement.getParent();
- parentKind = parentElement == null ? 0 : parentElement.getKind();
- direction = parentKind & Differencer.DIRECTION_MASK;
- change = parentKind & Differencer.CHANGE_TYPE_MASK;
- }
- Iterator parentIt = v.iterator();
- while (parentIt.hasNext()) {
- IDiffElement next = (IDiffElement)parentIt.next();
- if (next instanceof ChangedTeamContainer) {
- CVSRemoteSyncElement syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)next).getMergeResource().getSyncElement();
- // Create the sync info
- syncElement.makeInSync(Policy.monitorFor(null));
- ((ChangedTeamContainer)next).setKind(IRemoteSyncElement.IN_SYNC);
- }
- }
- }
-
- /**
- * Sycn actions seem to need to be sync-execed to work
- * @param t
- */
- protected void handle(Throwable t) {
- CVSUIPlugin.openError(getShell(), getErrorTitle(), null, t, CVSUIPlugin.PERFORM_SYNC_EXEC | CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
- }
-
- protected String getErrorTitle() {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java
deleted file mode 100644
index b21efeb22..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-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.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-
-/**
- * UpdateSyncAction is run on a set of sync nodes when the "Update" menu item is performed
- * in the Synchronize view.
- *
- * This class is also used as the super class of the merge update actions for regular and forced
- * update.
- */
-public class UpdateSyncAction extends MergeAction {
- public static class ConfirmDialog extends MessageDialog {
-
- private boolean autoMerge = true;
- private Button radio1;
- private Button radio2;
-
- public ConfirmDialog(Shell parentShell) {
- super(
- parentShell,
- Policy.bind("UpdateSyncAction.Conflicting_changes_found_1"), //$NON-NLS-1$
- null, // accept the default window icon
- Policy.bind("UpdateSyncAction.You_have_local_changes_you_are_about_to_overwrite_2"), //$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0); // yes is the default
- }
-
- protected Control createCustomArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- radio1 = new Button(composite, SWT.RADIO);
- radio1.addSelectionListener(selectionListener);
-
- radio1.setText(Policy.bind("UpdateSyncAction.Only_update_resources_that_can_be_automatically_merged_3")); //$NON-NLS-1$
-
- radio2 = new Button(composite, SWT.RADIO);
- radio2.addSelectionListener(selectionListener);
-
- radio2.setText(Policy.bind("UpdateSyncAction.Update_all_resources,_overwriting_local_changes_with_remote_contents_4")); //$NON-NLS-1$
-
- // set initial state
- radio1.setSelection(autoMerge);
- radio2.setSelection(!autoMerge);
-
- return composite;
- }
-
- private SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Button button = (Button)e.widget;
- if (button.getSelection()) {
- autoMerge = (button == radio1);
- }
- }
- };
-
- public boolean getAutomerge() {
- return autoMerge;
- }
- }
-
- public UpdateSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected SyncSet run(final SyncSet syncSet, IProgressMonitor monitor) {
- boolean result = saveIfNecessary();
- if (!result) return null;
-
- // If there are conflicts or outgoing changes in the syncSet, we need to warn the user.
- boolean onlyUpdateAutomergeable = false;
- if (syncSet.hasConflicts() || syncSet.hasOutgoingChanges()) {
- if (syncSet.hasAutoMergeableConflicts()) {
- switch (promptForMergeableConflicts()) {
- case 0: // cancel
- return null;
- case 1: // only update auto-mergeable conflicts
- onlyUpdateAutomergeable = true;
- syncSet.removeNonMergeableNodes();
- break;
- case 2: // update all conflicts
- onlyUpdateAutomergeable = false;
- break;
- }
- } else {
- if (! promptForConflicts()) return null;
- }
- }
-
- ITeamNode[] changed = syncSet.getChangedNodes();
- if (changed.length == 0) {
- return syncSet;
- }
-
- List updateIgnoreLocalShallow = new ArrayList();
- List updateDeep = new ArrayList();
- List updateShallow = new ArrayList();
-
- // A list of diff elements in the sync set which are incoming folder additions
- Set parentCreationElements = new HashSet();
- // A list of diff elements in the sync set which are folder conflicts
- Set parentConflictElements = new HashSet();
- // A list of diff elements in the sync set which are outgoing folder deletions
- Set parentDeletionElements = new HashSet();
- // A list of the team nodes that we need to perform makeIncoming on
- List makeIncoming = new ArrayList();
- // A list of diff elements that are incoming deletions.
- // We do these first to avoid case conflicts
- List updateDeletions = new ArrayList();
- // A list of diff elements that need to be unmanaged and locally deleted
- List deletions = new ArrayList();
-
- for (int i = 0; i < changed.length; i++) {
- IDiffContainer parent = changed[i].getParent();
- if (parent != null) {
- int parentKind = changed[i].getParent().getKind();
- if (((parentKind & Differencer.CHANGE_TYPE_MASK) == Differencer.ADDITION) &&
- ((parentKind & Differencer.DIRECTION_MASK) == ITeamNode.INCOMING)) {
- parentCreationElements.add(parent);
- } else if (isLocallyDeletedFolder(parent)) {
- parentDeletionElements.add(parent);
- } else if ((parentKind & Differencer.DIRECTION_MASK) == ITeamNode.CONFLICTING) {
- parentConflictElements.add(parent);
- }
- }
- ITeamNode changedNode = changed[i];
- IResource resource = changedNode.getResource();
- int kind = changedNode.getKind();
- switch (kind & Differencer.DIRECTION_MASK) {
- case ITeamNode.INCOMING:
- switch (kind & Differencer.CHANGE_TYPE_MASK) {
- case Differencer.ADDITION:
- updateIgnoreLocalShallow.add(changedNode);
- break;
- case Differencer.DELETION:
- updateDeletions.add(changedNode);
- break;
- case Differencer.CHANGE:
- updateDeep.add(changedNode);
- break;
- }
- break;
- case ITeamNode.OUTGOING:
- switch (kind & Differencer.CHANGE_TYPE_MASK) {
- case Differencer.ADDITION:
- // Unmanage the file if necessary and delete it.
- deletions.add(changedNode);
- break;
- case Differencer.DELETION:
- if (resource.getType() == IResource.FILE) {
- makeIncoming.add(changedNode);
- updateDeep.add(changedNode);
- }
- break;
- case Differencer.CHANGE:
- updateIgnoreLocalShallow.add(changedNode);
- break;
- }
- break;
- case ITeamNode.CONFLICTING:
- switch (kind & Differencer.CHANGE_TYPE_MASK) {
- case Differencer.ADDITION:
- if(changedNode instanceof IDiffContainer) {
- parentConflictElements.add(changedNode);
- } else {
- makeIncoming.add(changedNode);
- deletions.add(changedNode);
- updateIgnoreLocalShallow.add(changedNode);
- }
- break;
- case Differencer.DELETION:
- // Doesn't happen, these nodes don't appear in the tree.
- break;
- case Differencer.CHANGE:
- if (resource.getType() == IResource.FILE) {
- // Depends on the flag.
- if (onlyUpdateAutomergeable && (changedNode.getKind() & IRemoteSyncElement.AUTOMERGE_CONFLICT) != 0) {
- updateShallow.add(changedNode);
- } else {
- // Check to see if there is a remote
- if (((TeamFile)changedNode).getMergeResource().getSyncElement().getRemote() == null) {
- // If a locally modified file has no remote, "update -C" will fail.
- // We must unmanage and delete the file ourselves
- deletions.add(changedNode);
- } else {
- updateIgnoreLocalShallow.add(changedNode);
- // If the resource doesn't exist remotely, we must ensure the sync info will allow the above update.
- if (!resource.exists()) {
- makeIncoming.add(changedNode);
- }
- }
- }
- } else {
- // Conflicting change on a folder only occurs if the folder has been deleted locally
- // The folder should only be recreated if there were children in the changed set.
- // Such folders would have been added to the parentDeletionElements set above
- }
- break;
- }
- break;
- }
- }
- try {
- // Calculate the total amount of work needed
- int work = (makeIncoming.size() + deletions.size() + updateDeletions.size() + updateShallow.size() + updateIgnoreLocalShallow.size() + updateDeep.size()) * 100;
- monitor.beginTask(null, work);
-
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- if (parentDeletionElements.size() > 0) {
- // If a node has a parent that is an outgoing folder deletion, we have to
- // recreate that folder locally (it's sync info already exists locally).
- // We must do this for all outgoing folder deletions (recursively)
- // in the case where there are multiple levels of outgoing folder deletions.
- Iterator it = parentDeletionElements.iterator();
- while (it.hasNext()) {
- recreateLocallyDeletedFolder((IDiffElement)it.next());
- }
- }
- if (parentCreationElements.size() > 0) {
- // If a node has a parent that is an incoming folder creation, we have to
- // create that folder locally and set its sync info before we can get the
- // node itself. We must do this for all incoming folder creations (recursively)
- // in the case where there are multiple levels of incoming folder creations.
- Iterator it = parentCreationElements.iterator();
- while (it.hasNext()) {
- IDiffElement element = (IDiffElement)it.next();
- makeInSync(element);
- // Remove the folder from the update shallow list since we have it locally now
- updateIgnoreLocalShallow.remove(element);
- }
- }
- if (parentConflictElements.size() > 0) {
- // If a node has a parent that is a folder conflict, that means that the folder
- // exists locally but has no sync info. In order to get the node, we have to
- // create the sync info for the folder (and any applicable parents) before we
- // get the node itself.
- Iterator it = parentConflictElements.iterator();
- while (it.hasNext()) {
- makeInSync((IDiffElement)it.next());
- }
- }
- // Make any outgoing changes or deletions into incoming changes before updating.
- Iterator it = makeIncoming.iterator();
- while (it.hasNext()) {
- ITeamNode node = (ITeamNode)it.next();
- CVSRemoteSyncElement element = CVSSyncCompareInput.getSyncElementFrom(node);
- element.makeIncoming(Policy.subMonitorFor(monitor, 100));
- }
-
- // Outgoing additions or conflicts with incoming deletions must be unmanaged and locally deleted.
- if (deletions.size() > 0) {
- runLocalDeletions((ITeamNode[])deletions.toArray(new ITeamNode[deletions.size()]), manager, Policy.subMonitorFor(monitor, deletions.size() * 100));
- }
-
- if (updateDeletions.size() > 0) {
- runUpdateDeletions((ITeamNode[])updateDeletions.toArray(new ITeamNode[updateDeletions.size()]), manager, Policy.subMonitorFor(monitor, updateDeletions.size() * 100));
- }
- if (updateShallow.size() > 0) {
- runUpdateShallow((ITeamNode[])updateShallow.toArray(new ITeamNode[updateShallow.size()]), manager, Policy.subMonitorFor(monitor, updateShallow.size() * 100));
- }
- if (updateIgnoreLocalShallow.size() > 0) {
- runUpdateIgnoreLocalShallow((ITeamNode[])updateIgnoreLocalShallow.toArray(new ITeamNode[updateIgnoreLocalShallow.size()]), manager, Policy.subMonitorFor(monitor, updateIgnoreLocalShallow.size() * 100));
- }
- if (updateDeep.size() > 0) {
- runUpdateDeep((ITeamNode[])updateDeep.toArray(new ITeamNode[updateDeep.size()]), manager, Policy.subMonitorFor(monitor, updateDeep.size() * 100));
- }
- } catch (final TeamException e) {
- handle(e);
- return null;
- } catch (final CoreException e) {
- handle(e);
- return null;
- } finally {
- monitor.done();
- }
- return syncSet;
- }
-
- /**
- * Method deleteAndKeepHistory.
- * @param iResource
- * @param iProgressMonitor
- */
- protected void deleteAndKeepHistory(IResource resource, IProgressMonitor monitor) throws CoreException {
- if (resource.getType() == IResource.FILE)
- ((IFile)resource).delete(false /* force */, true /* keep history */, monitor);
- else
- resource.delete(false /* force */, monitor);
- }
-
- protected void runLocalDeletions(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException, CoreException {
- monitor.beginTask(null, nodes.length * 100);
- for (int i = 0; i < nodes.length; i++) {
- ITeamNode node = nodes[i];
- CVSRemoteSyncElement element = CVSSyncCompareInput.getSyncElementFrom(node);
- element.makeIncoming(Policy.subMonitorFor(monitor, 50));
- deleteAndKeepHistory(element.getLocal(), Policy.subMonitorFor(monitor, 50));
- }
- monitor.done();
- }
-
- protected void runUpdateDeletions(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- manager.update(getIResourcesFrom(nodes), new Command.LocalOption[] { Command.DO_NOT_RECURSE }, false, monitor);
- }
-
- protected void runUpdateDeep(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- manager.update(getIResourcesFrom(nodes), Command.NO_LOCAL_OPTIONS, false, monitor);
- }
-
- protected void runUpdateIgnoreLocalShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- manager.update(getIResourcesFrom(nodes), new Command.LocalOption[] { Update.IGNORE_LOCAL_CHANGES, Command.DO_NOT_RECURSE }, false, monitor);
- }
-
- protected void runUpdateShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- manager.update(getIResourcesFrom(nodes), new Command.LocalOption[] { Command.DO_NOT_RECURSE }, false, monitor);
- }
-
- protected IResource[] getIResourcesFrom(ITeamNode[] nodes) {
- List resources = new ArrayList(nodes.length);
- for (int i = 0; i < nodes.length; i++) {
- resources.add(nodes[i].getResource());
- }
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
- }
-
- protected boolean isEnabled(ITeamNode node) {
- // The update action is enabled only for non-conflicting incoming changes
- return new SyncSet(new StructuredSelection(node)).hasIncomingChanges();
- }
-
- /**
- * Prompt for mergeable conflicts.
- * Note: This method is designed to be overridden by test cases.
- * @return 0 to cancel, 1 to only update mergeable conflicts, 2 to overwrite if unmergeable
- */
- protected int promptForMergeableConflicts() {
- final boolean doAutomerge[] = new boolean[] {false};
- final int[] result = new int[] {Dialog.CANCEL};
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- ConfirmDialog dialog = new ConfirmDialog(shell);
- result[0] = dialog.open();
- doAutomerge[0] = dialog.getAutomerge();
- }
- });
- if (result[0] == Dialog.CANCEL) return 0;
- return doAutomerge[0] ? 1 : 2;
- }
-
- /**
- * Prompt for non-automergeable conflicts.
- * Note: This method is designed to be overridden by test cases.
- * @return false to cancel, true to overwrite local changes
- */
- protected boolean promptForConflicts() {
- final boolean[] result = new boolean[] { false };
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = MessageDialog.openQuestion(shell, Policy.bind("UpdateSyncAction.Overwrite_local_changes__5"), Policy.bind("UpdateSyncAction.You_have_local_changes_you_are_about_to_overwrite._Do_you_wish_to_continue__6")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
- return result[0];
- }
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeConflictingNodes();
- set.removeOutgoingNodes();
- }
- /**
- * @see MergeAction#getHelpContextID()
- */
- protected String getHelpContextID() {
- return IHelpContextIds.SYNC_UPDATE_ACTION;
- }
-
- protected String getErrorTitle() {
- return Policy.bind("UpdateAction.update"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java
deleted file mode 100644
index c07f3f45c..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-public class NatureToPropertyAction extends TeamAction {
-
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return true;
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- final Shell shell = getShell();
- IProject[] projects = getSelectedProjects();
- List statii = new ArrayList();
- for (int i = 0; i < projects.length; i++) {
- IFile file = projects[i].getFile(".project"); //$NON-NLS-1$
- IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] {file}, shell);
- if (status.getCode() == IStatus.OK) {
- RepositoryProvider.convertNatureToProperty(projects[i], true);
- } else {
- statii.add(status);
- RepositoryProvider.convertNatureToProperty(projects[i], false);
- }
- }
- if (!statii.isEmpty()) {
- final IStatus[] statusArray = (IStatus[])statii.toArray(new IStatus[statii.size()]);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- if (statusArray.length == 1) {
- ErrorDialog.openError(shell, Policy.bind("NatureToPropertyAction.label"), Policy.bind("NatureToPropertyAction.message"), statusArray[0]); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- ErrorDialog.openError(shell, Policy.bind("NatureToPropertyAction.label"), Policy.bind("NatureToPropertyAction.message"), new MultiStatus(TeamUIPlugin.ID, 0, statusArray, Policy.bind("NatureToPropertyAction.multiMessage"), null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- });
- for (int i = 0; i < statusArray.length; i++) {
- TeamUIPlugin.log(statusArray[i]);
- }
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("NatureToPropertyAction.label"), PROGRESS_DIALOG); //$NON-NLS-1$
- }
-}
-
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index f82ba3f0f..60c703d64 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -11,9 +11,8 @@
package org.eclipse.team.internal.ui;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
+import java.util.*;
import java.util.List;
-import java.util.ResourceBundle;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.resources.IResource;
@@ -25,8 +24,8 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.ISubscriberResource;
import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.ui.TeamImages;
import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
import org.eclipse.ui.*;
@@ -267,8 +266,8 @@ public class Utils {
}
public static void updateLabels(SyncInfo sync, CompareConfiguration config) {
- final IRemoteResource remote = sync.getRemote();
- final IRemoteResource base = sync.getBase();
+ final ISubscriberResource remote = sync.getRemote();
+ final ISubscriberResource base = sync.getBase();
String localContentId = sync.getLocalContentIdentifier();
if (localContentId != null) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/JobBusyCursor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/JobBusyCursor.java
index 9d5574619..c9cf795f4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/JobBusyCursor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/JobBusyCursor.java
@@ -14,8 +14,8 @@ import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.internal.core.*;
+import org.eclipse.team.core.subscribers.IJobListener;
+import org.eclipse.team.core.subscribers.JobStatusHandler;
/**
* This class will show a busy cursor over a control when jobs of a particular type
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java
index 7dbaa4b86..7bcd5b431 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java
@@ -2,6 +2,7 @@ package org.eclipse.team.internal.ui.jobs;
import java.util.*;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.team.core.subscribers.*;
class RefreshChangeListener implements ITeamResourceChangeListener {
@@ -20,7 +21,7 @@ class RefreshChangeListener implements ITeamResourceChangeListener {
}
}
public SyncInfo[] getChanges() {
- collector.waitForCollector();
+ collector.waitForCollector(new NullProgressMonitor());
List changedSyncInfos = new ArrayList();
SyncInfoSet set = collector.getSyncInfoSet();
for (Iterator it = changes.iterator(); it.hasNext();) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
index d00fea0f5..2b571d07d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
@@ -17,11 +17,13 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.forms.parts.*;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipantPage;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.part.PageBook;
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
index fdfc69e17..f3c3c8585 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
@@ -10,20 +10,14 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.synchronize.actions;
-import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.compare.CompareUI;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.ui.*;
+import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.synchronize.compare.SyncInfoCompareInput;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
@@ -69,7 +63,6 @@ public class OpenInCompareAction extends Action {
wpage.activate(editor);
} else {
// if editor is currently not open on that input either re-use existing
- if (!prefetchFileContents(info)) return null;
if(editor != null && editor instanceof IReusableEditor) {
CompareUI.reuseCompareEditor(input, (IReusableEditor)editor);
wpage.activate(editor);
@@ -86,40 +79,6 @@ public class OpenInCompareAction extends Action {
}
return null;
}
-
- /**
- * Prefetching the file contents will cache them for use by the compare editor
- * so that the compare editor doesn't have to perform file transfers. This will
- * make the transfer cancellable.
- */
- private static boolean prefetchFileContents(SyncInfo info) {
- final IRemoteResource remote = info.getRemote();
- final IRemoteResource base = info.getBase();
- if (remote != null || base != null) {
- final boolean[] ok = new boolean[] { true };
- TeamUIPlugin.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(null, (remote == null ? 0 : 100) + (base == null ? 0 : 100));
- if (remote != null)
- remote.getContents(Policy.subMonitorFor(monitor, 100));
- if (base != null)
- base.getContents(Policy.subMonitorFor(monitor, 100));
- } catch (TeamException e) {
- ok[0] = false;
- // The sync viewer will show the error to the user so we need only abort the action
- throw new InvocationTargetException(e);
- } finally {
- // return false if the operation was cancelled
- ok[0] = ! monitor.isCanceled();
- monitor.done();
- }
- }
- });
- return ok[0];
- }
- return true;
- }
/**
* Returns a SyncInfoCompareInput instance for the current selection.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
index 5d1104b79..6417819f7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
@@ -15,12 +15,10 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.core.subscribers.*;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.actions.ActionGroup;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java
index 1b0a00410..64872f0b7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java
@@ -12,30 +12,27 @@ package org.eclipse.team.internal.ui.synchronize.compare;
import java.io.InputStream;
-import org.eclipse.compare.BufferedContent;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.IEditableContent;
-import org.eclipse.compare.ITypedElement;
+import org.eclipse.compare.*;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
+import org.eclipse.team.core.subscribers.ISubscriberResource;
/**
* RemoteResourceTypedElement
*/
public class RemoteResourceTypedElement extends BufferedContent implements ITypedElement, IEditableContent {
- private IRemoteResource remote;
+ private ISubscriberResource remote;
private IStorage bufferedContents;
/**
* Creates a new content buffer for the given team node.
*/
- public RemoteResourceTypedElement(IRemoteResource remote) {
+ public RemoteResourceTypedElement(ISubscriberResource remote) {
this.remote = remote;
}
@@ -102,7 +99,7 @@ public class RemoteResourceTypedElement extends BufferedContent implements IType
return null;
}
- public IRemoteResource getRemote() {
+ public ISubscriberResource getRemote() {
return remote;
}
@@ -111,6 +108,6 @@ public class RemoteResourceTypedElement extends BufferedContent implements IType
* @param monitor
*/
public void cacheContents(IProgressMonitor monitor) throws TeamException {
- bufferedContents = remote.getBufferedStorage(monitor);
+ bufferedContents = remote.getStorage(monitor);
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoDiffNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoDiffNode.java
new file mode 100644
index 000000000..9095b457a
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoDiffNode.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.synchronize.compare;
+
+import org.eclipse.compare.ITypedElement;
+import org.eclipse.compare.structuremergeviewer.DiffNode;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.ISubscriberResource;
+import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.internal.ui.Policy;
+
+public class SyncInfoDiffNode extends DiffNode {
+
+ /**
+ * Create an ITypedElement for the given local resource. The returned ITypedElement
+ * will prevent edited of outgoing deletions.
+ */
+ public static ITypedElement createTypeElement(IResource resource, final int kind) {
+ if(resource != null && resource.exists()) {
+ return new LocalResourceTypedElement(resource) {
+ public boolean isEditable() {
+ if(SyncInfo.getDirection(kind) == SyncInfo.OUTGOING && SyncInfo.getChange(kind) == SyncInfo.DELETION) {
+ return false;
+ }
+ return super.isEditable();
+ }
+ };
+ }
+ return null;
+ }
+
+ /**
+ * Create an ITypedElement for the given remote resource. The contents for the remote resource
+ * will be retrieved from the given IStorage which is a local cache used to buffer the remote contents
+ */
+ public static ITypedElement createTypeElement(ISubscriberResource remoteResource) {
+ return new RemoteResourceTypedElement(remoteResource);
+ }
+
+ /**
+ * Creates a new diff node.
+ */
+ public SyncInfoDiffNode(ITypedElement base, ITypedElement local, ITypedElement remote, int syncKind) {
+ super(syncKind, base, local, remote);
+ }
+
+ /**
+ * Cache the contents for the base and remote.
+ * @param monitor
+ */
+ public void cacheContents(IProgressMonitor monitor) throws TeamException {
+ ITypedElement base = getAncestor();
+ ITypedElement remote = getRight();
+ int work = Math.min((remote== null ? 0 : 50) + (base == null ? 0 : 50), 10);
+ monitor.beginTask(null, work);
+ try {
+ if (base != null && base instanceof RemoteResourceTypedElement) {
+ ((RemoteResourceTypedElement)base).cacheContents(Policy.subMonitorFor(monitor, 50));
+ }
+ if (remote != null && remote instanceof RemoteResourceTypedElement) {
+ ((RemoteResourceTypedElement)remote).cacheContents(Policy.subMonitorFor(monitor, 50));
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNode.java
index 969ddcc7c..8300aaa21 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNode.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNode.java
@@ -17,8 +17,6 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.synchronize.compare.LocalResourceTypedElement;
import org.eclipse.team.internal.ui.synchronize.compare.RemoteResourceTypedElement;
@@ -51,7 +49,7 @@ public class SyncInfoDiffNode extends DiffNode implements IAdaptable {
* Create an ITypedElement for the given remote resource. The contents for the remote resource
* will be retrieved from the given IStorage which is a local cache used to buffer the remote contents
*/
- public static ITypedElement createTypeElement(IRemoteResource remoteResource) {
+ public static ITypedElement createTypeElement(ISubscriberResource remoteResource) {
return new RemoteResourceTypedElement(remoteResource);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java
index bff0d9b3e..d001a1351 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java
@@ -21,13 +21,11 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.synchronize.views.CompressedFolder;
import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.synchronize.actions.SubscriberAction;
import org.eclipse.ui.internal.WorkbenchColors;
import org.eclipse.ui.model.WorkbenchLabelProvider;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java
index c6e66510b..b0e56cb6c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SubscriberAction.java
@@ -12,18 +12,14 @@ package org.eclipse.team.ui.synchronize.actions;
import java.util.*;
-import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.core.subscribers.SyncInfoFilter;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
import org.eclipse.ui.*;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
/**
* This is an abstract superclass for actions associated with a
diff --git a/examples/org.eclipse.team.examples.filesystem/plugin.xml b/examples/org.eclipse.team.examples.filesystem/plugin.xml
index ce1bb0e2d..bda3da5f8 100644
--- a/examples/org.eclipse.team.examples.filesystem/plugin.xml
+++ b/examples/org.eclipse.team.examples.filesystem/plugin.xml
@@ -35,6 +35,62 @@
id="org.eclipse.team.examples.filesystem.FileSystemProvider">
</repository>
</extension>
+
+<!-- *************** Deployment Provider **************** -->
+ <extension
+ point="org.eclipse.team.core.deployment">
+ <deployment
+ class="org.eclipse.team.examples.filesystem.deployment.FileSystemDeploymentProvider"
+ id="org.eclipse.team.examples.filesystem.FileSystemDeploymentProvider"
+ name="%nonVersioningProvider">
+ </deployment>
+ </extension>
+
+<!-- *************** Deployment ObjectContributions **************** -->
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ objectClass="org.eclipse.core.resources.IContainer"
+ adaptable="true"
+ id="org.eclipse.team.examples.filesystem.ResourceContributions">
+ <menu
+ label="Deployment Example"
+ path="additions"
+ id="example.deployment">
+ <separator name="group1"/>
+ <separator name="group2"/>
+ </menu>
+ <action
+ label="Connect..."
+ tooltip="Deployment Actions"
+ menubarPath="example.deployment/group2"
+ class="org.eclipse.team.examples.filesystem.deployment.DeployAction"
+ id="org.eclipse.team.examples.filesystem.deploy">
+ </action>
+ <action
+ label="Disconnect..."
+ tooltip="Deployment Actions"
+ menubarPath="example.deployment/group2"
+ class="org.eclipse.team.examples.filesystem.deployment.UnDeployAction"
+ id="org.eclipse.team.examples.filesystem.undeploy">
+ </action>
+ <action
+ label="Upload"
+ tooltip="Deployment Actions"
+ menubarPath="example.deployment/group1"
+ class="org.eclipse.team.examples.filesystem.deployment.NullAction"
+ id="org.eclipse.team.examples.filesystem.undeploy">
+ </action>
+ <action
+ label="Download"
+ tooltip="Deployment Actions"
+ menubarPath="example.deployment/group1"
+ class="org.eclipse.team.examples.filesystem.deployment.NullAction"
+ id="org.eclipse.team.examples.filesystem.undeploy">
+ </action>
+ </objectContribution>
+ </extension>
+
<!-- *************** POPUP MENUS **************** -->
<extension
point="org.eclipse.ui.popupMenus">
@@ -82,7 +138,7 @@
class="org.eclipse.team.examples.filesystem.ui.DisconnectAction"
menubarPath="team.main/group2"
id="org.eclipse.team.examples.filesystem.unmanage">
- </action>
+ </action>
</objectContribution>
</extension>
<!-- *************** CONFIGURATION WIZARD **************** -->
@@ -114,5 +170,4 @@
</filter>
</page>
</extension>
-
</plugin>
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java
index 6020049bd..909e30733 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileModificationValidator.java
@@ -20,7 +20,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations;
/**
* This class models a sentry that verifies whether resources are available for editing or overwriting.
@@ -32,15 +31,13 @@ public final class FileModificationValidator implements IFileModificationValidat
//Used to avoid creating multiple copies of the OK status:
private static final IStatus OK_STATUS = new Status(Status.OK, FileSystemPlugin.ID, Status.OK, Policy.bind("ok"), null); //$NON-NLS-1$
- private RepositoryProvider provider;
private SimpleAccessOperations operations;
/**
* Constructor for FileModificationValidator.
*/
public FileModificationValidator(RepositoryProvider provider) {
- this.provider = provider;
- operations = provider.getSimpleAccess();
+ operations = ((FileSystemProvider)provider).getSimpleAccess();
}
/**
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java
index 2fae985be..60f64c48b 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemProvider.java
@@ -19,7 +19,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations;
/**
* This example illustrates how to create a concrete implementation of a <code>RepositoryProvider</code>
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java
index 87852220a..9fb3afa17 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemSimpleAccessOperations.java
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.core.simpleAccess.SimpleAccessOperations;
import org.eclipse.team.examples.filesystem.Policy;
/**
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/SimpleAccessOperations.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/SimpleAccessOperations.java
new file mode 100644
index 000000000..ce5f0c0d4
--- /dev/null
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/SimpleAccessOperations.java
@@ -0,0 +1,267 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.examples.filesystem;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.core.TeamException;
+
+/*
+ * This class represents provisional API. Its here to allow experimentation with 3rd party tools
+ * calling providers in a repository neutral manner.
+ *
+ * A provider is not required to implement this API.
+ * Implementers, and those who reference it, do so with the awareness that this class may be
+ * removed or substantially changed at future times without warning.
+ *
+ * The <code>SimpleAccessOperations</code> class exposes a basic repository model that
+ * providers may implement to allow third-party plugins to perform repository operations
+ * programmatically. For example, a code generation tool may want to get source
+ * files before generating the code, and check-in the results. If a provider plugin does
+ * not adhere to the <i>semantics</i> of the <code>SimpleAccessOperations</code> class
+ * as described, they are free to opt out of implementing it.
+ *
+ * @since 2.0
+ */
+public interface SimpleAccessOperations {
+ /*
+ * Updates the local resource to have the same content as the corresponding remote
+ * resource. Where the local resource does not exist, this method will create it.
+ * <p>
+ * If the remote resource is a container (e.g. folder or project) this operation is equivalent
+ * to getting each non-container member of the remote resource, thereby updating the
+ * content of existing local members, creating local members to receive new remote resources,
+ * and deleting local members that no longer have a corresponding remote resource.</p>
+ * <p>
+ * The method is applied to all resources satisfying the depth parameter, described above.</p>
+ * <p>
+ * Interrupting the method (via the progress monitor) may lead to partial, but consistent, results.</p>
+ *
+ * @param resources an array of local resources to update from the corresponding remote
+ * resources.
+ * @param depth the depth to traverse the given resources, taken from <code>IResource</code>
+ * static constants.
+ * @param progress a progress monitor to indicate the duration of the operation, or
+ * <code>null</code> if progress reporting is not required.
+ * @throws TeamException if there is a problem getting one or more of the resources. The
+ * exception will contain multiple statuses, one for each resource in the <code>resources</code>
+ * array. Possible status codes include:
+ * <ul>
+ * <li>NO_REMOTE_RESOURCE</li>
+ * <li>IO_FAILED</li>
+ * <li>NOT_AUTHORIZED</li>
+ * <li>UNABLE</li>
+ * </ul>
+ */
+ public void get(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
+
+ /*
+ * Changes the state of the local resource from checked-in to checked-out and transfers the content
+ * of the remote resource to the local resource.
+ * <p>
+ * Where no corresponding local resource exists in the workspace, one is created (including any
+ * intermediate parent containers) to receive the contents of the remote resource.</p>
+ * <p>
+ * Implementations may optimistically only flag the state change locally and rely on resolving conflicts
+ * during check-in, or they may pessimistically also checkout or lock the remote resource during a
+ * local resource checkout to avoid conflicts. The provider API does not subscribe to either model
+ * and supports each equally.</p>
+ * <p>
+ * Where checkout is applied to a resource that is already checked-out the method has no
+ * effect.</p>
+ *
+ * @param resources the array of local resources to be checked-out.
+ * @param depth the depth to traverse the given resources, taken from <code>IResource</code>
+ * constants.
+ * @param progress a progress monitor to indicate the duration of the operation, or
+ * <code>null</code> if progress reporting is not required.
+ * @throws TeamProviderException if there is a problem checking-out one or more of the resources.
+ * The exception will contain multiple statuses, one for each resource in the <code>resources</code>
+ * array. Possible status codes include:
+ * <ul>
+ * <li>NOT_CHECKED_IN</li>
+ * <li>NO_REMOTE_RESOURCE</li>
+ * <li>IO_FAILED</li>
+ * <li>NOT_AUTHORIZED</li>
+ * <li>UNABLE</li>
+ * </ul>
+ * @see checkin(IResource[], int, IProgressMonitor)
+ */
+ public void checkout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
+
+ /*
+ * Transfers the content of the local resource to the corresponding remote resource, and changes the
+ * state of the local resource from checked-out to checked-in.
+ * <p>
+ * If a remote resource does not exist this method creates a new remote resource with the same content
+ * as the given local resource. The local resource is said to <i>correspond</i> to the new remote resource.</p>
+ * <p>
+ * Where providers deal with stores that check-out or lock resources this method is an opportunity
+ * to transfer the content and make the corresponding remote check-in or unlock. It is envisaged that
+ * where the server maintains resource versions, checkin creates a new version of the remote resource.</p>
+ * <p>
+ * Note that some providers may <em>require</em> that a resource is checked-out before it can be
+ * checked-in. However, all providers must support the explicit checking out a resource before checking
+ * it in (e.g., even if the check out is a no-op).</p>
+ *
+ * @param resources an array of local resources to be checked-in.
+ * @param the depth to traverse the given resources, taken from <code>IResource</code>
+ * constants.
+ * @param progress a progress monitor to indicate the duration of the operation, or
+ * <code>null</code> if progress reporting is not required.
+ * @throws TeamException if there is a problem checking-in one or more of the resources.
+ * The exception will contain multiple statuses, one for each resource in the <code>resources</code>
+ * array. Possible status codes include:
+ * <ul>
+ * <li>NOT_CHECKED_OUT</li>
+ * <li>IO_FAILED</li>
+ * <li>NOT_AUTHORIZED</li>
+ * <li>UNABLE</li>
+ * </ul>
+ * @see checkout(IResource[], int, IProgressMonitor)
+ */
+ public void checkin(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
+
+ /*
+ * Changes the state of the local resource from checked-out to checked-in without updating the contents
+ * of the remote resource.
+ * <p>
+ * Note that where the provider is a versioning provider, it is envisaged (though not required) that the
+ * uncheckout operation does not create a new version.</p>
+ * <p>
+ * Note also that <code>uncheckout()</code> does not affect the content of the local resource. The
+ * caller is required to perform a <code>get()</code> to revert the local resource if that is required
+ * (otherwise the local resource will be left with the changes that were made while the remote resource
+ * was checked-out. Furthermore, it is valid to call <code>uncheckout()</code> with an
+ * <code>IResource</code> that does not exist locally.</p>
+ *
+ * @param resources an array of the local resources that are to be unchecked-out.
+ * @param depth the depth to traverse the given resources, taken from <code>IResource</code>
+ * constants.
+ * @param progress a progress monitor to indicate the duration of the operation, or
+ * <code>null</code> if progress reporting is not required.
+ * @throws TeamProviderException if there is a problem undoing the check-out of one or more of
+ * the resources. The exception will contain multiple statuses, one for each resource in the
+ * <code>resources</code> array. Possible status codes include:
+ * <ul>
+ * <li>NOT_CHECKED_OUT</li>
+ * <li>IO_FAILED</li>
+ * <li>NOT_AUTHORIZED</li>
+ * <li>UNABLE</li>
+ * </ul>
+ * @see checkin(IResource)
+ * @see uncheckout(IResource)
+ */
+ public void uncheckout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
+
+ /*
+ * Deletes the remote resource corresponding to the given local resource.
+ * <p>
+ * The notion of delete is simply to make the remote resource unavailable. Where the provider
+ * supports versioning it is not specified whether the delete operation makes the version
+ * temporarily or forever unavailable, or indeed whether the entire history is made unavailable.</p>
+ * <p>
+ * Note that the <code>IResource</code>'s passed as arguments may be non-existant in the
+ * workbench, the typical case is when such a resource has been received in a core callback.</p>
+ * <p>
+ * The resource may be checked-in or checked-out prior to deletion. The local resource is not
+ * deleted by this method.</p>
+ * <p>
+ * Resource deletions are inherently deep.</p>
+ *
+ * @param resources the array of resources whose corresponding remote resources are to be deleted.
+ * @param progress a progress monitor to indicate the duration of the operation, or
+ * <code>null</code> if progress reporting is not required.
+ * @throws TeamProviderException if there is a problem deleting one or more of
+ * the resources. The exception will contain multiple statuses, one for each resource in the
+ * <code>resources</code> array. Possible status codes include:
+ * <ul>
+ * <li>NO_REMOTE_RESOURCE</li>
+ * <li>IO_FAILED</li>
+ * <li>NOT_AUTHORIZED</li>
+ * <li>UNABLE</li>
+ * </ul>
+ */
+ public void delete(IResource[] resources, IProgressMonitor progress) throws TeamException;
+
+ /*
+ * Informs the provider that a local resource's name or path has changed.
+ * <p>
+ * Some providers, such as versioning providers, may require this information to track the resource
+ * across name changes.</p>
+ * <p>
+ * Note that this method is always called <em>after</em> the local resource has been moved.</p>
+ *
+ * @param source the full name of the resource before it was moved.
+ * @param target the resource that was moved.
+ * @param progress a progress monitor to indicate the duration of the operation, or
+ * <code>null</code> if progress reporting is not required.
+ * @throws TeamProviderException if there is a problem recording the move. The exception will
+ * contain a single status. Possible status codes are:
+ * <ul>
+ * <li>NO_REMOTE_RESOURCE</li>
+ * <li>IO_FAILED</li>
+ * <li>NOT_AUTHORIZED</li>
+ * <li>UNABLE</li>
+ * </ul>
+ */
+ public void moved(IPath source, IResource target, IProgressMonitor progress) throws TeamException;
+
+ /*
+ * Implementor's Note:
+ * The following methods are required to return promptly (i.e., they may be used to determine the state of
+ * a resource in a UI where long delays are unacceptable). Implementations may cache these values
+ * and update the cache on an explicit call to #refreshState().
+ *
+ * They are currently listed in the provider API, however, they may be moved to a new or different
+ * interface in the future to better reflect their UI-orientation.
+ */
+
+ /*
+ * Answers if the remote resource state is checked-out. If the resource has never been checked in this
+ * method will return <code>true</code>.
+ * <p>
+ * It is undefined whether this method tests for a resource being checked out to this workspace
+ * or any workspace.</p>
+ *
+ * @param resource the local resource to test.
+ * @return <code>true</code> if the resource is checked-out and <code>false</code> if it is not.
+ * @see checkout(IResource[], int, IProgressMonitor)
+ */
+ public boolean isCheckedOut(IResource resource);
+
+ /*
+ * Answers whether the resource has a corresponding remote resource.
+ * <p>
+ * Before a resource is checked-in, the resource will occur locally but not remotely, and calls to this
+ * method will return <code>false</code>. Once a local resource is checked in (and assuming the local
+ * local resource is not moved or the remote resource deleted) there will be a corresponding remote
+ * resource and this method returns <code>true</code>.</p>
+ *
+ * @param resource the local resource to test.
+ * @return <code>true</code> if the local resource has a corresponding remote resource,
+ * and <code>false</code> otherwise.
+ * @see checkin(IResource[], int, IProgressMonitor)
+ * @see refreshState(IResource[], int, IProgressMonitor)
+ */
+ public boolean hasRemote(IResource resource);
+
+ /*
+ * Answer if the local resource currently has a different timestamp to the base timestamp
+ * for this resource.
+ *
+ * @param resource the resource to test.
+ * @return <code>true</code> if the resource has a different modification
+ * timestamp, and <code>false</code> otherwise.
+ */
+ public boolean isDirty(IResource resource);
+}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/DeployAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/DeployAction.java
new file mode 100644
index 000000000..7fc9c2790
--- /dev/null
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/DeployAction.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.examples.filesystem.deployment;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.team.core.*;
+import org.eclipse.team.internal.ui.actions.TeamAction;
+import org.eclipse.ui.IActionDelegate;
+
+public class DeployAction extends TeamAction implements IActionDelegate {
+
+ public void run(IAction action) {
+ IContainer container = (IContainer)getSelectedResources()[0];
+ IDeploymentProviderManager manager = Team.getDeploymentManager();
+ FileSystemDeploymentProvider provider = new FileSystemDeploymentProvider();
+ try {
+ manager.map(container, provider);
+ } catch (TeamException e) {
+ ErrorDialog.openError(getShell(), "Error", "Mapping", e.getStatus());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
+ */
+ protected boolean isEnabled() throws TeamException {
+ IResource[] resources = getSelectedResources();
+ if(resources.length == 1) {
+ IResource resource = resources[0];
+ IDeploymentProviderManager manager = Team.getDeploymentManager();
+ if(manager.getMappedTo(resource, FileSystemDeploymentProvider.ID)) {
+ return false;
+ }
+ }
+ return true;
+ }
+} \ No newline at end of file
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/FileSystemDeploymentProvider.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/FileSystemDeploymentProvider.java
new file mode 100644
index 000000000..a983aced5
--- /dev/null
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/FileSystemDeploymentProvider.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.examples.filesystem.deployment;
+
+import org.eclipse.team.core.DeploymentProvider;
+import org.eclipse.team.core.IMemento;
+
+public class FileSystemDeploymentProvider extends DeploymentProvider {
+
+ public final static String ID = "org.eclipse.team.examples.filesystem.FileSystemDeploymentProvider";
+
+ public String getID() {
+ return ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.DeploymentProvider#init()
+ */
+ public void init() {
+ // TODO Auto-generated method stub
+ System.out.println("Initialized " + getName());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.DeploymentProvider#dispose()
+ */
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.DeploymentProvider#saveState(org.eclipse.team.core.IMemento)
+ */
+ public void saveState(IMemento memento) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.DeploymentProvider#restoreState(org.eclipse.team.core.IMemento)
+ */
+ public void restoreState(IMemento memento) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/NullAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/NullAction.java
new file mode 100644
index 000000000..9216d190a
--- /dev/null
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/NullAction.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.examples.filesystem.deployment;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.team.core.IDeploymentProviderManager;
+import org.eclipse.team.core.Team;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ui.actions.TeamAction;
+import org.eclipse.ui.IActionDelegate;
+
+public class NullAction extends TeamAction implements IActionDelegate {
+
+ public void run(IAction action) {
+ MessageDialog.openQuestion(getShell(), "Action Run", "Action Run");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
+ */
+ protected boolean isEnabled() throws TeamException {
+ IResource[] resources = getSelectedResources();
+ if(resources.length == 1) {
+ IResource resource = resources[0];
+ IDeploymentProviderManager manager = Team.getDeploymentManager();
+ if(! manager.getMappedTo(resource, FileSystemDeploymentProvider.ID)) {
+ return false;
+ }
+ }
+ return true;
+ }
+} \ No newline at end of file
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/UnDeployAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/UnDeployAction.java
new file mode 100644
index 000000000..5466a25fc
--- /dev/null
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/deployment/UnDeployAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.examples.filesystem.deployment;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.team.core.DeploymentProvider;
+import org.eclipse.team.core.IDeploymentProviderManager;
+import org.eclipse.team.core.Team;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ui.actions.TeamAction;
+import org.eclipse.ui.IActionDelegate;
+
+public class UnDeployAction extends TeamAction implements IActionDelegate {
+
+ public void run(IAction action) {
+ IContainer container = (IContainer)getSelectedResources()[0];
+ IDeploymentProviderManager manager = Team.getDeploymentManager();
+ try {
+ DeploymentProvider[] providers = manager.getMappings(container, FileSystemDeploymentProvider.ID);
+ for (int i = 0; i < providers.length; i++) {
+ DeploymentProvider provider = providers[i];
+ manager.unmap(container, provider);
+ }
+ } catch (TeamException e) {
+ ErrorDialog.openError(getShell(), "Error", "Un-Mapping", e.getStatus());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
+ */
+ protected boolean isEnabled() throws TeamException {
+ IResource[] resources = getSelectedResources();
+ if(resources.length == 1) {
+ IResource resource = resources[0];
+ IDeploymentProviderManager manager = Team.getDeploymentManager();
+ if(! manager.getMappedTo(resource, FileSystemDeploymentProvider.ID)) {
+ return false;
+ }
+ }
+ return true;
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00007.html b/tests/org.eclipse.team.tests.cvs.core/html/00007.html
index 68904853b..ecdc16172 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00007.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00007.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><body><h2>Check Out - prompts</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
<ul>
<li>Select a project in HEAD</li>
<li>Perform a Checkout</li>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00009.html b/tests/org.eclipse.team.tests.cvs.core/html/00009.html
index 1b69e3947..083a763a2 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00009.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00009.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><body><h2>Remote resources</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
<h4>Compare With... in Repositories view </h4>
<p>Perform the following steps:</p>
<ol>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00011.html b/tests/org.eclipse.team.tests.cvs.core/html/00011.html
index e8871cb6e..4d24c4a88 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00011.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00011.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><body><h2>Sync View operations and selection</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
<p>Ensure Commit and Update buttons:</p>
<ul>
<li>operate on all applicable visible changes</li>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00013.html b/tests/org.eclipse.team.tests.cvs.core/html/00013.html
index f99e30045..49667b242 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00013.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00013.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><body><h2>Sync View operations and selection</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
<ul>
<li>Same scenarios as <a href="html/00011.html">Sync View operations and selection</a> except you can't commit.
<li>Test mark as merged (ensure that it can work on large data sets
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00016.html b/tests/org.eclipse.team.tests.cvs.core/html/00016.html
index 29bfb36ff..4689da8e7 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00016.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00016.html
@@ -5,7 +5,7 @@
</head><body><h2>Sync View modes and working sets</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
Ensure that choosing modes and working sets
<ul>
<li>result in proper filtering
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00018.html b/tests/org.eclipse.team.tests.cvs.core/html/00018.html
index 35f57eda7..7a2372c33 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00018.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00018.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Editor Linking</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
<ol>
<li>Open the Resource History view and enable editor linking</li>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00019.html b/tests/org.eclipse.team.tests.cvs.core/html/00019.html
index 9e5392a4d..0d8a148d8 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00019.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00019.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Crash Recovery</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
<p>Scenario 1</p>
<ol>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00021.html b/tests/org.eclipse.team.tests.cvs.core/html/00021.html
index c7270ad03..481facab3 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00021.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00021.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Close and disconnect</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
<h4>Background refresh and disconnect</h4>
<ol>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00022.html b/tests/org.eclipse.team.tests.cvs.core/html/00022.html
index d8dbbc2fd..34dc2acf1 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00022.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00022.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Persistance and deletion</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
<ul>
<li>Select a project and perform a merge.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00023.html b/tests/org.eclipse.team.tests.cvs.core/html/00023.html
index 1dc996d3e..1dd4d2252 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00023.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00023.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Restarting Workbench</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/20 22:20:45 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
Answer comes here.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00024.html b/tests/org.eclipse.team.tests.cvs.core/html/00024.html
index 2942db38a..0748ab05d 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00024.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00024.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Annotate</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/11/20 22:20:45 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
<h4>Annotate action should be available from</h4>
<ul>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00025.html b/tests/org.eclipse.team.tests.cvs.core/html/00025.html
index e4c086d14..cf2b61bac 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00025.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00025.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Synchronize View Settings</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/11/20 22:20:45 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
<h4>Saved between sessions</h4>
<p>The following GUI preferences in the Synchronize View are persisted between workbench
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00026.html b/tests/org.eclipse.team.tests.cvs.core/html/00026.html
index 2dd54b238..65c2c8ac6 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00026.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00026.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Sharing</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p><body>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p><body>
Answer comes here.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00027.html b/tests/org.eclipse.team.tests.cvs.core/html/00027.html
index 35b50d6f9..7048992cc 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00027.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00027.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><body><h2>Sharing as a subfolder</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p>
+Last Modified: $Date: 2003/12/04 21:43:57 $</p>
<p>Perform the following steps:</p>
<ol>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00028.html b/tests/org.eclipse.team.tests.cvs.core/html/00028.html
index 0aa50f2f6..4151a992e 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00028.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00028.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Reconnecting to existing</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/12/15 19:11:59 $</p><body>
+Last Modified: $Date: 2003/12/15 21:44:59 $</p><body>
<p>
The following scenario represents how a user would reconnect a project that does
not contain CVS meta-data to it's remote counterpart. It is assumed that the local project
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00029.html b/tests/org.eclipse.team.tests.cvs.core/html/00029.html
index 0b4fd3464..35920d4ad 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00029.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00029.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Patching</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/12/15 19:19:45 $</p><body>
+Last Modified: $Date: 2003/12/15 21:44:59 $</p><body>
Answer comes here.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00029a.html b/tests/org.eclipse.team.tests.cvs.core/html/00029a.html
index 135b9f8c1..9f35b9e89 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00029a.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00029a.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Server version compatibiliity</h2>
<p>Since: M6<br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p><body>
+Last Modified: $Date: 2004/01/08 17:01:17 $</p><body>
This test is to ensure that the ssh2 connection method properly delagates to ssh1
when the server only supports ssh1.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00030.html b/tests/org.eclipse.team.tests.cvs.core/html/00030.html
index e2ca35963..9add72202 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00030.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00030.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Importing a zip over a shared project</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/12/15 19:19:45 $</p><body>
+Last Modified: $Date: 2003/12/15 21:44:59 $</p><body>
<p>This scenario captures one means of patching. It assumes that a zip file contains
a previous version of a project that has been modified in some way and added to
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00030a.html b/tests/org.eclipse.team.tests.cvs.core/html/00030a.html
index 977ba7454..017278eb3 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00030a.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00030a.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Proxies</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p><body>
+Last Modified: $Date: 2004/01/08 17:01:17 $</p><body>
Using HTTP and SOCKS5 proxies.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00031.html b/tests/org.eclipse.team.tests.cvs.core/html/00031.html
index 29bf0333e..c8e9fcbbb 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00031.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00031.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Key Generation</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p><body>
+Last Modified: $Date: 2004/01/08 17:01:17 $</p><body>
You should be able to generate private/public keys in the SSH2 preference
page. Here are some scenarios for testing:
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00032.html b/tests/org.eclipse.team.tests.cvs.core/html/00032.html
index 1b9bec9b0..5f5029dd1 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00032.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00032.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>General use</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p><body>
+Last Modified: $Date: 2004/01/08 17:01:17 $</p><body>
This tests the prompting and usage of the SSH2 connection method:
<ul>
diff --git a/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch b/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch
index 3d3f131ff..a7e192ca2 100644
--- a/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch
+++ b/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
- <stringAttribute key="vmargs" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName=testFileAdditions"/>
- <booleanAttribute key="askclear" value="false"/>
- <booleanAttribute key="default" value="true"/>
- <booleanAttribute key="clearws" value="true"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
- <stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.debug.ui.javaSourceLocator"/>
- <stringAttribute key="location0" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace"/>
- <stringAttribute
- key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
- <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
- <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
- <stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
- <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.provider.IsModifiedTests"/>
- <stringAttribute key="progargs" value="-os win32 -ws win32 -arch x86 -nl en_CA"/>
+<booleanAttribute key="clearws" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.subscriber.AllTestsTeamSubscriber"/>
+<stringAttribute key="vmargs" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName2=testIncomingChanges"/>
+<booleanAttribute key="default" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="progargs" value="-os win32 -ws win32 -arch x86 -nl en_CA"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
+<booleanAttribute key="askclear" value="false"/>
+<stringAttribute key="location0" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.uitestapplication"/>
+<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.debug.ui.javaSourceLocator"/>
</launchConfiguration>
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 b2dfa519b..81722a202 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
@@ -22,6 +22,7 @@ import org.eclipse.core.tests.harness.EclipseWorkspaceTest;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.TeamSubscriberSyncInfoCollector;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.*;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
@@ -31,7 +32,6 @@ 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.SyncFileChangeListener;
import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInputOld;
import org.eclipse.team.tests.ccvs.ui.HeadlessCVSRunnableContext;
public class EclipseTest extends EclipseWorkspaceTest {
@@ -766,8 +766,27 @@ public class EclipseTest extends EclipseWorkspaceTest {
waitForJobCompletion(SyncFileChangeListener.getDeferredHandler().getEventHandlerJob());
}
- public static void waitForSubscriberInputHandling(SubscriberInputOld input) {
- waitForJobCompletion(input.getEventHandler().getEventHandlerJob());
+ public static void waitForSubscriberInputHandling(TeamSubscriberSyncInfoCollector input) {
+ input.waitForCollector(new IProgressMonitor() {
+ public void beginTask(String name, int totalWork) {
+ }
+ public void done() {
+ }
+ public void internalWorked(double work) {
+ }
+ public boolean isCanceled() {
+ return false;
+ }
+ public void setCanceled(boolean value) {
+ }
+ public void setTaskName(String name) {
+ }
+ public void subTask(String name) {
+ }
+ public void worked(int work) {
+ while (Display.getCurrent().readAndDispatch()) {}
+ }
+ });
}
protected static void executeHeadless(CVSOperation op) throws CVSException {
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 b32986694..6e32a158a 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
@@ -346,5 +346,30 @@ public class RemoteResourceTest extends EclipseTest {
private ICVSRemoteFolder checkoutRemote(ICVSRemoteFolder remote) throws CVSException, InvocationTargetException, InterruptedException {
return CheckoutToRemoteFolderOperation.checkoutRemoteFolder(null, remote, DEFAULT_MONITOR);
}
+
+ public void testContentFetchForLocalDeletion() throws TeamException, IOException, CoreException {
+ IProject project = createProject(new String[] { "file1.txt"});
+ String contents = "the file contents";
+ setContentsAndEnsureModified(project.getFile("file1.txt"), contents);
+ commitProject(project);
+ project.getFile("file1.txt").delete(false, null);
+ ICVSRemoteFile remote = (ICVSRemoteFile)CVSWorkspaceRoot.getRemoteResourceFor(project.getFile("file1.txt"));
+ String fetchedContents = asString(remote.getBufferedStorage(DEFAULT_MONITOR).getContents());
+ assertEquals("Contents do not match", contents, fetchedContents);
+ }
+
+ /**
+ * @param stream
+ * @return
+ */
+ private String asString(InputStream stream) throws IOException {
+ StringBuffer buffer = new StringBuffer();
+ int b = stream.read();
+ while (b != -1) {
+ buffer.append((char)b);
+ b = stream.read();
+ }
+ return buffer.toString();
+ }
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
index 729094d9e..093248ef0 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
@@ -21,14 +21,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.core.subscribers.*;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
/**
@@ -71,7 +67,7 @@ public class CVSMergeSubscriberTest extends CVSSyncSubscriberTest {
private void mergeResources(TeamSubscriber subscriber, SyncInfo[] infos, boolean allowOverwrite) throws TeamException, InvocationTargetException, InterruptedException {
TestMergeUpdateAction action = new TestMergeUpdateAction(allowOverwrite);
- action.getRunnable(new SyncInfoSet(infos)).run(DEFAULT_MONITOR);
+ action.getRunnable(new MutableSyncInfoSet(infos)).run(DEFAULT_MONITOR);
}
/**
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
index c65d34f9b..1e0405886 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
@@ -11,30 +11,19 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import junit.framework.AssertionFailedError;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ITeamResourceChangeListener;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamDelta;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
+import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.core.sync.RemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.tests.ccvs.ui.SynchronizeViewTestAdapter;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
/**
* Provides test methods common to CVS sync subscribers
@@ -236,6 +225,6 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
IResource[] resources = getResources(project, resourcePaths);
SyncInfo[] infos = createSyncInfos(subscriber, resources);
TestMarkAsMergedAction action = new TestMarkAsMergedAction();
- action.getRunnable(new SyncInfoSet(infos)).run(DEFAULT_MONITOR);
+ action.getRunnable(new MutableSyncInfoSet(infos)).run(DEFAULT_MONITOR);
}
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
index 8007f50ab..aaa409d21 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
@@ -30,9 +30,7 @@ import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction;
-import org.eclipse.team.internal.core.*;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
/**
* This class tests the CVSWorkspaceSubscriber
@@ -273,7 +271,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
IResource[] resources = getResources(container, hierarchy);
SyncInfo[] syncResources = createSyncInfos(resources);
try {
- action.getRunnable(new SyncInfoSet(syncResources)).run(DEFAULT_MONITOR);
+ action.getRunnable(new MutableSyncInfoSet(syncResources)).run(DEFAULT_MONITOR);
return resources;
} catch (InvocationTargetException e) {
throw CVSException.wrapException(e);
@@ -916,48 +914,6 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.IN_SYNC,
SyncInfo.IN_SYNC});
}
-
- /*
- * Test changes using a granularity of contents
- */
- public void testGranularityContents() throws TeamException, CoreException, IOException {
- // Create a test project (which commits it as well)
- IProject project = createProject(new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"});
-
- // Checkout a copy and make some modifications
- IProject copy = checkoutCopy(project, "-copy");
- appendText(copy.getFile("file1.txt"), "same text", false);
- setContentsAndEnsureModified(copy.getFile("folder1/a.txt"), " unique text"); // whitespace difference
- commitProject(copy);
-
- // Make the same modifications to the original
- appendText(project.getFile("file1.txt"), "same text", false);
- setContentsAndEnsureModified(project.getFile("folder1/a.txt"), "unique text"); // whitespace difference
-
- // Get the sync tree for the project
- String oldId = getSubscriber().getDefaultComparisonCriteria().getId();
- try {
- getSubscriber().setCurrentComparisonCriteria(ContentSyncInfoFilter.ID_DONTIGNORE_WS);
- assertSyncEquals("testGranularityContents", project,
- new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
- true, new int[] {
- SyncInfo.IN_SYNC,
- SyncInfo.IN_SYNC,
- SyncInfo.CONFLICTING | SyncInfo.CHANGE });
- getSubscriber().setCurrentComparisonCriteria(ContentSyncInfoFilter.ID_IGNORE_WS);
- // TODO: Should not need to reset after a comparison criteria change (bug 46678)
- getSyncInfoSource().reset(getSubscriber());
- assertSyncEquals("testGranularityContents", project,
- new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
- true, new int[] {
- SyncInfo.IN_SYNC,
- SyncInfo.IN_SYNC,
- SyncInfo.IN_SYNC });
- } finally {
- getSubscriber().setCurrentComparisonCriteria(oldId);
- }
-
- }
public void testSyncOnBranch() throws TeamException, CoreException, IOException {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java
index e55253553..ab4eb1028 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java
@@ -46,7 +46,7 @@ public class SyncInfoSource {
* Return the sync info for the given subscriber for the given resource.
*/
public SyncInfo getSyncInfo(TeamSubscriber subscriber, IResource resource) throws TeamException {
- return subscriber.getSyncInfo(resource, DEFAULT_MONITOR = new NullProgressMonitor());
+ return subscriber.getSyncInfo(resource);
}
/**
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java
index 9cab32c6b..fc8e4fb0c 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java
@@ -17,8 +17,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.synchronize.sets.SyncInfoSet;
+import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
@@ -43,11 +42,11 @@ public class SyncSetTests extends CVSSyncSubscriberTest {
}
class TestSyncInfo extends SyncInfo {
- protected int calculateKind(IProgressMonitor progress) throws TeamException {
+ protected int calculateKind() throws TeamException {
return 0;
}
public TestSyncInfo() throws TeamException {
- super(ResourcesPlugin.getWorkspace().getRoot(), null, null, null, null);
+ super(ResourcesPlugin.getWorkspace().getRoot(), null, null, null);
}
}
@@ -56,7 +55,7 @@ public class SyncSetTests extends CVSSyncSubscriberTest {
* that doesn't validate the actual contents of the sync set.
*/
public void testConcurrentAccessToSyncSet() throws Throwable {
- final SyncInfoSet set = new SyncInfoSet();
+ final MutableSyncInfoSet set = new MutableSyncInfoSet();
final boolean[] done = {false};
final IStatus[] error = {null};
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
index 692a1fd81..bac0ed8a6 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
@@ -12,13 +12,13 @@ package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.core.subscribers.MutableSyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
class TestCommitAction extends SubscriberCommitAction {
- public IRunnableWithProgress getRunnable(SyncInfoSet syncSet) {
+ public IRunnableWithProgress getRunnable(MutableSyncInfoSet syncSet) {
return super.getRunnable(syncSet);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java
index deaa3a8ae..0a5cd989c 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java
@@ -11,12 +11,12 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.core.subscribers.MutableSyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberConfirmMergedAction;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
class TestMarkAsMergedAction extends SubscriberConfirmMergedAction {
- public IRunnableWithProgress getRunnable(SyncInfoSet syncSet) {
+ public IRunnableWithProgress getRunnable(MutableSyncInfoSet syncSet) {
return super.getRunnable(syncSet);
}
protected boolean canRunAsJob() {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java
index 8e40682d4..0e2f47724 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java
@@ -12,9 +12,9 @@ package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.core.subscribers.MutableSyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.subscriber.MergeUpdateAction;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
class TestMergeUpdateAction extends MergeUpdateAction {
@@ -24,7 +24,7 @@ class TestMergeUpdateAction extends MergeUpdateAction {
this.allowOverwrite = allowOverwrite;
}
- protected boolean promptForOverwrite(SyncInfoSet syncSet) {
+ protected boolean promptForOverwrite(MutableSyncInfoSet syncSet) {
if (allowOverwrite) return true;
if (syncSet.isEmpty()) return true;
IResource[] resources = syncSet.getResources();
@@ -32,7 +32,7 @@ class TestMergeUpdateAction extends MergeUpdateAction {
return false;
}
- public IRunnableWithProgress getRunnable(SyncInfoSet syncSet) {
+ public IRunnableWithProgress getRunnable(MutableSyncInfoSet syncSet) {
return super.getRunnable(syncSet);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java
index 7f4b6f437..0ed622ac7 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java
@@ -11,9 +11,9 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.core.resources.IResource;
+import org.eclipse.team.core.subscribers.MutableSyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndCommitAction;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
public class TestOverrideAndCommit extends OverrideAndCommitAction {
@@ -29,7 +29,7 @@ public class TestOverrideAndCommit extends OverrideAndCommitAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction#promptForConflicts(org.eclipse.team.ui.sync.SyncInfoSet)
*/
- protected int promptForConflicts(SyncInfoSet syncSet) {
+ protected int promptForConflicts(MutableSyncInfoSet syncSet) {
this.prompted = true;
return 0; // ok to commit all conflicts
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java
index f31d4c36f..b4ecdfeff 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java
@@ -1,7 +1,7 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
+import org.eclipse.team.core.subscribers.MutableSyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndUpdateAction;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
public class TestOverrideAndUpdate extends OverrideAndUpdateAction {
@@ -10,7 +10,7 @@ public class TestOverrideAndUpdate extends OverrideAndUpdateAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#promptForOverwrite(org.eclipse.team.ui.sync.SyncInfoSet)
*/
- protected boolean promptForOverwrite(SyncInfoSet syncSet) {
+ protected boolean promptForOverwrite(MutableSyncInfoSet syncSet) {
this.prompted = true;
return true;
}
@@ -18,7 +18,7 @@ public class TestOverrideAndUpdate extends OverrideAndUpdateAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#warnAboutFailedResources(org.eclipse.team.ui.sync.SyncInfoSet)
*/
- protected void warnAboutFailedResources(SyncInfoSet syncSet) {
+ protected void warnAboutFailedResources(MutableSyncInfoSet syncSet) {
return;
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java
index 1007996ec..ebcf0b468 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java
@@ -11,25 +11,25 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.core.subscribers.MutableSyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceUpdateAction;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
class TestUpdateAction extends WorkspaceUpdateAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#warnAboutFailedResources(org.eclipse.team.ui.sync.SyncInfoSet)
*/
- protected void warnAboutFailedResources(SyncInfoSet syncSet) {
+ protected void warnAboutFailedResources(MutableSyncInfoSet syncSet) {
return;
}
- protected boolean promptForOverwrite(SyncInfoSet syncSet) {
+ protected boolean promptForOverwrite(MutableSyncInfoSet syncSet) {
EclipseTest.fail("Should never prompt on update, simply update nodes that are valid.");
return false;
}
- public IRunnableWithProgress getRunnable(SyncInfoSet syncSet) {
+ public IRunnableWithProgress getRunnable(MutableSyncInfoSet syncSet) {
return super.getRunnable(syncSet);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
index 2996747d9..67b2bb19d 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
@@ -17,13 +17,9 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant;
-import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInputOld;
-import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInputSyncInfoSet;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource;
import org.eclipse.team.ui.TeamUI;
@@ -39,11 +35,11 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
}
public SyncInfo getSyncInfo(TeamSubscriber subscriber, IResource resource) throws TeamException {
- SubscriberInputOld input = getInput(subscriber);
- SyncInfoSet set = input.getWorkingSetSyncSet();
+ TeamSubscriberParticipant input = getParticipant(subscriber);
+ SyncInfoSet set = input.getSyncInfoCollector().getSyncInfoSet();
SyncInfo info = set.getSyncInfo(resource);
if (info == null) {
- info = subscriber.getSyncInfo(resource, DEFAULT_MONITOR);
+ info = subscriber.getSyncInfo(resource);
if ((info != null && info.getKind() != SyncInfo.IN_SYNC)) {
throw new AssertionFailedError();
}
@@ -51,30 +47,32 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
return info;
}
- private SubscriberInputOld getInput(TeamSubscriber subscriber) {
+ private TeamSubscriberParticipant getParticipant(TeamSubscriber subscriber) {
// show the sync view
ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
for (int i = 0; i < participants.length; i++) {
ISynchronizeParticipant participant = participants[i];
if(participant instanceof TeamSubscriberParticipant) {
- SubscriberInputOld input = ((SubscriberInputSyncInfoSet)((TeamSubscriberParticipant)participant).getSyncInfoSet()).getInput();
- TeamSubscriber s = input.getTeamSubscriber();
- if(s == subscriber) {
- EclipseTest.waitForSubscriberInputHandling(input);
- return input;
+ if(((TeamSubscriberParticipant)participant).getSubscriber() == subscriber) {
+ return (TeamSubscriberParticipant)participant;
}
}
}
return null;
}
+
+ private TeamSubscriberSyncInfoCollector getCollector(TeamSubscriber subscriber) {
+ TeamSubscriberParticipant participant = getParticipant(subscriber);
+ if (participant == null) return null;
+ return participant.getSyncInfoCollector();
+ }
/* (non-Javadoc)
* @see org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource#assertProjectRemoved(org.eclipse.team.core.subscribers.TeamSubscriber, org.eclipse.core.resources.IProject)
*/
protected void assertProjectRemoved(TeamSubscriber subscriber, IProject project) throws TeamException {
super.assertProjectRemoved(subscriber, project);
- SubscriberInputOld input = getInput(subscriber);
- SyncInfoSet set = input.getSyncInfoSet();
+ SyncInfoSet set = getParticipant(subscriber).getSyncInfoCollector().getSyncInfoSet();
if (set.getOutOfSyncDescendants(project).length != 0) {
throw new AssertionFailedError("The sync set still contains resources from the deleted project " + project.getName());
}
@@ -115,7 +113,7 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
*/
public void refresh(TeamSubscriber subscriber, IResource resource) throws TeamException {
super.refresh(subscriber, resource);
- EclipseTest.waitForSubscriberInputHandling(getInput(subscriber));
+ EclipseTest.waitForSubscriberInputHandling(getCollector(subscriber));
}
/* (non-Javadoc)
@@ -123,6 +121,6 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
*/
public void reset(TeamSubscriber subscriber) throws TeamException {
super.reset(subscriber);
- getInput(subscriber).clear();
+ getCollector(subscriber).reset(DEFAULT_MONITOR);
}
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CVSUITestCase.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CVSUITestCase.java
index dd850a1e0..eb2381583 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CVSUITestCase.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CVSUITestCase.java
@@ -13,22 +13,12 @@ package org.eclipse.team.tests.ccvs.ui.old;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import junit.framework.Test;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.compare.structuremergeviewer.*;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
@@ -38,41 +28,19 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Console;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.actions.AddToWorkspaceAction;
-import org.eclipse.team.internal.ccvs.ui.actions.CommitAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRemoteAction;
-import org.eclipse.team.internal.ccvs.ui.actions.UpdateAction;
+import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.actions.*;
import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
import org.eclipse.team.internal.ccvs.ui.operations.TagOperation;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ccvs.ui.sync.CommitSyncAction;
-import org.eclipse.team.internal.ccvs.ui.sync.ForceCommitSyncAction;
-import org.eclipse.team.internal.ccvs.ui.sync.ForceUpdateSyncAction;
-import org.eclipse.team.internal.ccvs.ui.sync.UpdateSyncAction;
import org.eclipse.team.internal.ccvs.ui.wizards.SharingWizard;
import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
import org.eclipse.team.internal.ui.sync.SyncView;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchException;
+import org.eclipse.ui.*;
public class CVSUITestCase extends LoggingTestCase {
protected static Set installedTrap = new HashSet();
@@ -378,64 +346,64 @@ public class CVSUITestCase extends LoggingTestCase {
* Commits NON-CONFLICTING and CONFLICTING resources represented by an array of synchronizer nodes.
*/
private void syncCommitInternal(CVSSyncCompareInput input, ITeamNode[] nodes, final String comment) {
- FakeSelectionProvider selectionProvider = new FakeSelectionProvider(nodes);
- // Commit ONLY NON-CONFLICTING changes
- CommitSyncAction commitAction = new CommitSyncAction(input, selectionProvider, "Commit",
- testWindow.getShell()) {
- protected int promptForConflicts(SyncSet syncSet) {
- return 0; // yes! sync conflicting changes
- }
- protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
- return comment;
- }
- protected IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
- return unadded;
- }
- };
- commitAction.run();
- // Commit ONLY CONFLICTING changes
- ForceCommitSyncAction forceCommitAction = new ForceCommitSyncAction(input, selectionProvider, "Force Commit",
- testWindow.getShell()) {
- protected int promptForConflicts(SyncSet syncSet) {
- return 0; // yes! sync conflicting changes
- }
- protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
- return comment;
- }
- protected IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
- return unadded;
- }
- };
- forceCommitAction.run();
+// FakeSelectionProvider selectionProvider = new FakeSelectionProvider(nodes);
+// // Commit ONLY NON-CONFLICTING changes
+// CommitSyncAction commitAction = new CommitSyncAction(input, selectionProvider, "Commit",
+// testWindow.getShell()) {
+// protected int promptForConflicts(SyncSet syncSet) {
+// return 0; // yes! sync conflicting changes
+// }
+// protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
+// return comment;
+// }
+// protected IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
+// return unadded;
+// }
+// };
+// commitAction.run();
+// // Commit ONLY CONFLICTING changes
+// ForceCommitSyncAction forceCommitAction = new ForceCommitSyncAction(input, selectionProvider, "Force Commit",
+// testWindow.getShell()) {
+// protected int promptForConflicts(SyncSet syncSet) {
+// return 0; // yes! sync conflicting changes
+// }
+// protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
+// return comment;
+// }
+// protected IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
+// return unadded;
+// }
+// };
+// forceCommitAction.run();
}
/**
* Updates NON-CONFLICTING and CONFLICTING resources represented by an array of synchronizer nodes.
*/
private void syncGetInternal(CVSSyncCompareInput input, ITeamNode[] nodes) {
- FakeSelectionProvider selectionProvider = new FakeSelectionProvider(nodes);
- // Update ONLY NON-CONFLICTING changes
- UpdateSyncAction updateAction = new UpdateSyncAction(input, selectionProvider, "Update",
- testWindow.getShell()) {
- protected boolean promptForConflicts() {
- return true;
- }
- protected int promptForMergeableConflicts() {
- return 2;
- }
- };
- updateAction.run();
- // Update ONLY CONFLICTING changes
- ForceUpdateSyncAction forceUpdateAction = new ForceUpdateSyncAction(input, selectionProvider, "Force Update",
- testWindow.getShell()) {
- protected boolean promptForConflicts() {
- return true;
- }
- protected int promptForMergeableConflicts() {
- return 2;
- }
- };
- forceUpdateAction.run();
+// FakeSelectionProvider selectionProvider = new FakeSelectionProvider(nodes);
+// // Update ONLY NON-CONFLICTING changes
+// UpdateSyncAction updateAction = new UpdateSyncAction(input, selectionProvider, "Update",
+// testWindow.getShell()) {
+// protected boolean promptForConflicts() {
+// return true;
+// }
+// protected int promptForMergeableConflicts() {
+// return 2;
+// }
+// };
+// updateAction.run();
+// // Update ONLY CONFLICTING changes
+// ForceUpdateSyncAction forceUpdateAction = new ForceUpdateSyncAction(input, selectionProvider, "Force Update",
+// testWindow.getShell()) {
+// protected boolean promptForConflicts() {
+// return true;
+// }
+// protected int promptForMergeableConflicts() {
+// return 2;
+// }
+// };
+// forceUpdateAction.run();
}
/**

Back to the top