Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-01-27 17:03:41 -0500
committerMichael Valenta2004-01-27 17:03:41 -0500
commitbd41ba06d7d8248d2627cb5e87ebb0e77117373c (patch)
treee57a6353042ff6b90557b6315e9f73f3aebec009
parent4c27e5302328961acea38476df41710b284cf53f (diff)
downloadeclipse.platform.team-bd41ba06d7d8248d2627cb5e87ebb0e77117373c.tar.gz
eclipse.platform.team-bd41ba06d7d8248d2627cb5e87ebb0e77117373c.tar.xz
eclipse.platform.team-bd41ba06d7d8248d2627cb5e87ebb0e77117373c.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/FastSyncInfoFilter.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/MutableSyncInfoSet.java5
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfoFilter.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparator.java (renamed from bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ContentComparisonCriteria.java)25
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeViewCompareConfiguration.java1
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch4
9 files changed, 39 insertions, 34 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/FastSyncInfoFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/FastSyncInfoFilter.java
index 06d2ddf75..7efec87e9 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/FastSyncInfoFilter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/FastSyncInfoFilter.java
@@ -12,11 +12,10 @@ package org.eclipse.team.core.subscribers;
import org.eclipse.core.runtime.IProgressMonitor;
-
-
/**
- * A SyncInfoFilter can be used to control, at a fine grain, {@link SyncInfo}
- * instances in a SyncInfoSet.
+ * A specialized <code>SyncInfoFilter</code> that does not require a progress monitor.
+ * This enables these filters to be used when determining menu enablement or other
+ * operations that must be short running.
*
* @see SyncInfoSet
* @since 3.0
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/MutableSyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/MutableSyncInfoSet.java
index 1c60f4d37..487f629a3 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/MutableSyncInfoSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/MutableSyncInfoSet.java
@@ -32,12 +32,13 @@ public class MutableSyncInfoSet extends SyncInfoSet {
IPath path = local.getFullPath();
SyncInfo info = (SyncInfo)resources.remove(path);
changes.removed(local);
- statistics.remove(info);
+ if (info != null) {
+ statistics.remove(info);
+ }
if (local.getType() == IResource.FILE
|| members(local).length == 0) {
removeFromParents(local, local);
}
-
}
public void removeAll(IResource[] resources) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfoFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfoFilter.java
index a9e0b3738..9ba9b27dc 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfoFilter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfoFilter.java
@@ -12,10 +12,12 @@ package org.eclipse.team.core.subscribers;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.internal.core.subscribers.*;
/**
* A <code>SyncInfoFilter</code> tests a <code>SyncInfo</code> for inclusion
- * in a <code>SyncInfoSet</code>.
+ * typically in a <code>SyncInfoSet</code>.
+ *
*/
public abstract class SyncInfoFilter {
@@ -23,7 +25,7 @@ public abstract class SyncInfoFilter {
* Filter that selects those <code>SyncInfo</code> whose contents do not match.
*/
public static class ContentComparisonSyncInfoFilter extends SyncInfoFilter {
- ContentComparisonCriteria criteria = new ContentComparisonCriteria(false);
+ ContentComparator criteria = new ContentComparator(false);
public boolean select(SyncInfo info, IProgressMonitor monitor) {
ISubscriberResource remote = info.getRemote();
IResource local = info.getLocal();
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/internal/core/subscribers/ContentComparator.java
index 7e9f686b0..3d81751e0 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/internal/core/subscribers/ContentComparator.java
@@ -8,41 +8,28 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.core.subscribers;
+package org.eclipse.team.internal.core.subscribers;
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.subscribers.ISubscriberResource;
import org.eclipse.team.internal.core.Policy;
import org.eclipse.team.internal.core.TeamPlugin;
/**
- * A content comparison criteria that knows how to compare the content of
- * <code>IStorage</code> and <code>IRemoteResource</code> objects. The
- * content comparison can be configured to ignore or consider whitespace.
- *
- * @see org.eclipse.team.core.subscribers.ComparisonCriteria
+ * This is an internal class that is usd by the <code>ContentComparisonSyncInfoFilter</code>
+ * to compare the comtents of the local and remote resources
*/
-public class ContentComparisonCriteria {
+public class ContentComparator {
private boolean ignoreWhitespace = false;
- public ContentComparisonCriteria(boolean ignoreWhitespace) {
+ public ContentComparator(boolean ignoreWhitespace) {
this.ignoreWhitespace = ignoreWhitespace;
}
-
- /**
- * Helper methods for comparisons that returns true if the resource
- * contents are the same.
- *
- * If timestampDiff is true then the timestamps don't differ and there's no
- * 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;
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 78b6675fd..59bd49df3 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
@@ -290,7 +290,8 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
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);
+ SyncInfoFilter.ContentComparisonSyncInfoFilter contentFilter =
+ new SyncInfoFilter.ContentComparisonSyncInfoFilter();
monitor.beginTask(null, refreshed.length * 100);
for (int i = 0; i < refreshed.length; i++) {
IResource resource = refreshed[i];
@@ -302,7 +303,7 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
&& localBytes != null
&& local.exists()
&& !ResourceSyncInfo.getRevision(remoteBytes).equals(ResourceSyncInfo.getRevision(localBytes))
- && content.compare(resource, getRemoteResource(resource), Policy.subMonitorFor(monitor, 100))) {
+ && contentFilter.select(getSyncInfo(resource), Policy.subMonitorFor(monitor, 100))) {
// The contents are equals so mark the file as merged
internalMerged(resource);
}
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
index bfa3803bb..9c7a8e89e 100644
--- 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
@@ -88,10 +88,10 @@ public class CVSLocalCompareConfiguration extends SyncInfoSetCompareConfiguratio
*/
public void initializeViewer(Composite parent, StructuredViewer viewer) {
super.initializeViewer(parent, viewer);
- initializeActions(viewer);
}
- private void initializeActions(StructuredViewer viewer) {
+ protected void initializeActions(StructuredViewer viewer) {
+ super.initializeActions(viewer);
refreshAction = new RefreshAction(viewer, ((CVSSyncTreeSubscriber)collector.getTeamSubscriber()).getName(), collector, null /* no listener */, false);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
index a5bfc0f12..2d8001270 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
@@ -115,7 +115,7 @@ public class SyncInfoSetCompareConfiguration {
initializeListeners(viewer);
initializeNavigator(viewer);
hookContextMenu(viewer);
- createToolBarActions(parent);
+ initializeActions(viewer);
viewer.setInput(getInput());
}
@@ -182,6 +182,20 @@ public class SyncInfoSetCompareConfiguration {
}
/**
+ * Method invoked from <code>initializeViewer(Composite, StructuredViewer)</code> in order
+ * to initialize any actions for the viewer. It is invoked before the input is set on
+ * the viewer in order to allow actions to be initialized before there is any reaction
+ * to the input being set (e.g. selecting and opening the first element).
+ * <p>
+ * The default behavior is to add the up and down navigation nuttons to the toolbar.
+ * Subclasses can override.
+ * @param viewer the viewer being initialize
+ */
+ protected void initializeActions(StructuredViewer viewer) {
+ createToolBarActions(viewer.getControl().getParent());
+ }
+
+ /**
* Return the <code>SyncInfoSet</code> being shown by the viewer associated with
* this configuration.
* @return a <code>SyncInfoSet</code>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeViewCompareConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeViewCompareConfiguration.java
index 8651058d5..e81d9c8a7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeViewCompareConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeViewCompareConfiguration.java
@@ -49,6 +49,7 @@ public class SynchronizeViewCompareConfiguration extends SyncInfoSetCompareConfi
}
protected void initializeActions(StructuredViewer treeViewer) {
+ super.initializeActions(treeViewer);
openWithActions = new OpenWithActionGroup(view, participant);
refactorActions = new RefactorActionGroup(view.getSite().getPage().getActivePart());
refreshSelectionAction = new TeamParticipantRefreshAction(treeViewer, participant, false /*refresh*/);
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 1bc7f7908..f72687185 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,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
<booleanAttribute key="clearws" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.subscriber.CVSWorkspaceSubscriberTest"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.subscriber.CVSMergeSubscriberTest"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="default" value="true"/>
-<stringAttribute key="vmargs" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName=testUpdateBinaryConflict"/>
+<stringAttribute key="vmargs" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName2=testUpdateBinaryConflict"/>
<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"/>

Back to the top