Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2svn2003-10-22 14:54:20 +0000
committercvs2svn2003-10-22 14:54:20 +0000
commitc3e06438a72182be8249fa0a66e07a7141a36a92 (patch)
tree099a0a808c9f251fa5f58f2a21ea3b8a81dd6095
parent736b3e56f00f042cc6f5f75c9597830c7b748078 (diff)
downloadeclipse.platform.team-c3e06438a72182be8249fa0a66e07a7141a36a92.tar.gz
eclipse.platform.team-c3e06438a72182be8249fa0a66e07a7141a36a92.tar.xz
eclipse.platform.team-c3e06438a72182be8249fa0a66e07a7141a36a92.zip
This commit was manufactured by cvs2svn to create branch
'SynchronizeViewPageBook20031009'. Cherrypick from master 2003-10-22 14:54:17 UTC Michael Valenta <mvalenta> '41738: Comparing two remote versions can result in many connections': bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RDiff.java bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/CompareDiffListener.java bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/IMessagePatterns.java bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/RDiffSummaryListener.java bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/KnownRepositories.java bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceStateChangeListeners.java bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif tests/org.eclipse.team.tests.core/.classpath tests/org.eclipse.team.tests.core/.project tests/org.eclipse.team.tests.core/build.properties tests/org.eclipse.team.tests.core/plugin.xml tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java tests/org.eclipse.team.tests.core/test.xml
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RDiff.java46
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/CompareDiffListener.java118
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/IMessagePatterns.java36
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/RDiffSummaryListener.java144
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java99
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/KnownRepositories.java232
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceStateChangeListeners.java128
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java302
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gifbin0 -> 147 bytes
-rw-r--r--tests/org.eclipse.team.tests.core/.classpath15
-rw-r--r--tests/org.eclipse.team.tests.core/.project37
-rw-r--r--tests/org.eclipse.team.tests.core/build.properties12
-rw-r--r--tests/org.eclipse.team.tests.core/plugin.xml88
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java41
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java248
-rw-r--r--tests/org.eclipse.team.tests.core/test.xml48
16 files changed, 1594 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RDiff.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RDiff.java
new file mode 100644
index 000000000..de27da825
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RDiff.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.client;
+
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+
+public class RDiff extends RemoteCommand {
+
+ /*** Local options: specific to rdiff ***/
+ public static final LocalOption SUMMARY = new LocalOption("-s", null); //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.client.Request#getRequestId()
+ */
+ protected String getRequestId() {
+ return "rdiff"; //$NON-NLS-1$
+ }
+
+ /**
+ * Makes a -r or -D option for a tag.
+ * Valid for: checkout export history rdiff update
+ */
+ public static LocalOption makeTagOption(CVSTag tag) {
+ if (tag == null) tag = CVSTag.DEFAULT;
+ int type = tag.getType();
+ switch (type) {
+ case CVSTag.BRANCH:
+ case CVSTag.VERSION:
+ case CVSTag.HEAD:
+ return new LocalOption("-r", tag.getName()); //$NON-NLS-1$
+ case CVSTag.DATE:
+ return new LocalOption("-D", tag.getName()); //$NON-NLS-1$
+ default:
+ // Unknow tag type!!!
+ throw new IllegalArgumentException();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/CompareDiffListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/CompareDiffListener.java
new file mode 100644
index 000000000..02e448576
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/CompareDiffListener.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * 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.client.listeners;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+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.ICVSFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.client.CommandOutputListener;
+
+/**
+ * This class interprets the output of "cvs diff --brief ..." in order to get the revisions
+ * of two compared versions of a project or folder.
+ */
+public class CompareDiffListener extends CommandOutputListener {
+
+ private static ServerMessageLineMatcher LOCAL_FILE_MATCHER;
+ private static ServerMessageLineMatcher REMOTE_FILE_MATCHER;
+ private static ServerMessageLineMatcher REVISION_LINE_MATCHER;
+
+ static {
+ try {
+ LOCAL_FILE_MATCHER = new ServerMessageLineMatcher(
+ "Index: (localFile:.*:localFile)", new String[] {"localFile"});
+ REMOTE_FILE_MATCHER = new ServerMessageLineMatcher(
+ "RCS file: (remoteFile:.*:remoteFile),v", new String[] {"remoteFile"});
+ REVISION_LINE_MATCHER = new ServerMessageLineMatcher(
+ "diff .* -r(leftRevision:.*:leftRevision) -r(rightRevision:.*:rightRevision)", new String[] {"leftRevision", "rightRevision"});
+ } catch (CVSException e) {
+ // This is serious as the listener will not function properly
+ CVSProviderPlugin.log(e);
+ LOCAL_FILE_MATCHER = null;
+ REMOTE_FILE_MATCHER = null;
+ REVISION_LINE_MATCHER = null;
+ }
+ }
+
+ private String localFilePath, remoteFilePath, leftRevision, rightRevision;
+
+ private IFileDiffListener listener;
+
+ public interface IFileDiffListener {
+ public void fileDiff(
+ String localFilePath,
+ String remoteFilePath,
+ String leftRevision,
+ String rightRevision);
+ }
+
+ public CompareDiffListener(IFileDiffListener listener) {
+ this.listener = listener;
+ }
+
+ public IStatus messageLine(
+ String line,
+ ICVSRepositoryLocation location,
+ ICVSFolder commandRoot,
+ IProgressMonitor monitor) {
+ // ignore any server messages
+ if (getServerMessage(line, location) != null) {
+ return OK;
+ }
+ Map map = LOCAL_FILE_MATCHER.processServerMessage(line);
+ if (map != null) {
+ localFilePath = (String)map.get("localFile");
+ return OK;
+ }
+ map = REMOTE_FILE_MATCHER.processServerMessage(line);
+ if (map != null) {
+ remoteFilePath = (String)map.get("remoteFile");
+ return OK;
+ }
+ map = REVISION_LINE_MATCHER.processServerMessage(line);
+ if (map != null) {
+ leftRevision = (String)map.get("leftRevision");
+ rightRevision = (String)map.get("rightRevision");
+ if (localFilePath == null || remoteFilePath == null) {
+ return new CVSStatus(IStatus.ERROR, "Unsupported message sequence received while comparing using CVS diff command");
+ }
+ listener.fileDiff(localFilePath, remoteFilePath, leftRevision, rightRevision);
+ localFilePath = remoteFilePath = leftRevision = rightRevision = null;
+ return OK;
+ }
+ // Ignore all other lines
+ return OK;
+ }
+
+ private IStatus handleUnknownDiffFormat(String line) {
+ return new CVSStatus(IStatus.ERROR, "Unknown message format received while comparing using CVS diff command: {0}" + line);
+ }
+
+ public IStatus errorLine(
+ String line,
+ ICVSRepositoryLocation location,
+ ICVSFolder commandRoot,
+ IProgressMonitor monitor) {
+ // ignore server messages for now - this is used only with the diff
+ // request and the errors can be safely ignored.
+ if (getServerMessage(line, location) != null) {
+ return OK;
+ }
+ return super.errorLine(line, location, commandRoot, monitor);
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/IMessagePatterns.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/IMessagePatterns.java
new file mode 100644
index 000000000..e3207ec7c
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/IMessagePatterns.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.client.listeners;
+
+import org.eclipse.team.internal.ccvs.core.util.Util;
+
+/**
+ * This class contains the default server message patterns
+ */
+public interface IMessagePatterns {
+
+ public static final String SERVER_MESSAGE_PREFIX = "\\w* \\w*: "; //$NON-NLS-1$
+ public static final String SERVER_ABORTED_MESSAGE_PREFIX = "\\w* [\\w* aborted]: "; //$NON-NLS-1$
+
+ // TODO: These patterns could be more specific but this would require non-capturing
+ // groups which currently throw off variable matching
+ public static final String TAG_PATTERN = "\\w*"; //$NON-NLS-1$
+ public static final String REVISION_PATTERN = ".*"; //$NON-NLS-1$
+ public static final String FILE_PATH_PATTERN = ".*"; //$NON-NLS-1$
+
+ // TODO: It would be better if the prefix was optional but this requires the use of a capturing group which throws the group count off
+ public static final String RDIFF_DIRECTORY = SERVER_MESSAGE_PREFIX + "Diffing " + Util.getVariablePattern(FILE_PATH_PATTERN, "remoteFolderPath"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String RDIFF_SUMMARY_FILE_DIFF = "File " + Util.getVariablePattern(FILE_PATH_PATTERN, "remoteFilePath") + " changed from revision " + Util.getVariablePattern(REVISION_PATTERN, "leftRevision") + " to " + Util.getVariablePattern(REVISION_PATTERN, "rightRevision"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ public static final String RDIFF_SUMMARY_NEW_FILE = "File " + Util.getVariablePattern(FILE_PATH_PATTERN, "remoteFilePath") + " is new; " + TAG_PATTERN + " revision " + Util.getVariablePattern(REVISION_PATTERN, "rightRevision"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ public static final String RDIFF_SUMMARY_DELETED_FILE = "File " + Util.getVariablePattern(FILE_PATH_PATTERN, "remoteFilePath") + " is removed; not included in release tag " + TAG_PATTERN; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ // This format was introduced in 1.11.7
+ public static final String RDIFF_SUMMARY_DELETED_FILE2 = "File " + Util.getVariablePattern(FILE_PATH_PATTERN, "remoteFilePath") + " is removed; " + TAG_PATTERN + " revision " + Util.getVariablePattern(REVISION_PATTERN, "leftRevision"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/RDiffSummaryListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/RDiffSummaryListener.java
new file mode 100644
index 000000000..29d2ec260
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/RDiffSummaryListener.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.ccvs.core.client.listeners;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.internal.ccvs.core.ICVSFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.client.CommandOutputListener;
+
+/**
+ * This class parses the messages recieved in response to an "cvs rdiff -s ..." command
+ */
+public class RDiffSummaryListener extends CommandOutputListener {
+
+ private static final String RIGHT_REVISION_VARIABLE_NAME = "rightRevision"; //$NON-NLS-1$
+ private static final String LEFT_REVISION_VARIABLE_NAME = "leftRevision"; //$NON-NLS-1$
+ private static final String REMOTE_FILE_PATH_VARIABLE_NAME = "remoteFilePath"; //$NON-NLS-1$
+ private static final String REMOTE_FOLDER_PATH_VARIABLE_NAME = "remoteFolderPath"; //$NON-NLS-1$
+
+ private IFileDiffListener listener;
+ private static ServerMessageLineMatcher DIRECTORY_MATCHER;
+ private static ServerMessageLineMatcher FILE_DIFF_MATCHER;
+ private static ServerMessageLineMatcher NEW_FILE_MATCHER;
+ private static ServerMessageLineMatcher DELETED_FILE_MATCHER;
+ private static ServerMessageLineMatcher DELETED_FILE_MATCHER2;
+
+ static {
+ // TODO: temprary until proper lifecycle is defined
+ initializePatterns();
+ }
+ public static void initializePatterns() {
+ try {
+ DIRECTORY_MATCHER = new ServerMessageLineMatcher(
+ IMessagePatterns.RDIFF_DIRECTORY, new String[] {REMOTE_FOLDER_PATH_VARIABLE_NAME});
+ FILE_DIFF_MATCHER = new ServerMessageLineMatcher(
+ IMessagePatterns.RDIFF_SUMMARY_FILE_DIFF, new String[] {REMOTE_FILE_PATH_VARIABLE_NAME, LEFT_REVISION_VARIABLE_NAME, RIGHT_REVISION_VARIABLE_NAME});
+ NEW_FILE_MATCHER = new ServerMessageLineMatcher(
+ IMessagePatterns.RDIFF_SUMMARY_NEW_FILE, new String[] {REMOTE_FILE_PATH_VARIABLE_NAME, RIGHT_REVISION_VARIABLE_NAME});
+ DELETED_FILE_MATCHER = new ServerMessageLineMatcher(
+ IMessagePatterns.RDIFF_SUMMARY_DELETED_FILE, new String[] {REMOTE_FILE_PATH_VARIABLE_NAME});
+ DELETED_FILE_MATCHER2 = new ServerMessageLineMatcher(
+ IMessagePatterns.RDIFF_SUMMARY_DELETED_FILE2, new String[] {REMOTE_FILE_PATH_VARIABLE_NAME, LEFT_REVISION_VARIABLE_NAME});
+ } catch (CVSException e) {
+ // This is serious as the listener will not function properly
+ CVSProviderPlugin.log(e);
+ }
+ }
+
+ public interface IFileDiffListener {
+ public void fileDiff(
+ String remoteFilePath,
+ String leftRevision,
+ String rightRevision);
+ public void newFile(
+ String remoteFilePath,
+ String rightRevision);
+ public void deletedFile(
+ String remoteFilePath,
+ String leftRevision);
+ public void directory(String remoteFolderPath);
+ }
+
+ public RDiffSummaryListener(IFileDiffListener listener) {
+ this.listener = listener;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener#messageLine(java.lang.String, org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation, org.eclipse.team.internal.ccvs.core.ICVSFolder, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus messageLine(
+ String line,
+ ICVSRepositoryLocation location,
+ ICVSFolder commandRoot,
+ IProgressMonitor monitor) {
+
+ Map variables = FILE_DIFF_MATCHER.processServerMessage(line);
+ if (variables != null) {
+ listener.fileDiff(
+ (String)variables.get(REMOTE_FILE_PATH_VARIABLE_NAME),
+ (String)variables.get(LEFT_REVISION_VARIABLE_NAME),
+ (String)variables.get(RIGHT_REVISION_VARIABLE_NAME));
+ return OK;
+ }
+
+ variables = NEW_FILE_MATCHER.processServerMessage(line);
+ if (variables != null) {
+ listener.newFile(
+ (String)variables.get(REMOTE_FILE_PATH_VARIABLE_NAME),
+ (String)variables.get(RIGHT_REVISION_VARIABLE_NAME));
+ return OK;
+ }
+
+ variables = DELETED_FILE_MATCHER.processServerMessage(line);
+ if (variables != null) {
+ listener.deletedFile(
+ (String)variables.get(REMOTE_FILE_PATH_VARIABLE_NAME),
+ null);
+ return OK;
+ }
+
+ variables = DELETED_FILE_MATCHER2.processServerMessage(line);
+ if (variables != null) {
+ listener.deletedFile(
+ (String)variables.get(REMOTE_FILE_PATH_VARIABLE_NAME),
+ (String)variables.get(LEFT_REVISION_VARIABLE_NAME));
+ return OK;
+ }
+
+ return super.messageLine(line, location, commandRoot, monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener#errorLine(java.lang.String, org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation, org.eclipse.team.internal.ccvs.core.ICVSFolder, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus errorLine(
+ String line,
+ ICVSRepositoryLocation location,
+ ICVSFolder commandRoot,
+ IProgressMonitor monitor) {
+
+ Map variables = DIRECTORY_MATCHER.processServerMessage(line);
+ if (variables != null) {
+ listener.directory(
+ (String)variables.get(REMOTE_FOLDER_PATH_VARIABLE_NAME));
+ return OK;
+ }
+
+ return super.errorLine(line, location, commandRoot, monitor);
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java
new file mode 100644
index 000000000..3e42ee1a6
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.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.internal.ccvs.core.client.listeners;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.util.Assert;
+import org.eclipse.team.internal.ccvs.core.Policy;
+
+/**
+ * This class extracts matches server lines to expected patterns and extracts
+ * required information from the line.
+ */
+public class ServerMessageLineMatcher {
+
+ protected static final Pattern VARIABLE_MATCHING_PATTERN = Pattern.compile("(\\((\\w*):.*:\\2\\))"); //$NON-NLS-1$
+
+ Pattern pattern;
+ String[] variables;
+
+ public ServerMessageLineMatcher(String template, String[] expectedVariables) throws CVSException {
+ // Extract the variable names from the template
+ Matcher matcher = VARIABLE_MATCHING_PATTERN.matcher(template);
+ List variables = new ArrayList();
+ while (matcher.find()) {
+ if (matcher.groupCount() != 2) {
+ throw new CVSException(Policy.bind("ServerMessageLineMatcher.5", template)); //$NON-NLS-1$
+ }
+ variables.add(matcher.group(2));
+ }
+ ensureMatches(template, variables, expectedVariables);
+ this.variables = (String[]) variables.toArray(new String[variables.size()]);
+
+ // Modify the template so it can be used to match message lines from the server
+ // (i.e. remove the variable markup)
+ for (Iterator iter = variables.iterator(); iter.hasNext();) {
+ String element = (String) iter.next();
+ template = template.replaceAll(element + ":", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ template = template.replaceAll(":" + element, ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ // Ensure that the number of groups in the pattern match the number of variables
+ int count = 0;
+ int start = -1;
+ while ((start = template.indexOf('(', start + 1)) != -1) {
+ count++;
+ }
+ if (count != variables.size()) {
+ throw new CVSException(Policy.bind("ServerMessageLineMatcher.6", template)); //$NON-NLS-1$
+ }
+
+ // Create the pattern fir matching lines from the server
+ this.pattern = Pattern.compile(template);
+ }
+
+ /*
+ * Throw an exception if the found variables do not match the expected variables
+ */
+ private void ensureMatches(String template, List variables, String[] expectedVariables) throws CVSException {
+ for (int i = 0; i < expectedVariables.length; i++) {
+ String expected = expectedVariables[i];
+ if (!variables.contains(expected)) {
+ throw new CVSException(Policy.bind("ServerMessageLineMatcher.7", expected, template)); //$NON-NLS-1$
+ }
+ }
+ }
+
+ public Map processServerMessage(String line) {
+ Matcher matcher = pattern.matcher(line);
+ if (!matcher.find()) return null;
+ Assert.isTrue(matcher.groupCount() == variables.length);
+ Map result = new HashMap();
+ for (int i = 1; i <= matcher.groupCount(); i++) {
+ result.put(variables[i - 1], matcher.group(i));
+ }
+ return result;
+ }
+
+ public boolean matches(String line) {
+ Matcher matcher = pattern.matcher(line);
+ return (matcher.find());
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/KnownRepositories.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/KnownRepositories.java
new file mode 100644
index 000000000..818a7ec60
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/KnownRepositories.java
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSStatus;
+import org.eclipse.team.internal.ccvs.core.ICVSListener;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.Policy;
+import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
+
+/**
+ * This class keeps track of the CVS repository locations that are known to
+ * the CVS plugin.
+ */
+public class KnownRepositories {
+
+ private List repositoryListeners = new ArrayList();
+ private Map repositories = new HashMap();
+
+ private static KnownRepositories instance;
+
+ public static synchronized KnownRepositories getInstance() {
+ if (instance == null) {
+ instance = new KnownRepositories();
+ }
+ return instance;
+ }
+
+ /*
+ * Private class used to safely notify listeners of resouce sync info changes.
+ * Subclass override the notify(IResourceStateChangeListener) method to
+ * fire specific events inside an ISafeRunnable.
+ */
+ private abstract class Notification implements ISafeRunnable {
+ private ICVSListener listener;
+ public void handleException(Throwable exception) {
+ // don't log the exception....it is already being logged in Platform#run
+ }
+ public void run(ICVSListener listener) {
+ this.listener = listener;
+ Platform.run(this);
+ }
+ public void run() throws Exception {
+ notify(listener);
+ }
+ /**
+ * Subsclasses overide this method to send an event safely to a lsistener
+ * @param listener
+ */
+ protected abstract void notify(ICVSListener listener);
+ }
+
+ /**
+ * Register to receive notification of repository creation and disposal
+ */
+ public void addRepositoryListener(ICVSListener listener) {
+ synchronized(repositoryListeners) {
+ repositoryListeners.add(listener);
+ }
+ }
+
+ /**
+ * De-register a listener
+ */
+ public void removeRepositoryListener(ICVSListener listener) {
+ synchronized(repositoryListeners) {
+ repositoryListeners.remove(listener);
+ }
+ }
+
+ private ICVSListener[] getListeners() {
+ synchronized(repositoryListeners) {
+ return (ICVSListener[]) repositoryListeners.toArray(new ICVSListener[repositoryListeners.size()]);
+ }
+ }
+
+ private void fireNotification(Notification notification) {
+ // Get a snapshot of the listeners so the list doesn't change while we're firing
+ ICVSListener[] listeners = getListeners();
+ // Notify each listener in a safe manner (i.e. so their exceptions don't kill us)
+ for (int i = 0; i < listeners.length; i++) {
+ ICVSListener listener = listeners[i];
+ notification.run(listener);
+ }
+ }
+
+ /*
+ * Add the repository location to the cached locations and notify listeners
+ */
+ private void addToRepositoriesCache(final ICVSRepositoryLocation repository) {
+ repositories.put(repository.getLocation(), repository);
+ fireNotification(new Notification() {
+ public void notify(ICVSListener listener) {
+ listener.repositoryAdded(repository);
+ }
+ });
+ }
+
+ /*
+ * Remove the repository location from the cached locations and notify listeners
+ */
+ private void removeFromRepositoriesCache(final ICVSRepositoryLocation repository) {
+ if (repositories.remove(repository.getLocation()) != null) {
+ fireNotification(new Notification() {
+ public void notify(ICVSListener listener) {
+ listener.repositoryRemoved(repository);
+ }
+ });
+ }
+ }
+
+ /**
+ * Create a repository instance from the given properties.
+ * The supported properties are:
+ *
+ * connection The connection method to be used
+ * user The username for the connection
+ * password The password used for the connection (optional)
+ * host The host where the repository resides
+ * port The port to connect to (optional)
+ * root The server directory where the repository is located
+ *
+ * The created instance is not known by the provider and it's user information is not cached.
+ * The purpose of the created location is to allow connection validation before adding the
+ * location to the provider.
+ *
+ * This method will throw a CVSException if the location for the given configuration already
+ * exists.
+ */
+ public ICVSRepositoryLocation createRepository(Properties configuration) throws CVSException {
+ // Create a new repository location
+ CVSRepositoryLocation location = CVSRepositoryLocation.fromProperties(configuration);
+
+ // Check the cache for an equivalent instance and if there is one, throw an exception
+ CVSRepositoryLocation existingLocation = (CVSRepositoryLocation)repositories.get(location.getLocation());
+ if (existingLocation != null) {
+ throw new CVSException(new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSProvider.alreadyExists"))); //$NON-NLS-1$
+ }
+
+ return location;
+ }
+
+ /**
+ * Add the repository to the receiver's list of known repositories. Doing this will enable
+ * password caching accross platform invokations.
+ */
+ public void addRepository(ICVSRepositoryLocation repository) throws CVSException {
+ // Check the cache for an equivalent instance and if there is one, just update the cache
+ CVSRepositoryLocation existingLocation = (CVSRepositoryLocation)repositories.get(repository.getLocation());
+ if (existingLocation != null) {
+ ((CVSRepositoryLocation)repository).updateCache();
+ } else {
+ // Cache the password and register the repository location
+ addToRepositoriesCache(repository);
+ ((CVSRepositoryLocation)repository).updateCache();
+ }
+ }
+
+ /**
+ * Dispose of the repository location
+ *
+ * Removes any cached information about the repository such as a remembered password.
+ */
+ public void disposeRepository(ICVSRepositoryLocation repository) throws CVSException {
+ ((CVSRepositoryLocation)repository).dispose();
+ removeFromRepositoriesCache(repository);
+ }
+
+ /**
+ * Answer whether the provided repository location is known by the provider or not.
+ * The location string corresponds to the Strin returned by ICVSRepositoryLocation#getLocation()
+ */
+ public boolean isKnownRepository(String location) {
+ return repositories.get(location) != null;
+ }
+
+ /**
+ * Return a list of the know repository locations
+ */
+ public ICVSRepositoryLocation[] getKnownRepositories() {
+ return (ICVSRepositoryLocation[])repositories.values().toArray(new ICVSRepositoryLocation[repositories.size()]);
+ }
+
+ /**
+ * Get the repository instance which matches the given String. The format of the String is
+ * the same as that returned by ICVSRepositoryLocation#getLocation().
+ * The format is:
+ *
+ * connection:user[:password]@host[#port]:root
+ *
+ * where [] indicates optional and the identier meanings are:
+ *
+ * connection The connection method to be used
+ * user The username for the connection
+ * password The password used for the connection (optional)
+ * host The host where the repository resides
+ * port The port to connect to (optional)
+ * root The server directory where the repository is located
+ *
+ * It is expected that the instance requested by using this method exists.
+ * If the repository location does not exist, it will be automatically created
+ * and cached with the provider.
+ *
+ * WARNING: Providing the password as part of the String will result in the password being part
+ * of the location permanently. This means that it cannot be modified by the authenticator.
+ */
+ public ICVSRepositoryLocation getRepository(String location) throws CVSException {
+ ICVSRepositoryLocation repository = (ICVSRepositoryLocation)repositories.get(location);
+ if (repository == null) {
+ repository = CVSRepositoryLocation.fromString(location);
+ addToRepositoriesCache(repository);
+ }
+ return repository;
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceStateChangeListeners.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceStateChangeListeners.java
new file mode 100644
index 000000000..f82af1cad
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceStateChangeListeners.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener;
+
+/**
+ * Class that manages the listeners of CVS sync change notification
+ */
+public class ResourceStateChangeListeners {
+
+ private static List listeners = new ArrayList();
+
+ private static ResourceStateChangeListeners instance;
+
+ public static synchronized ResourceStateChangeListeners getListener() {
+ if (instance == null) {
+ instance = new ResourceStateChangeListeners();
+ }
+ return instance;
+ }
+
+ /*
+ * Private class used to safely notify listeners of resouce sync info changes.
+ * Subclass override the notify(IResourceStateChangeListener) method to
+ * fire specific events inside an ISafeRunnable.
+ */
+ private abstract class Notification implements ISafeRunnable {
+ private IResourceStateChangeListener listener;
+ public void handleException(Throwable exception) {
+ // don't log the exception....it is already being logged in Platform#run
+ }
+ public void run(IResourceStateChangeListener listener) {
+ this.listener = listener;
+ Platform.run(this);
+ }
+ public void run() throws Exception {
+ notify(listener);
+ }
+ /**
+ * Subsclasses overide this method to send an event safely to a lsistener
+ * @param listener
+ */
+ protected abstract void notify(IResourceStateChangeListener listener);
+ }
+
+ private IResourceStateChangeListener[] getListeners() {
+ synchronized(listeners) {
+ return (IResourceStateChangeListener[]) listeners.toArray(new IResourceStateChangeListener[listeners.size()]);
+ }
+ }
+
+ private void fireNotification(Notification notification) {
+ // Get a snapshot of the listeners so the list doesn't change while we're firing
+ IResourceStateChangeListener[] listeners = getListeners();
+ // Notify each listener in a safe manner (i.e. so their exceptions don't kill us)
+ for (int i = 0; i < listeners.length; i++) {
+ IResourceStateChangeListener listener = listeners[i];
+ notification.run(listener);
+ }
+ }
+
+ public void addResourceStateChangeListener(IResourceStateChangeListener listener) {
+ synchronized(listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeResourceStateChangeListener(IResourceStateChangeListener listener) {
+ synchronized(listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ public void resourceSyncInfoChanged(final IResource[] resources) {
+ fireNotification(new Notification() {
+ public void notify(IResourceStateChangeListener listener) {
+ listener.resourceSyncInfoChanged(resources);
+ }
+ });
+ }
+
+ public void externalSyncInfoChange(final IResource[] resources) {
+ fireNotification(new Notification() {
+ public void notify(IResourceStateChangeListener listener) {
+ listener.externalSyncInfoChange(resources);
+ }
+ });
+ }
+
+ public void resourceModified(final IResource[] resources) {
+ fireNotification(new Notification() {
+ public void notify(IResourceStateChangeListener listener) {
+ listener.resourceModified(resources);
+ }
+ });
+ }
+ public void projectConfigured(final IProject project) {
+ fireNotification(new Notification() {
+ public void notify(IResourceStateChangeListener listener) {
+ listener.projectConfigured(project);
+ }
+ });
+ }
+ public void projectDeconfigured(final IProject project) {
+ fireNotification(new Notification() {
+ public void notify(IResourceStateChangeListener listener) {
+ listener.projectDeconfigured(project);
+ }
+ });
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java
new file mode 100644
index 000000000..bc4255e11
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * 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.operations;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.compare.CompareUI;
+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.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+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.ICVSRemoteFile;
+import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
+import org.eclipse.team.internal.ccvs.core.ICVSResource;
+import org.eclipse.team.internal.ccvs.core.client.Command;
+import org.eclipse.team.internal.ccvs.core.client.RDiff;
+import org.eclipse.team.internal.ccvs.core.client.Session;
+import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
+import org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener;
+import org.eclipse.team.internal.ccvs.core.resources.FileContentCachingService;
+import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
+import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree;
+import org.eclipse.team.internal.ccvs.core.util.Assert;
+import org.eclipse.team.internal.ccvs.ui.CVSCompareEditorInput;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.ResourceEditionNode;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * Compare the two versions of given remote folders obtained from the two tags specified.
+ */
+public class RemoteCompareOperation extends RemoteOperation implements RDiffSummaryListener.IFileDiffListener {
+
+ private CVSTag left;
+ private CVSTag right;
+
+ private RemoteFolderTree leftTree, rightTree;
+
+ /**
+ * Compare two versions of the given remote resource.
+ * @param shell
+ * @param remoteResource the resource whose tags are being compared
+ * @param left the earlier tag (not null)
+ * @param right the later tag (not null)
+ */
+ public RemoteCompareOperation(Shell shell, ICVSRemoteResource remoteResource, CVSTag tag) {
+ super(shell, new ICVSRemoteResource[] {remoteResource});
+ Assert.isNotNull(tag);
+ this.right = tag;
+ if (remoteResource.isContainer()) {
+ this.left = ((ICVSRemoteFolder)remoteResource).getTag();
+ } else {
+ try {
+ this.left = remoteResource.getSyncInfo().getTag();
+ } catch (CVSException e) {
+ // This shouldn't happen but log it just in case
+ CVSProviderPlugin.log(e);
+ }
+ }
+ if (this.left == null) {
+ this.left = CVSTag.DEFAULT;
+ }
+ }
+
+ /*
+ * This command only supports the use of a single resource
+ */
+ private ICVSRemoteResource getRemoteResource() {
+ return getRemoteResources()[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected void execute(IProgressMonitor monitor) throws CVSException {
+ leftTree = rightTree = null;
+ boolean fetchContents = CVSUIPlugin.getPlugin().getPluginPreferences().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS);
+ monitor.beginTask(getTaskName(), 50 + (fetchContents ? 100 : 0));
+ try {
+ ICVSRemoteResource resource = getRemoteResource();
+ IStatus status = buildTrees(resource, Policy.subMonitorFor(monitor, 50));
+ if (status.isOK() && fetchContents) {
+ String[] overlappingFilePaths = getOverlappingFilePaths();
+ if (overlappingFilePaths.length > 0) {
+ fetchFileContents(leftTree, overlappingFilePaths, Policy.subMonitorFor(monitor, 50));
+ fetchFileContents(rightTree, overlappingFilePaths, Policy.subMonitorFor(monitor, 50));
+ }
+ }
+ collectStatus(status);
+ openCompareEditor(leftTree, rightTree);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ private String[] getOverlappingFilePaths() {
+ String[] leftFiles = getFilePaths(leftTree);
+ String[] rightFiles = getFilePaths(rightTree);
+ Set set = new HashSet();
+ for (int i = 0; i < rightFiles.length; i++) {
+ String rightFile = rightFiles[i];
+ for (int j = 0; j < leftFiles.length; j++) {
+ String leftFile = leftFiles[j];
+ if (leftFile.equals(rightFile)) {
+ set.add(leftFile);
+ }
+ }
+ }
+ return (String[]) set.toArray(new String[set.size()]);
+ }
+
+ private void fetchFileContents(RemoteFolderTree tree, String[] overlappingFilePaths, IProgressMonitor monitor) throws CVSException {
+ FileContentCachingService.fetchFileContents(tree, overlappingFilePaths, monitor);
+ }
+
+ private String[] getFilePaths(RemoteFolderTree tree) {
+ ICVSRemoteResource[] children = tree.getChildren();
+ List result = new ArrayList();
+ for (int i = 0; i < children.length; i++) {
+ ICVSRemoteResource resource = children[i];
+ if (resource.isContainer()) {
+ result.addAll(Arrays.asList(getFilePaths((RemoteFolderTree)resource)));
+ } else {
+ result.add(resource.getRepositoryRelativePath());
+ }
+ }
+ return (String[]) result.toArray(new String[result.size()]);
+ }
+
+ /*
+ * Build the two trees uses the reponses from "cvs rdiff -s ...".
+ */
+ private IStatus buildTrees(ICVSRemoteResource resource, IProgressMonitor monitor) throws CVSException {
+ // Initialize the resulting trees
+ leftTree = new RemoteFolderTree(null, resource.getRepository(), ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, left);
+ rightTree = new RemoteFolderTree(null, resource.getRepository(), ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, right);
+ Command.QuietOption oldOption= CVSProviderPlugin.getPlugin().getQuietness();
+ Session session = new Session(resource.getRepository(), leftTree, false);
+ try {
+ monitor.beginTask(getTaskName(), 100);
+ CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
+ session.open(Policy.subMonitorFor(monitor, 10));
+ IStatus status = Command.RDIFF.execute(session,
+ Command.NO_GLOBAL_OPTIONS,
+ getLocalOptions(),
+ new ICVSResource[] { resource },
+ new RDiffSummaryListener(this),
+ Policy.subMonitorFor(monitor, 90));
+ return status;
+ } finally {
+ try {
+ session.close();
+ } finally {
+ CVSProviderPlugin.getPlugin().setQuietness(oldOption);
+ }
+ monitor.done();
+ }
+ }
+
+ private LocalOption[] getLocalOptions() {
+ return new LocalOption[] {RDiff.SUMMARY, RDiff.makeTagOption(left), RDiff.makeTagOption(right)};
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
+ */
+ protected String getTaskName() {
+ return Policy.bind("RemoteCompareOperation.0", new Object[] {left.getName(), right.getName(), getRemoteResource().getRepositoryRelativePath()}); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#fileDiff(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void fileDiff(String remoteFilePath, String leftRevision, String rightRevision) {
+ try {
+ addFile(rightTree, right, new Path(remoteFilePath), rightRevision);
+ } catch (CVSException e) {
+ CVSUIPlugin.log(e);
+ }
+ try {
+ addFile(leftTree, left, new Path(remoteFilePath), leftRevision);
+ } catch (CVSException e) {
+ CVSUIPlugin.log(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#newFile(java.lang.String, java.lang.String)
+ */
+ public void newFile(String remoteFilePath, String rightRevision) {
+ try {
+ addFile(rightTree, right, new Path(remoteFilePath), rightRevision);
+ } catch (CVSException e) {
+ CVSUIPlugin.log(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#deletedFile(java.lang.String)
+ */
+ public void deletedFile(String remoteFilePath, String leftRevision) {
+ // The leftRevision may be null in which case the tag is used
+ try {
+ addFile(leftTree, left, new Path(remoteFilePath), leftRevision);
+ } catch (CVSException e) {
+ CVSUIPlugin.log(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#directory(java.lang.String)
+ */
+ public void directory(String remoteFolderPath) {
+ try {
+ getFolder(leftTree, left, new Path(remoteFolderPath), Path.EMPTY);
+ } catch (CVSException e) {
+ CVSUIPlugin.log(e);
+ }
+ try {
+ getFolder(rightTree, right, new Path(remoteFolderPath), Path.EMPTY);
+ } catch (CVSException e) {
+ CVSUIPlugin.log(e);
+ }
+ }
+
+ /*
+ * Get the folder at the given path in the given tree, creating any missing folders as needed.
+ */
+ private ICVSRemoteFolder getFolder(RemoteFolderTree tree, CVSTag tag, IPath remoteFolderPath, IPath parentPath) throws CVSException {
+ if (remoteFolderPath.segmentCount() == 0) return tree;
+ String name = remoteFolderPath.segment(0);
+ ICVSResource child;
+ IPath childPath = parentPath.append(name);
+ if (tree.childExists(name)) {
+ child = tree.getChild(name);
+ } else {
+ child = new RemoteFolderTree(tree, tree.getRepository(), childPath.toString(), tag);
+ ((RemoteFolderTree)child).setChildren(new ICVSRemoteResource[0]);
+ addChild(tree, (ICVSRemoteResource)child);
+ }
+ return getFolder((RemoteFolderTree)child, tag, remoteFolderPath.removeFirstSegments(1), childPath);
+ }
+
+ private void addChild(RemoteFolderTree tree, ICVSRemoteResource resource) {
+ ICVSRemoteResource[] children = tree.getChildren();
+ ICVSRemoteResource[] newChildren;
+ if (children == null) {
+ newChildren = new ICVSRemoteResource[] { resource };
+ } else {
+ newChildren = new ICVSRemoteResource[children.length + 1];
+ System.arraycopy(children, 0, newChildren, 0, children.length);
+ newChildren[children.length] = resource;
+ }
+ tree.setChildren(newChildren);
+ }
+
+ private void addFile(RemoteFolderTree tree, CVSTag tag, Path filePath, String revision) throws CVSException {
+ RemoteFolderTree parent = (RemoteFolderTree)getFolder(tree, tag, filePath.removeLastSegments(1), Path.EMPTY);
+ String name = filePath.lastSegment();
+ ICVSRemoteFile file = new RemoteFile(parent, 0, name, revision, null, tag);
+ addChild(parent, file);
+ }
+
+ /*
+ * Only intended to be overridden by test cases.
+ */
+ protected void openCompareEditor(final ICVSRemoteFolder leftTree, final ICVSRemoteFolder rightTree) {
+ if (leftTree == null || rightTree == null) return;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ CompareUI.openCompareEditorOnPage(
+ new CVSCompareEditorInput(new ResourceEditionNode(leftTree), new ResourceEditionNode(rightTree)),
+ getTargetPage());
+ }
+ });
+ }
+
+ protected IWorkbenchPage getTargetPage() {
+ return TeamUIPlugin.getActivePage();
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif
new file mode 100644
index 000000000..9dd4d8300
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif
Binary files differ
diff --git a/tests/org.eclipse.team.tests.core/.classpath b/tests/org.eclipse.team.tests.core/.classpath
new file mode 100644
index 000000000..0a2181aab
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/.classpath
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="src" path="/org.eclipse.core.tests.harness"/>
+ <classpathentry kind="src" path="/org.eclipse.core.resources"/>
+ <classpathentry kind="src" path="/org.eclipse.team.core"/>
+ <classpathentry kind="src" path="/org.eclipse.team.ui"/>
+ <classpathentry kind="src" path="/org.eclipse.compare"/>
+ <classpathentry kind="src" path="/org.eclipse.ui"/>
+ <classpathentry kind="src" path="/org.junit"/>
+ <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/>
+ <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
+ <classpathentry kind="src" path="/org.eclipse.core.boot"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.team.tests.core/.project b/tests/org.eclipse.team.tests.core/.project
new file mode 100644
index 000000000..d596c9870
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/.project
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.team.tests.core</name>
+ <comment></comment>
+ <projects>
+ <project>org.eclipse.compare</project>
+ <project>org.eclipse.core.boot</project>
+ <project>org.eclipse.core.resources</project>
+ <project>org.eclipse.core.runtime</project>
+ <project>org.eclipse.core.tests.harness</project>
+ <project>org.eclipse.team.core</project>
+ <project>org.eclipse.team.ui</project>
+ <project>org.eclipse.ui</project>
+ <project>org.junit</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.team.tests.core/build.properties b/tests/org.eclipse.team.tests.core/build.properties
new file mode 100644
index 000000000..926d9a39d
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/build.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# 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
+###############################################################################
+source.teamtests.jar=src/
+bin.includes=about.html,plugin.xml,*.jar,test.xml \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.core/plugin.xml b/tests/org.eclipse.team.tests.core/plugin.xml
new file mode 100644
index 000000000..a11a75dcd
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/plugin.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin
+ id="org.eclipse.team.tests.core"
+ name="Eclipse Team Core Tests"
+ version="3.0.0"
+ provider-name="Eclipse.org"
+ class="">
+
+ <runtime>
+ <library name="teamtests.jar">
+ <export name="*"/>
+ <packages prefixes="org.eclipse.team.tests.core"/>
+ </library>
+ </runtime>
+ <requires>
+ <import plugin="org.eclipse.core.tests.harness"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.boot"/>
+ <import plugin="org.eclipse.team.core"/>
+ <import plugin="org.eclipse.team.cvs.core"/>
+ <import plugin="org.eclipse.team.ui"/>
+ <import plugin="org.eclipse.team.cvs.ui"/>
+ <import plugin="org.eclipse.compare"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.junit"/>
+ </requires>
+
+
+ <extension
+ point="org.eclipse.core.tests.harness.tests">
+ <test
+ id="team.all">
+ <run
+ class="org.eclipse.team.tests.core.RepositoryProviderTests">
+ </run>
+ </test>
+ </extension>
+ <extension
+ point="org.eclipse.core.tests.harness.tests">
+ <test
+ id="target.all">
+ <run
+ class="org.eclipse.team.tests.core.TargetProviderTests">
+ </run>
+ </test>
+ </extension>
+ <extension
+ point="org.eclipse.core.tests.harness.tests">
+ <test
+ id="team.ftp">
+ <run
+ class="org.eclipse.team.tests.ftp.ClientTest">
+ </run>
+ </test>
+ </extension>
+<!-- *************** Repository Providers **************** -->
+ <extension
+ point="org.eclipse.team.core.repository">
+ <repository
+ class="org.eclipse.team.tests.core.RepositoryProviderBic"
+ id="org.eclipse.team.tests.core.bic-provider">
+ </repository>
+ </extension>
+ <extension
+ point="org.eclipse.team.core.repository">
+ <repository
+ class="org.eclipse.team.tests.core.RepositoryProviderNaish"
+ id="org.eclipse.team.tests.core.naish-provider">
+ </repository>
+ </extension>
+<!-- *************** Bad provider that is not registered ****************
+ <extension
+ point="org.eclipse.team.core.repository">
+ <repository
+ id="org.eclipse.team.tests.core.other"
+ class="org.eclipse.team.tests.core.RepositoryProviderOtherSport">
+ </repository>
+ </extension>
+ -->
+ <extension
+ point="org.eclipse.team.core.repository">
+ <repository
+ class="org.eclipse.team.tests.core.RepositoryProviderWithLinking"
+ id="org.eclipse.team.tests.core.linking">
+ </repository>
+ </extension>
+
+</plugin>
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java
new file mode 100644
index 000000000..1738eead5
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/AllTeamTests.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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.tests.core;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.core.tests.harness.EclipseWorkspaceTest;
+
+public class AllTeamTests extends EclipseWorkspaceTest {
+
+ /**
+ * Constructor for CVSClientTest.
+ */
+ public AllTeamTests() {
+ super();
+ }
+
+ /**
+ * Constructor for CVSClientTest.
+ * @param name
+ */
+ public AllTeamTests(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.addTest(RepositoryProviderTests.suite());
+ suite.addTest(StreamTests.suite());
+ return suite;
+ }
+}
+
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java
new file mode 100644
index 000000000..3370456bb
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * 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.tests.core;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.tests.harness.EclipseWorkspaceTest;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.sync.IRemoteResource;
+
+public class TeamTest extends EclipseWorkspaceTest {
+ protected static IProgressMonitor DEFAULT_MONITOR = new NullProgressMonitor();
+ protected static final IProgressMonitor DEFAULT_PROGRESS_MONITOR = new NullProgressMonitor();
+
+
+ public TeamTest() {
+ super();
+ }
+ public TeamTest(String name) {
+ super(name);
+ }
+
+ protected IProject getNamedTestProject(String name) throws CoreException {
+ IProject target = getWorkspace().getRoot().getProject(name);
+ if (!target.exists()) {
+ target.create(null);
+ target.open(null);
+ }
+ assertExistsInFileSystem(target);
+ return target;
+ }
+
+ protected IProject getUniqueTestProject(String prefix) throws CoreException {
+ // manage and share with the default stream create by this class
+ return getNamedTestProject(prefix + "-" + Long.toString(System.currentTimeMillis()));
+ }
+
+ protected IStatus getTeamTestStatus(int severity) {
+ return new Status(severity, "org.eclipse.team.tests.core", 0, "team status", null);
+ }
+
+ /**
+ * Creates filesystem 'resources' with the given names and fills them with random text.
+ * @param container An object that can hold the newly created resources.
+ * @param hierarchy A list of files & folder names to use as resources
+ * @param includeContainer A flag that controls whether the container is included in the list of resources.
+ * @return IResource[] An array of resources filled with variable amounts of random text
+ * @throws CoreException
+ */
+ public IResource[] buildResources(IContainer container, String[] hierarchy, boolean includeContainer) throws CoreException {
+ List resources = new ArrayList(hierarchy.length + 1);
+ if (includeContainer)
+ resources.add(container);
+ resources.addAll(Arrays.asList(buildResources(container, hierarchy)));
+ IResource[] result = (IResource[]) resources.toArray(new IResource[resources.size()]);
+ ensureExistsInWorkspace(result, true);
+ for (int i = 0; i < result.length; i++) {
+ if (result[i].getType() == IResource.FILE) // 3786 bytes is the average size of Eclipse Java files!
+ ((IFile) result[i]).setContents(getRandomContents(100), true, false, null);
+ }
+ return result;
+ }
+ public IResource[] buildEmptyResources(IContainer container, String[] hierarchy, boolean includeContainer) throws CoreException {
+ List resources = new ArrayList(hierarchy.length + 1);
+ resources.addAll(Arrays.asList(buildResources(container, hierarchy)));
+ if (includeContainer)
+ resources.add(container);
+ IResource[] result = (IResource[]) resources.toArray(new IResource[resources.size()]);
+ ensureExistsInWorkspace(result, true);
+ return result;
+ }
+ /**
+ * Creates an InputStream filled with random text in excess of a specified minimum.
+ * @param sizeAtLeast The minimum number of chars to fill the input stream with.
+ * @return InputStream The input stream containing random text.
+ */
+ protected static InputStream getRandomContents(int sizeAtLeast) {
+ StringBuffer randomStuff = new StringBuffer(sizeAtLeast + 100);
+ while (randomStuff.length() < sizeAtLeast) {
+ randomStuff.append(getRandomSnippet());
+ }
+ return new ByteArrayInputStream(randomStuff.toString().getBytes());
+ }
+ /**
+ * Produces a random chunk of text from a finite collection of pre-written phrases.
+ * @return String Some random words.
+ */
+ public static String getRandomSnippet() {
+ switch ((int) Math.round(Math.random() * 10)) {
+ case 0 :
+ return "este e' o meu conteudo (portuguese)";
+ case 1 :
+ return "Dann brauchen wir aber auch einen deutschen Satz!";
+ case 2 :
+ return "I'll be back";
+ case 3 :
+ return "don't worry, be happy";
+ case 4 :
+ return "there is no imagination for more sentences";
+ case 5 :
+ return "customize yours";
+ case 6 :
+ return "foo";
+ case 7 :
+ return "bar";
+ case 8 :
+ return "foobar";
+ case 9 :
+ return "case 9";
+ default :
+ return "these are my contents";
+ }
+ }
+
+
+ public void sleep(int ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (InterruptedException e) {
+ System.err.println("Testing was rudely interrupted.");
+ }
+ }
+
+ // Assert that the two containers have equal contents
+ protected void assertEquals(IRemoteResource container1, IResource container2) throws CoreException, TeamException {
+ if (container2.getType() == IResource.FILE) {
+ // Ignore .project file
+ if (container2.getName().equals(".project"))
+ return;
+ assertTrue(compareContent(container1.getContents(DEFAULT_MONITOR), ((IFile) container2).getContents()));
+ } else {
+ IRemoteResource[] remoteResources = container1.members(DEFAULT_MONITOR);
+ IResource[] localResources = ((IFolder) container2).members();
+ for (int i = 0; i < localResources.length; i++) {
+ assertEquals(remoteResources[i], localResources[i]);
+ }
+ }
+ }
+
+ public void appendText(IResource resource, String text, boolean prepend) throws CoreException, IOException {
+ IFile file = (IFile) resource;
+ InputStream in = file.getContents();
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ if (prepend) {
+ bos.write(text.getBytes());
+ }
+ int i;
+ while ((i = in.read()) != -1) {
+ bos.write(i);
+ }
+ if (!prepend) {
+ bos.write(text.getBytes());
+ }
+ } finally {
+ in.close();
+ }
+ file.setContents(new ByteArrayInputStream(bos.toByteArray()), false, false, DEFAULT_MONITOR);
+ }
+ /*
+ * Get the resources for the given resource names
+ */
+ public IResource[] getResources(IContainer container, String[] hierarchy) throws CoreException {
+ IResource[] resources = new IResource[hierarchy.length];
+ for (int i=0;i<resources.length;i++) {
+ resources[i] = container.findMember(hierarchy[i]);
+ if (resources[i] == null) {
+ resources[i] = buildResources(container, new String[] {hierarchy[i]})[0];
+ }
+ }
+ return resources;
+ }
+
+ // Assert that the two containers have equal contents
+ protected void assertEquals(IContainer container1, IContainer container2) throws CoreException {
+ assertEquals(container1.getName(), container2.getName());
+ List members1 = new ArrayList();
+ members1.addAll(Arrays.asList(container1.members()));
+
+ List members2 = new ArrayList();
+ members2.addAll(Arrays.asList(container2.members()));
+
+ assertTrue(members1.size() == members2.size());
+ for (int i=0;i<members1.size();i++) {
+ IResource member1 = (IResource)members1.get(i);
+ IResource member2 = container2.findMember(member1.getName());
+ assertNotNull(member2);
+ assertEquals(member1, member2);
+ }
+ }
+
+ // Assert that the two files have equal contents
+ protected void assertEquals(IFile file1, IFile file2) throws CoreException {
+ assertEquals(file1.getName(), file2.getName());
+ assertTrue(compareContent(file1.getContents(), file2.getContents()));
+ }
+
+ // Assert that the two projects have equal contents ignoreing the project name
+ // and the .vcm_meta file
+ protected void assertEquals(IProject container1, IProject container2) throws CoreException {
+ List members1 = new ArrayList();
+ members1.addAll(Arrays.asList(container1.members()));
+ members1.remove(container1.findMember(".project"));
+
+ List members2 = new ArrayList();
+ members2.addAll(Arrays.asList(container2.members()));
+ members2.remove(container2.findMember(".project"));
+
+ assertTrue("Number of children differs for " + container1.getFullPath(), members1.size() == members2.size());
+ for (int i=0;i<members1.size();i++) {
+ IResource member1 = (IResource)members1.get(i);
+ IResource member2 = container2.findMember(member1.getName());
+ assertNotNull(member2);
+ assertEquals(member1, member2);
+ }
+ }
+ protected void assertEquals(IResource resource1, IResource resource2) throws CoreException {
+ assertEquals(resource1.getType(), resource2.getType());
+ if (resource1.getType() == IResource.FILE)
+ assertEquals((IFile)resource1, (IFile)resource2);
+ else
+ assertEquals((IContainer)resource1, (IContainer)resource2);
+ }
+}
diff --git a/tests/org.eclipse.team.tests.core/test.xml b/tests/org.eclipse.team.tests.core/test.xml
new file mode 100644
index 000000000..3418c9378
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/test.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+
+<project name="Team Automated Tests" default="run" basedir=".">
+
+ <!-- The property ${eclipse-home} should be passed into this script -->
+
+ <!-- sets the properties eclipse-home, and library-file -->
+ <property name="eclipse-home" value="${basedir}/../../"/>
+ <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>
+ <property name="org.eclipse.team.tests.core" value="org.eclipse.team.tests.core"/>
+ <property name="team-home" value="${eclipse-home}/plugins/${org.eclipse.team.tests.core}"/>
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp/>
+ </target>
+
+ <!-- This target defines the tests that need to be run. -->
+ <target name="suite">
+ <property name="location" value="${eclipse-home}/team_test_workspace"/>
+ <delete dir="${location}" quiet="true"/>
+
+ <!-- Session Test ** Team Core ** -->
+ <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${location}"/>
+ <property name="plugin-name" value="org.eclipse.team.tests.core"/>
+ <property name="classname" value="org.eclipse.team.tests.core.AllTeamTests"/>
+ </ant>
+
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after the tests -->
+ <!-- have been run. You can use this to delete temporary files that are created. -->
+ <target name="cleanup">
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen after all -->
+ <!-- the tests have been run should go here. -->
+ <target name="run" depends="init,suite,cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org*.xml"/>
+ <property name="output-file" value="org.eclipse.team.tests.core.xml"/>
+ </ant>
+ </target>
+
+</project>

Back to the top