Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-01-21 18:23:47 +0000
committerMichael Valenta2004-01-21 18:23:47 +0000
commit5063b078371afdd184205abb1aad30139f4895f4 (patch)
tree50d7694c1e3f33e516bb21ad14b5fa65f364308b
parent8274b92540726fd9f766503c804b4bdf11f50976 (diff)
downloadeclipse.platform.team-5063b078371afdd184205abb1aad30139f4895f4.tar.gz
eclipse.platform.team-5063b078371afdd184205abb1aad30139f4895f4.tar.xz
eclipse.platform.team-5063b078371afdd184205abb1aad30139f4895f4.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java11
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/TeamSubscriber.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/utils/SyncTreeSubscriber.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DeploymentProviderManager.java84
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java97
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java149
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java54
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java66
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewCompareConfiguration.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoDiffViewerSyncViewConfiguration.java)4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffCheckboxTreeViewer.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewer.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCheckboxCompareInput.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewerConfiguration.java)22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareInput.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java2
23 files changed, 480 insertions, 144 deletions
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 5fc2b541a..7e9f686b0 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,6 +15,7 @@ import java.io.*;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.core.Policy;
import org.eclipse.team.internal.core.TeamPlugin;
/**
@@ -24,7 +25,7 @@ import org.eclipse.team.internal.core.TeamPlugin;
*
* @see org.eclipse.team.core.subscribers.ComparisonCriteria
*/
-public class ContentComparisonCriteria implements IComparisonCriteria {
+public class ContentComparisonCriteria {
private boolean ignoreWhitespace = false;
@@ -40,11 +41,15 @@ public class ContentComparisonCriteria implements IComparisonCriteria {
* point checking the contents.
*/
public boolean compare(Object e1, Object e2) {
+ return compare(e1, e2, new NullProgressMonitor());
+ }
+
+ public boolean compare(Object e1, Object e2, IProgressMonitor monitor) {
InputStream is1 = null;
InputStream is2 = null;
try {
- is1 = getContents(e1, new NullProgressMonitor());
- is2 = getContents(e2, new NullProgressMonitor());
+ is1 = getContents(e1, Policy.subMonitorFor(monitor, 50));
+ is2 = getContents(e2, Policy.subMonitorFor(monitor, 50));
return contentsEqual(is1, is2, shouldIgnoreWhitespace());
} catch(TeamException e) {
TeamPlugin.log(e);
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 d5df84e13..95640d7a8 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
@@ -43,7 +43,9 @@ abstract public class TeamSubscriber {
/**
* Returns <code>true</code> if this resource is supervised by this
* subscriber. A supervised resource is one for which this subscriber
- * maintains the synchronization state. Returns <code>false</code> in all
+ * maintains the synchronization state. Supervised resources are the only
+ * resources returned when <code>members(IResource)</code> was invoked with the parent
+ * of the resource. Returns <code>false</code> in all
* other cases.
*
* @return <code>true</code> if this resource is supervised, and <code>false</code>
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
index 3b93e1754..400927599 100644
--- 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
@@ -40,7 +40,12 @@ public abstract class SyncTreeSubscriber extends TeamSubscriber {
public SyncInfo getSyncInfo(IResource resource) throws TeamException {
if (!isSupervised(resource)) return null;
ISubscriberResource remoteResource = getRemoteResource(resource);
- ISubscriberResource baseResource = getBaseResource(resource);
+ ISubscriberResource baseResource;
+ if (isThreeWay()) {
+ baseResource= getBaseResource(resource);
+ } else {
+ baseResource = null;
+ }
return getSyncInfo(resource, baseResource, remoteResource);
}
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
index 7c73245dc..ef4925af4 100644
--- 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
@@ -23,6 +23,7 @@ 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 static final QualifiedName WRITE_TIMESTAMP = new QualifiedName(TeamPlugin.ID, "writetime"); //$NON-NLS-1$
private final static QualifiedName STATE_LOADED_KEY = new QualifiedName("org.eclipse.team.core.deployment", "state_restored_key");
// {project -> list of Mapping}
@@ -206,6 +207,10 @@ public class DeploymentProviderManager implements IDeploymentProviderManager {
private Mapping internalMap(IContainer container, DeploymentProviderDescriptor description) {
Mapping newMapping = new Mapping(description, container);
+ return internalMap(container, newMapping);
+ }
+
+ private Mapping internalMap(IContainer container, Mapping newMapping) {
IProject project = container.getProject();
List projectMaps = (List)mappings.get(project);
if(projectMaps == null) {
@@ -215,7 +220,7 @@ public class DeploymentProviderManager implements IDeploymentProviderManager {
projectMaps.add(newMapping);
return newMapping;
}
-
+
/*
* Loads all the mappings associated with the resource's project.
*/
@@ -228,7 +233,12 @@ public class DeploymentProviderManager implements IDeploymentProviderManager {
if(project.getSessionProperty(STATE_LOADED_KEY) != null) {
return m;
}
- restoreState(project);
+ Mapping[] projectMappings = loadMappings(project);
+ for (int i = 0; i < projectMappings.length; i++) {
+ Mapping mapping = projectMappings[i];
+ internalMap(mapping.getContainer(), mapping);
+ }
+
project.setSessionProperty(STATE_LOADED_KEY, "true");
} catch (TeamException e) {
} catch (CoreException e) {
@@ -260,13 +270,13 @@ public class DeploymentProviderManager implements IDeploymentProviderManager {
* 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!!
+ IFile settingsFile = project.getFile(FILENAME);
try {
+ // Obtain a rule to ensure that others don't modify the file
+ Platform.getJobManager().beginRule(settingsFile, null);
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);
}
@@ -278,7 +288,6 @@ public class DeploymentProviderManager implements IDeploymentProviderManager {
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);
}
@@ -288,45 +297,86 @@ public class DeploymentProviderManager implements IDeploymentProviderManager {
} finally {
writer.close();
settingsFile.refreshLocal(IResource.DEPTH_ZERO, null);
+ settingsFile.setPersistentProperty(WRITE_TIMESTAMP, Long.toString(settingsFile.getModificationStamp()));
+ }
+ // Write the state to the meta-data area as well to ensure that
+ // external modifications made before the state is loaded do not
+ // result in leaked resources
+ IPath metaPath = project.getPluginWorkingLocation(TeamPlugin.getPlugin().getDescriptor());
+ metaPath = metaPath.append(FILENAME);
+ writer = new BufferedWriter(new FileWriter(metaPath.toFile()));
+ try {
+ xmlMemento.save(writer);
+ } finally {
+ writer.close();
}
}
} catch (IOException e) {
- //TeamPlugin.log(e); //$NON-NLS-1$
+ throw new TeamException("An I/O error occurred while persisting the deployment configurations for project {0}." + project.getName(), e);
} catch(CoreException ce) {
throw TeamException.asTeamException(ce);
+ } finally {
+ Platform.getJobManager().endRule(settingsFile);
}
}
- 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;
+ /*
+ * Load the mappings for the given project and return them.
+ */
+ private Mapping[] loadMappings(IProject project) throws TeamException, CoreException {
+ IFile file = project.getFile(FILENAME);
+ if(! file.exists()) {
+ // The file may have been deleted before our delta listener was loaded.
+ // If there are any deployments stored in the meta data area, dispose of them
+ // TODO: See if there were any before and dispose of them
+ return new Mapping[0];
+ }
+ String timestamp = file.getPersistentProperty(WRITE_TIMESTAMP);
+ try {
+ if (timestamp == null || Long.getLong(timestamp).longValue() != file.getModificationStamp()) {
+ // The file has been modified externally
+ // TODO:
+ }
+ } catch (NumberFormatException e1) {
+ // The write timestamp was corrupt.
+ // TODO:
+ }
Reader reader;
try {
reader = new BufferedReader(new FileReader(file.getLocation().toFile()));
} catch (FileNotFoundException e) {
- return;
+ return new Mapping[0];
}
- List participants = new ArrayList();
+ return loadMappings(project, reader);
+ }
+
+ private Mapping[] loadMappings(IProject project, Reader reader) throws TeamException {
IMemento memento = XMLMemento.createReadRoot(reader);
IMemento[] providers = memento.getChildren(CTX_PROVIDER);
+ List projectMappings = new ArrayList();
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);
+ TeamPlugin.log(IStatus.ERROR, "Previously deployed folder {0} in project {1} no longer exists." + location + project.getName(), null);
+ }
+ IResource resource = location.isEmpty() ? (IContainer)project : project.findMember(location);
+ if (resource.getType() == IResource.FILE) {
+ TeamPlugin.log(IStatus.ERROR, "Previously deployed resource {0} in project {1} is now a file and cannot be deployed." + location + project.getName(), null);
}
- IContainer container = location.isEmpty() ? (IContainer)project : project.getFolder(location);
+ IContainer container = (IContainer)resource;
DeploymentProviderDescriptor desc = registry.find(id);
if(desc != null) {
- Mapping m = internalMap(container, desc);
- m.setProviderState(memento2.getChild(CTX_PROVIDER_DATA));
+ Mapping m = new Mapping(desc, container);
+ m.setProviderState(memento2.getChild(CTX_PROVIDER_DATA));
+ projectMappings.add(m);
} else {
TeamPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.9", id), null); //$NON-NLS-1$
}
}
+ return (Mapping[]) projectMappings.toArray(new Mapping[projectMappings.size()]);
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
new file mode 100644
index 000000000..31fe3f05b
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.team.core.subscribers.utils.SynchronizationCache;
+import org.eclipse.team.internal.ccvs.core.syncinfo.CVSSynchronizationCache;
+
+/**
+ * This subscriber is used when comparing the local workspace with its
+ * corresponding remote.
+ */
+public class CVSCompareSubscriber extends CVSSyncTreeSubscriber {
+
+ public static final String QUALIFIED_NAME = CVSProviderPlugin.ID + ".compare"; //$NON-NLS-1$
+ private static final String UNIQUE_ID_PREFIX = "compare-"; //$NON-NLS-1$
+
+ private CVSTag tag;
+ private SynchronizationCache remoteSynchronizer;
+ private IResource[] resources;
+
+ public CVSCompareSubscriber(IResource[] resources, CVSTag tag) {
+ super(getUniqueId(), "CVS Compare with {0}" + tag.getName(), "Shows the differences between a tag and the workspace.");
+ this.resources = resources;
+ this.tag = tag;
+ initialize();
+ }
+
+ private void initialize() {
+ QualifiedName id = getId();
+ String syncKeyPrefix = id.getLocalName();
+ remoteSynchronizer = new CVSSynchronizationCache(new QualifiedName(SYNC_KEY_QUALIFIER, syncKeyPrefix + tag.getName()));
+ }
+
+ public void dispose() {
+ // ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ remoteSynchronizer.dispose();
+ }
+
+ private static QualifiedName getUniqueId() {
+ String uniqueId = Long.toString(System.currentTimeMillis());
+ return new QualifiedName(QUALIFIED_NAME, UNIQUE_ID_PREFIX + uniqueId); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getRemoteTag()
+ */
+ protected CVSTag getRemoteTag() {
+ return tag;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getBaseTag()
+ */
+ protected CVSTag getBaseTag() {
+ // No base tag needed since it's a two way compare
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getBaseSynchronizationCache()
+ */
+ protected SynchronizationCache getBaseSynchronizationCache() {
+ // No base cache needed since it's a two way compare
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getRemoteSynchronizationCache()
+ */
+ protected SynchronizationCache getRemoteSynchronizationCache() {
+ return remoteSynchronizer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#isThreeWay()
+ */
+ public boolean isThreeWay() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#roots()
+ */
+ public IResource[] roots() {
+ return resources;
+ }
+}
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 577823a52..78b6675fd 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
@@ -19,7 +19,11 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
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.resources.RemoteFile;
import org.eclipse.team.internal.ccvs.core.syncinfo.CVSSynchronizationCache;
+import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
+import org.eclipse.team.internal.ccvs.core.util.Util;
/**
* A CVSMergeSubscriber is responsible for maintaining the remote trees for a merge into
@@ -41,32 +45,15 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
public static final String QUALIFIED_NAME = "org.eclipse.team.cvs.ui.cvsmerge-participant"; //$NON-NLS-1$
private static final String UNIQUE_ID_PREFIX = "merge-"; //$NON-NLS-1$
- private IComparisonCriteria comparisonCriteria;
-
private CVSTag start, end;
private List roots;
private SynchronizationCache remoteSynchronizer;
private SynchronizationSyncBytesCache mergedSynchronizer;
private SynchronizationCache baseSynchronizer;
-
- private static final byte[] NO_REMOTE = new byte[0];
public CVSMergeSubscriber(IResource[] roots, CVSTag start, CVSTag end) {
this(getUniqueId(), roots, start, end);
}
-
- protected IResource[] refreshRemote(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
- IResource[] remoteChanges = super.refreshRemote(resources, depth, monitor);
- adjustMergedResources(remoteChanges);
- return remoteChanges;
- }
-
- private void adjustMergedResources(IResource[] remoteChanges) throws TeamException {
- for (int i = 0; i < remoteChanges.length; i++) {
- IResource resource = remoteChanges[i];
- mergedSynchronizer.removeSyncBytes(resource, IResource.DEPTH_ZERO);
- }
- }
private static QualifiedName getUniqueId() {
String uniqueId = Long.toString(System.currentTimeMillis());
@@ -85,7 +72,6 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
* @see org.eclipse.team.internal.ccvs.core.CVSWorkspaceSubscriber#initialize()
*/
private void initialize() {
- this.comparisonCriteria = new CVSRevisionNumberCompareCriteria();
QualifiedName id = getId();
String syncKeyPrefix = id.getLocalName();
remoteSynchronizer = new CVSSynchronizationCache(new QualifiedName(SYNC_KEY_QUALIFIER, syncKeyPrefix + end.getName()));
@@ -103,16 +89,20 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
public void merged(IResource[] resources) throws TeamException {
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- byte[] remoteBytes = remoteSynchronizer.getSyncBytes(resource);
- if (remoteBytes == null) {
- // If there is no remote, use a place holder to indicate the resouce was merged
- remoteBytes = NO_REMOTE;
- }
- mergedSynchronizer.setSyncBytes(resource, remoteBytes);
+ internalMerged(resource);
}
fireTeamResourceChange(TeamDelta.asSyncChangedDeltas(this, resources));
}
+ private void internalMerged(IResource resource) throws TeamException {
+ byte[] remoteBytes = remoteSynchronizer.getSyncBytes(resource);
+ if (remoteBytes == null) {
+ mergedSynchronizer.setRemoteDoesNotExist(resource);
+ } else {
+ mergedSynchronizer.setSyncBytes(resource, remoteBytes);
+ }
+ }
+
/* (non-Javadoc)
* @see org.eclipse.team.core.sync.TeamSubscriber#cancel()
*/
@@ -144,11 +134,6 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
public CVSTag getEndTag() {
return end;
}
-
- public boolean isReleaseSupported() {
- // you can't release changes to a merge
- return false;
- }
/*
* What to do when a root resource for this merge changes?
@@ -195,9 +180,22 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
}
}
+ /**
+ * Return whether the given resource has been merged with its
+ * corresponding remote.
+ * @param resource tghe loca resource
+ * @return boolean
+ * @throws TeamException
+ */
public boolean isMerged(IResource resource) throws TeamException {
- return (mergedSynchronizer.getSyncBytes(resource) != null ||
- mergedSynchronizer.isRemoteKnown(resource));
+ byte[] mergedBytes = mergedSynchronizer.getSyncBytes(resource);
+ byte[] remoteBytes = remoteSynchronizer.getSyncBytes(resource);
+ if (mergedBytes == null) {
+ return (remoteBytes == null
+ && mergedSynchronizer.isRemoteKnown(resource)
+ && remoteSynchronizer.isRemoteKnown(resource));
+ }
+ return Util.equals(mergedBytes, remoteBytes);
}
/*
@@ -221,13 +219,6 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
}
/* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.TeamSubscriber#getDefaultComparisonCriteria()
- */
- public IComparisonCriteria getDefaultComparisonCriteria() {
- return comparisonCriteria;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#getRemoteTag()
*/
protected CVSTag getRemoteTag() {
@@ -253,5 +244,85 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
*/
protected SynchronizationCache getRemoteSynchronizationCache() {
return remoteSynchronizer;
- }
+ }
+
+ protected boolean getCacheFileContentsHint() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#refreshBase(org.eclipse.core.resources.IResource[], int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IResource[] refreshBase(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
+ // Only refresh the base of a resource once as it should not change
+ List unrefreshed = new ArrayList();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if (!baseSynchronizer.isRemoteKnown(resource)) {
+ unrefreshed.add(resource);
+ }
+ }
+ if (unrefreshed.isEmpty()) {
+ monitor.done();
+ return new IResource[0];
+ }
+ IResource[] refreshed = super.refreshBase((IResource[]) unrefreshed.toArray(new IResource[unrefreshed.size()]), depth, monitor);
+ return refreshed;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber#refreshRemote(org.eclipse.core.resources.IResource[], int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IResource[] refreshRemote(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
+ monitor.beginTask(null, 100);
+ try {
+ IResource[] refreshed = super.refreshRemote(resources, depth, Policy.subMonitorFor(monitor, 50));
+ compareWithRemote(refreshed, Policy.subMonitorFor(monitor, 50));
+ return refreshed;
+ } finally {
+ monitor.done();
+ }
+ }
+
+ /*
+ * Mark as merged any local resources whose contents match that of the remote resource.
+ */
+ private void compareWithRemote(IResource[] refreshed, IProgressMonitor monitor) throws CVSException, TeamException {
+ // For any remote changes, if the revision differs from the local, compare the contents.
+ if (refreshed.length == 0) return;
+ ContentComparisonCriteria content = new ContentComparisonCriteria(false);
+ monitor.beginTask(null, refreshed.length * 100);
+ for (int i = 0; i < refreshed.length; i++) {
+ IResource resource = refreshed[i];
+ if (resource.getType() == IResource.FILE) {
+ ICVSFile local = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
+ byte[] localBytes = local.getSyncBytes();
+ byte[] remoteBytes = remoteSynchronizer.getSyncBytes(resource);
+ if (remoteBytes != null
+ && localBytes != null
+ && local.exists()
+ && !ResourceSyncInfo.getRevision(remoteBytes).equals(ResourceSyncInfo.getRevision(localBytes))
+ && content.compare(resource, getRemoteResource(resource), Policy.subMonitorFor(monitor, 100))) {
+ // The contents are equals so mark the file as merged
+ internalMerged(resource);
+ }
+ }
+ }
+ monitor.done();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.utils.SyncTreeSubscriber#getBaseResource(org.eclipse.core.resources.IResource)
+ */
+ public ISubscriberResource getBaseResource(IResource resource) throws TeamException {
+ // Use the merged bytes for the base if there are some
+ byte[] mergedBytes = mergedSynchronizer.getSyncBytes(resource);
+ if (mergedBytes != null) {
+ byte[] parentBytes = baseSynchronizer.getSyncBytes(resource.getParent());
+ if (parentBytes != null) {
+ return RemoteFile.fromBytes(resource, mergedBytes, parentBytes);
+ }
+ }
+ return super.getBaseResource(resource);
+ }
} \ No newline at end of file
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 011510d19..dbafcd3a6 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
@@ -48,7 +48,7 @@ public class CVSSyncInfo extends SyncInfo {
// with CVS because folders are not in namespaces (e.g. they exist in all versions
// and branches).
IResource local = getLocal();
- if(local.getType() != IResource.FILE && getSubscriber().isThreeWay()) {
+ if(local.getType() != IResource.FILE) {
int folderKind = SyncInfo.IN_SYNC;
ICVSRemoteFolder remote = (ICVSRemoteFolder)getRemote();
ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)local);
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 444d2c287..092ebb215 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
@@ -20,7 +20,9 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.core.subscribers.utils.*;
import org.eclipse.team.internal.ccvs.core.resources.*;
+import org.eclipse.team.internal.ccvs.core.syncinfo.*;
import org.eclipse.team.internal.ccvs.core.syncinfo.CVSRefreshOperation;
+import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
/**
* This class provides common funtionality for three way sychronizing
@@ -30,6 +32,8 @@ public abstract class CVSSyncTreeSubscriber extends SyncTreeSubscriber {
public static final String SYNC_KEY_QUALIFIER = "org.eclipse.team.cvs"; //$NON-NLS-1$
+ private static IComparisonCriteria comparisonCriteria = new CVSRevisionNumberCompareCriteria();
+
private QualifiedName id;
private String name;
private String description;
@@ -62,18 +66,11 @@ public abstract class CVSSyncTreeSubscriber extends SyncTreeSubscriber {
}
/* (non-Javadoc)
- * @see org.eclipse.team.core.sync.TeamSubscriber#roots()
- */
- public IResource[] roots() {
- return null;
- }
-
- /* (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;
- if(resource.getType() == IResource.FILE) {
+ if(resource.getType() == IResource.FILE || !isThreeWay()) {
return super.getSyncInfo(resource);
} else {
// In CVS, folders do not have a base. Hence, the remote is used as the base.
@@ -124,7 +121,7 @@ public abstract class CVSSyncTreeSubscriber extends SyncTreeSubscriber {
monitor = Policy.monitorFor(monitor);
try {
// Take a guess at the work involved for refreshing the base and remote tree
- int baseWork = getCacheFileContentsHint() ? 10 : 30;
+ int baseWork = isThreeWay() ? (getCacheFileContentsHint() ? 30 : 10) : 0;
int remoteWork = 100;
monitor.beginTask(null, baseWork + remoteWork);
IResource[] baseChanges = refreshBase(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, baseWork));
@@ -143,15 +140,16 @@ public abstract class CVSSyncTreeSubscriber extends SyncTreeSubscriber {
}
}
- /**
- * TODO: Temporary
- */
protected boolean getCacheFileContentsHint() {
return false;
}
protected IResource[] refreshBase(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
- return new CVSRefreshOperation(getBaseSynchronizationCache(), null, getBaseTag()).refresh(resources, depth, getCacheFileContentsHint(), monitor);
+ if (isThreeWay()) {
+ return new CVSRefreshOperation(getBaseSynchronizationCache(), null, getBaseTag()).refresh(resources, depth, getCacheFileContentsHint(), monitor);
+ } else {
+ return new IResource[0];
+ }
}
protected IResource[] refreshRemote(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
@@ -205,7 +203,11 @@ public abstract class CVSSyncTreeSubscriber extends SyncTreeSubscriber {
}
public ISubscriberResource getBaseResource(IResource resource) throws TeamException {
- return getRemoteResource(resource, getBaseSynchronizationCache());
+ if (isThreeWay()) {
+ return getRemoteResource(resource, getBaseSynchronizationCache());
+ } else {
+ return null;
+ }
}
/**
@@ -218,7 +220,7 @@ public abstract class CVSSyncTreeSubscriber extends SyncTreeSubscriber {
*/
protected abstract SynchronizationCache getRemoteSynchronizationCache();
- private ISubscriberResource getRemoteResource(IResource resource, SynchronizationCache cache) throws TeamException {
+ protected ISubscriberResource getRemoteResource(IResource resource, SynchronizationCache cache) throws TeamException {
byte[] remoteBytes = cache.getSyncBytes(resource);
if (remoteBytes == null) {
// There is no remote handle for this resource
@@ -229,10 +231,18 @@ public abstract class CVSSyncTreeSubscriber extends SyncTreeSubscriber {
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;
+ // Before failing, try and use the local folder sync bytes
+ ICVSFolder local = CVSWorkspaceRoot.getCVSFolderFor(resource.getParent());
+ FolderSyncInfo info = local.getFolderSyncInfo();
+ if (info == 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;
+ } else {
+ FolderSyncInfo newInfo = new FolderSyncInfo(info.getRepository(), info.getRoot(), new CVSEntryLineTag(new String(ResourceSyncInfo.getTagBytes(remoteBytes))), false);
+ parentBytes = newInfo.getBytes();
+ }
}
return RemoteFile.fromBytes(resource, remoteBytes, parentBytes);
} else {
@@ -255,4 +265,10 @@ public abstract class CVSSyncTreeSubscriber extends SyncTreeSubscriber {
return getRemoteSynchronizationCache().getSyncBytes(resource) != null;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#getDefaultComparisonCriteria()
+ */
+ public IComparisonCriteria getDefaultComparisonCriteria() {
+ return comparisonCriteria;
+ }
}
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 99da9319d..a97a2faa8 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
@@ -31,7 +31,6 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
private SynchronizationCache remoteSynchronizer;
private SynchronizationCache baseSynchronizer;
- private IComparisonCriteria comparisonCriteria;
// qualified name for remote sync info
private static final String REMOTE_RESOURCE_KEY = "remote-resource-key"; //$NON-NLS-1$
@@ -46,8 +45,6 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
new SynchronizationSyncBytesCache(new QualifiedName(SYNC_KEY_QUALIFIER, REMOTE_RESOURCE_KEY)));
ResourceStateChangeListeners.getListener().addResourceStateChangeListener(this);
-
- comparisonCriteria = new CVSRevisionNumberCompareCriteria();
}
/*
@@ -292,10 +289,4 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
return remoteSynchronizer;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.TeamSubscriber#getDefaultComparisonCriteria()
- */
- public IComparisonCriteria getDefaultComparisonCriteria() {
- return comparisonCriteria;
- }
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
index 4da23d585..ba67eef69 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
@@ -409,6 +409,7 @@ public class Util {
* @return boolean
*/
public static boolean equals(byte[] syncBytes, byte[] oldBytes) {
+ if (syncBytes == null || oldBytes == null) return syncBytes == oldBytes;
if (syncBytes.length != oldBytes.length) return false;
for (int i = 0; i < oldBytes.length; i++) {
if (oldBytes[i] != syncBytes[i]) return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java
index 0a22443c6..3d9255b60 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java
@@ -90,7 +90,7 @@ public class ReleaseCommentDialog extends DetailsDialog {
TeamSubscriberParticipant participant = CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeParticipant();
SyncInfoFilter.SyncInfoDirectionFilter filter = new SyncInfoFilter.SyncInfoDirectionFilter(SyncInfo.OUTGOING);
compareEditorInput = new SyncInfoSetCompareInput(cc,
- new SyncInfoDiffTreeViewerConfiguration(null, participant.getSyncInfoCollector().getSyncInfoSet()));
+ new SyncInfoSetCompareConfiguration(null, participant.getSyncInfoCollector().getSyncInfoSet()));
// set F1 help
WorkbenchHelp.setHelp(composite, IHelpContextIds.RELEASE_COMMENT_DIALOG);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
index b81125a8d..3a60442f2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
@@ -12,6 +12,7 @@ package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
+import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareUI;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -19,36 +20,50 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.ui.CVSLocalCompareEditorInput;
import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
+import org.eclipse.team.internal.ccvs.ui.subscriber.CVSLocalCompareConfiguration;
+import org.eclipse.team.ui.synchronize.SyncInfoSetCompareInput;
public class CompareWithTagAction extends WorkspaceAction {
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final ICVSRemoteResource[] remoteResource = new ICVSRemoteResource[] { null };
- final IResource[] resources = getSelectedResources();
-
- IProject[] projects = new IProject[resources.length];
- for (int i = 0; i < resources.length; i++) {
- projects[i] = resources[i].getProject();
- }
- final CVSTag tag = TagSelectionDialog.getTagToCompareWith(getShell(), projects);
+ IResource[] resources = getSelectedResources();
+ CVSTag tag = promptForTag(resources);
if (tag == null) return;
+ final SyncInfoSetCompareInput input = createCompareInput(resources, tag);
+
// Show the compare viewer
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
CompareUI.openCompareEditorOnPage(
- new CVSLocalCompareEditorInput(resources, tag),
+ input,
getTargetPage());
}
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
}
+ private SyncInfoSetCompareInput createCompareInput(IResource[] resources, CVSTag tag) {
+ final SyncInfoSetCompareInput input = new SyncInfoSetCompareInput(
+ new CompareConfiguration(),
+ CVSLocalCompareConfiguration.create(resources, tag));
+ return input;
+ }
+
+ private CVSTag promptForTag(IResource[] resources) {
+ IProject[] projects = new IProject[resources.length];
+ for (int i = 0; i < resources.length; i++) {
+ projects[i] = resources[i].getProject();
+ }
+ CVSTag tag = TagSelectionDialog.getTagToCompareWith(getShell(), projects);
+ return tag;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
*/
protected boolean isEnabledForNonExistantResources() {
return true;
}
+
+
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java
new file mode 100644
index 000000000..228ef6e8d
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.subscriber;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.TeamSubscriberSyncInfoCollector;
+import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
+import org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration;
+
+/**
+ * Provides compare specific support
+ */
+public class CVSLocalCompareConfiguration extends SyncInfoSetCompareConfiguration {
+
+ private CVSCompareSubscriber subscriber;
+ private TeamSubscriberSyncInfoCollector collector;
+
+ /**
+ * Return a <code>SyncInfoSetCompareConfiguration</code> that can be used in a
+ * <code>SyncInfoSetCompareInput</code> to show the comparsion between the local
+ * workspace resources and their tagged counterparts on the server.
+ * @param resources the resources to be compared
+ * @param tag the tag to be compared with
+ * @return a configuration for a <code>SyncInfoSetCompareInput</code>
+ */
+ public static CVSLocalCompareConfiguration create(IResource[] resources, CVSTag tag) {
+ CVSCompareSubscriber subscriber = new CVSCompareSubscriber(resources, tag);
+ TeamSubscriberSyncInfoCollector collector = new TeamSubscriberSyncInfoCollector(subscriber);
+ return new CVSLocalCompareConfiguration(subscriber, collector);
+ }
+
+ public CVSLocalCompareConfiguration(CVSCompareSubscriber subscriber, TeamSubscriberSyncInfoCollector collector) {
+ super(null, collector.getSyncInfoSet());
+ this.subscriber = subscriber;
+ this.collector = collector;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration#dispose()
+ */
+ protected void dispose() {
+ collector.dispose();
+ subscriber.dispose();
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration#prepareInput(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public SyncInfoDiffNode prepareInput(IProgressMonitor monitor) throws TeamException {
+ subscriber.refresh(subscriber.roots(), IResource.DEPTH_INFINITE, monitor);
+ collector.waitForCollector(monitor);
+ return super.prepareInput(monitor);
+ }
+}
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 2b571d07d..f8f0314c9 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
@@ -104,8 +104,9 @@ public class ChangesSection extends Composite {
if(participant.getSyncInfoSetCollector().getSyncInfoSet().size() == 0) {
TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
public void run() {
- filteredContainer = getEmptyChangesComposite(changesSectionContainer);
- changesSectionContainer.showPage(filteredContainer);
+ if (changesSectionContainer.isDisposed()) return;
+ filteredContainer = getEmptyChangesComposite(changesSectionContainer);
+ changesSectionContainer.showPage(filteredContainer);
}
});
} else {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java
index 928690f67..188322ba2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java
@@ -52,7 +52,7 @@ public class RefreshCompleteDialog extends DetailsDialog {
this.set = new SyncInfoSetCollector(participant.getSyncInfoCollector().getSyncInfoSet(), getResources(), null);
this.compareEditorInput = new SyncInfoSetCompareInput(new CompareConfiguration(),
- new SyncInfoDiffTreeViewerConfiguration(participant.getId(), set.getSyncInfoSet()));
+ new SyncInfoSetCompareConfiguration(participant.getId(), set.getSyncInfoSet()));
IDialogSettings workbenchSettings = TeamUIPlugin.getPlugin().getDialogSettings();
this.settings = workbenchSettings.getSection("RefreshCompleteDialog");//$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoDiffViewerSyncViewConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewCompareConfiguration.java
index a274db3f9..d23bfa121 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoDiffViewerSyncViewConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewCompareConfiguration.java
@@ -25,7 +25,7 @@ import org.eclipse.ui.IWorkbenchActionConstants;
/**
* Overrides the SyncInfoDiffViewerConfiguration to configure the diff viewer for the synchroniza view
*/
-public class SyncInfoDiffViewerSyncViewConfiguration extends SyncInfoDiffTreeViewerConfiguration {
+public class SynchronizeViewCompareConfiguration extends SyncInfoSetCompareConfiguration {
private ISynchronizeView view;
private TeamSubscriberParticipant participant;
@@ -34,7 +34,7 @@ public class SyncInfoDiffViewerSyncViewConfiguration extends SyncInfoDiffTreeVie
private RefactorActionGroup refactorActions;
private RefreshAction refreshSelectionAction;
- public SyncInfoDiffViewerSyncViewConfiguration(ISynchronizeView view, TeamSubscriberParticipant participant) {
+ public SynchronizeViewCompareConfiguration(ISynchronizeView view, TeamSubscriberParticipant participant) {
super(participant.getId(), participant.getSyncInfoSetCollector().getSyncInfoSet());
this.view = view;
this.participant = participant;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffCheckboxTreeViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffCheckboxTreeViewer.java
index f2a581b79..e41cd6663 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffCheckboxTreeViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffCheckboxTreeViewer.java
@@ -22,9 +22,9 @@ import org.eclipse.ui.internal.dialogs.ContainerCheckedTreeViewer;
// TODO: This is an internal superclass
public class SyncInfoDiffCheckboxTreeViewer extends ContainerCheckedTreeViewer implements INavigableControl, SyncInfoDiffTreeNavigator.INavigationTarget {
- private SyncInfoDiffTreeViewerConfiguration configuration;
+ private SyncInfoSetCompareConfiguration configuration;
- public SyncInfoDiffCheckboxTreeViewer(Composite parent, SyncInfoDiffTreeViewerConfiguration configuration) {
+ public SyncInfoDiffCheckboxTreeViewer(Composite parent, SyncInfoSetCompareConfiguration configuration) {
super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
this.configuration = configuration;
configuration.initializeViewer(parent, this);
@@ -92,7 +92,7 @@ public class SyncInfoDiffCheckboxTreeViewer extends ContainerCheckedTreeViewer i
/**
* @return Returns the configuration.
*/
- public SyncInfoDiffTreeViewerConfiguration getConfiguration() {
+ public SyncInfoSetCompareConfiguration getConfiguration() {
return configuration;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewer.java
index 54e9a1d1e..eba8040b0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewer.java
@@ -20,9 +20,9 @@ import org.eclipse.team.ui.synchronize.actions.INavigableControl;
public class SyncInfoDiffTreeViewer extends TreeViewer implements INavigableControl, SyncInfoDiffTreeNavigator.INavigationTarget {
- private SyncInfoDiffTreeViewerConfiguration configuration;
+ private SyncInfoSetCompareConfiguration configuration;
- public SyncInfoDiffTreeViewer(Composite parent, SyncInfoDiffTreeViewerConfiguration configuration) {
+ public SyncInfoDiffTreeViewer(Composite parent, SyncInfoSetCompareConfiguration configuration) {
super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
this.configuration = configuration;
configuration.initializeViewer(parent, this);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCheckboxCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCheckboxCompareInput.java
index c6c4056ab..a3d0ec025 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCheckboxCompareInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCheckboxCompareInput.java
@@ -31,22 +31,22 @@ public class SyncInfoSetCheckboxCompareInput extends SyncInfoSetCompareInput {
/**
* Create a <code>SyncInfoSetCheckboxCompareInput</code> whose diff viewer is configured
- * using the provided <code>SyncInfoDiffTreeViewerConfiguration</code>.
+ * using the provided <code>SyncInfoSetCompareConfiguration</code>.
* @param configuration the compare configuration
* @param diffViewerConfiguration the diff viewer configuration
* @param listener listener taht is notified whenever the selection changes
*/
- public SyncInfoSetCheckboxCompareInput(CompareConfiguration configuration, SyncInfoDiffTreeViewerConfiguration diffViewerConfiguration, ICheckStateListener listener) {
+ public SyncInfoSetCheckboxCompareInput(CompareConfiguration configuration, SyncInfoSetCompareConfiguration diffViewerConfiguration, ICheckStateListener listener) {
super(configuration, diffViewerConfiguration);
this.listener = listener;
}
/* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoSetCompareInput#internalCreateDiffViewer(org.eclipse.swt.widgets.Composite, org.eclipse.team.ui.synchronize.SyncInfoDiffTreeViewerConfiguration)
+ * @see org.eclipse.team.ui.synchronize.SyncInfoSetCompareInput#internalCreateDiffViewer(org.eclipse.swt.widgets.Composite, org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration)
*/
protected StructuredViewer internalCreateDiffViewer(
Composite parent,
- SyncInfoDiffTreeViewerConfiguration diffViewerConfiguration) {
+ SyncInfoSetCompareConfiguration diffViewerConfiguration) {
final SyncInfoDiffCheckboxTreeViewer treeViewer = new SyncInfoDiffCheckboxTreeViewer(parent, diffViewerConfiguration);
treeViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewerConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
index 17c8b9a7a..2eb63c494 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewerConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
@@ -16,6 +16,7 @@ import org.eclipse.compare.*;
import org.eclipse.compare.internal.INavigatable;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.*;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -25,6 +26,7 @@ import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.MenuListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfoSet;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.synchronize.SyncInfoDiffTreeNavigator;
@@ -39,8 +41,10 @@ import org.eclipse.ui.views.navigator.ResourceSorter;
* This class provides the configurability of SyncInfo diff viewers.
* A configuration can only be used with one viewer.
* TODO: Should we make it reusable? If not, should assert on second call to createViewer
+ *
+ * @since 3.0
*/
-public class SyncInfoDiffTreeViewerConfiguration {
+public class SyncInfoSetCompareConfiguration {
private SyncInfoSet set;
private String menuId;
@@ -51,13 +55,13 @@ public class SyncInfoDiffTreeViewerConfiguration {
private IPropertyChangeListener propertyListener;
/**
- * Create a <code>SyncInfoDiffTreeViewerConfiguration</code> for the given sync set
+ * Create a <code>SyncInfoSetCompareConfiguration</code> for the given sync set
* and menuId. If the menuId is <code>null</code>, then no contributed menus will be shown
* in the diff viewer created from this configuration.
* @param menuId the id of menu objectContributions
* @param set the <code>SyncInfoSet</code> to be displayed in the resulting diff viewer
*/
- public SyncInfoDiffTreeViewerConfiguration(String menuId, SyncInfoSet set) {
+ public SyncInfoSetCompareConfiguration(String menuId, SyncInfoSet set) {
this.menuId = menuId;
this.set = set;
}
@@ -297,4 +301,16 @@ public class SyncInfoDiffTreeViewerConfiguration {
protected boolean allowParticipantMenuContributions() {
return getMenuId() != null;
}
+
+ /**
+ * Prepare the input that is to be shown in the diff viewer of the configuration's
+ * compare input. This method may be overridden by sublcass but should only be
+ * invoked by the compare input
+ * @param monitor a progress monitor
+ * @return the input ot the compare input's diff viewer
+ * @throws TeamException
+ */
+ public SyncInfoDiffNode prepareInput(IProgressMonitor monitor) throws TeamException {
+ return getInput();
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareInput.java
index f751be6ea..7abc2b3ec 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareInput.java
@@ -15,32 +15,32 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareEditorInput;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.Utils;
/**
* A <code>CompareEditorInput</code> whose diff viewer shows the resources contained
* in a <code>SyncInfoSet</code>. The configuration of the diff viewer is determined by the
- * <code>SyncInfoDiffTreeViewerConfiguration</code> that is used to create the
+ * <code>SyncInfoSetCompareConfiguration</code> that is used to create the
* <code>SyncInfoSetCompareInput</code>.
*
* @since 3.0
*/
public class SyncInfoSetCompareInput extends CompareEditorInput {
- private SyncInfoDiffTreeViewerConfiguration diffViewerConfiguration;
+ private SyncInfoSetCompareConfiguration diffViewerConfiguration;
/**
* Create a <code>SyncInfoSetCompareInput</code> whose diff viewer is configured
- * using the provided <code>SyncInfoDiffTreeViewerConfiguration</code>.
+ * using the provided <code>SyncInfoSetCompareConfiguration</code>.
* @param configuration the compare configuration
* @param diffViewerConfiguration the diff viewer configuration
*/
- public SyncInfoSetCompareInput(CompareConfiguration configuration, SyncInfoDiffTreeViewerConfiguration diffViewerConfiguration) {
+ public SyncInfoSetCompareInput(CompareConfiguration configuration, SyncInfoSetCompareConfiguration diffViewerConfiguration) {
super(configuration);
this.diffViewerConfiguration = diffViewerConfiguration;
}
@@ -60,7 +60,7 @@ public class SyncInfoSetCompareInput extends CompareEditorInput {
* @param diffViewerConfiguration the configuration for the diff viewer
* @return the created diff viewer
*/
- protected StructuredViewer internalCreateDiffViewer(Composite parent, SyncInfoDiffTreeViewerConfiguration diffViewerConfiguration) {
+ protected StructuredViewer internalCreateDiffViewer(Composite parent, SyncInfoSetCompareConfiguration diffViewerConfiguration) {
return new SyncInfoDiffTreeViewer(parent, diffViewerConfiguration);
}
@@ -87,10 +87,14 @@ public class SyncInfoSetCompareInput extends CompareEditorInput {
}
protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- return new SyncInfoDiffNode(diffViewerConfiguration.getSyncSet(), ResourcesPlugin.getWorkspace().getRoot());
+ try {
+ return diffViewerConfiguration.prepareInput(monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
}
- private static SyncInfoDiffNode getElement(ISelection selection) {
+ /* private */ SyncInfoDiffNode getElement(ISelection selection) {
if (selection != null && selection instanceof IStructuredSelection) {
IStructuredSelection ss= (IStructuredSelection) selection;
if (ss.size() == 1) {
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 d001a1351..3f2e8ef64 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
@@ -67,24 +67,22 @@ public class TeamSubscriberParticipantLabelProvider extends LabelProvider implem
public void started(QualifiedName jobType) {
working = true;
Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- synchronized (this) {
- System.out.println(">> Fire started work: ");
- fireLabelProviderChanged(new LabelProviderChangedEvent(TeamSubscriberParticipantLabelProvider.this));
- }
- }
- });
+ public void run() {
+ synchronized (this) {
+ fireLabelProviderChanged(new LabelProviderChangedEvent(TeamSubscriberParticipantLabelProvider.this));
+ }
+ }
+ });
}
public void finished(QualifiedName jobType) {
working = false;
Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- synchronized (this) {
- System.out.println(">> Fire stopped work: ");
- fireLabelProviderChanged(new LabelProviderChangedEvent(TeamSubscriberParticipantLabelProvider.this));
- }
- }
- });
+ public void run() {
+ synchronized (this) {
+ fireLabelProviderChanged(new LabelProviderChangedEvent(TeamSubscriberParticipantLabelProvider.this));
+ }
+ }
+ });
}
}, TeamSubscriber.SUBSCRIBER_JOB_TYPE);
@@ -231,10 +229,8 @@ public class TeamSubscriberParticipantLabelProvider extends LabelProvider implem
*/
public Color getForeground(Object element) {
if (working) {
- System.out.println("Working: " + element.toString());
return WorkbenchColors.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
} else {
- System.out.println("Not Working: " + element.toString());
return null;
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
index 6713d3b5d..5962bbec0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
@@ -264,7 +264,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
}
public Viewer createChangesViewer(Composite parent) {
- SyncInfoDiffViewerSyncViewConfiguration configuration = new SyncInfoDiffViewerSyncViewConfiguration(getSynchronizeView(), getParticipant());
+ SynchronizeViewCompareConfiguration configuration = new SynchronizeViewCompareConfiguration(getSynchronizeView(), getParticipant());
Viewer viewer = configuration.createViewer(parent);
getSite().setSelectionProvider(viewer);
return viewer;

Back to the top