View | Details | Raw Unified | Return to bug 41929 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/team/internal/ccvs/core/CVSMessages.java (+2 lines)
Lines 166-171 Link Here
166
    public static String CVSRepositoryLocation_hostRequired;
166
    public static String CVSRepositoryLocation_hostRequired;
167
    public static String CVSRepositoryLocation_rootRequired;
167
    public static String CVSRepositoryLocation_rootRequired;
168
    public static String CVSRepositoryLocation_noAuthenticator;
168
    public static String CVSRepositoryLocation_noAuthenticator;
169
    public static String CVSRepositoryLocation_mixedRepository;
169
170
170
	public static String Util_timeout;
171
	public static String Util_timeout;
171
	public static String Util_processTimeout;
172
	public static String Util_processTimeout;
Lines 189-194 Link Here
189
	public static String CVSProvider_Scrubbing_projects_1;
190
	public static String CVSProvider_Scrubbing_projects_1;
190
	public static String CVSProvider_Creating_projects_2;
191
	public static String CVSProvider_Creating_projects_2;
191
192
193
	public static String Resource_not_in_CVS;
192
	public static String EclipseFile_Problem_deleting_resource;
194
	public static String EclipseFile_Problem_deleting_resource;
193
	public static String EclipseFile_Problem_accessing_resource;
195
	public static String EclipseFile_Problem_accessing_resource;
194
	public static String EclipseFile_Problem_writing_resource;
196
	public static String EclipseFile_Problem_writing_resource;
(-)src/org/eclipse/team/internal/ccvs/core/CVSStatus.java (+10 lines)
Lines 11-16 Link Here
11
package org.eclipse.team.internal.ccvs.core;
11
package org.eclipse.team.internal.ccvs.core;
12
 
12
 
13
import org.eclipse.core.resources.IResource;
13
import org.eclipse.core.resources.IResource;
14
import org.eclipse.core.runtime.IPath;
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.osgi.util.NLS;
16
import org.eclipse.osgi.util.NLS;
16
import org.eclipse.team.core.TeamStatus;
17
import org.eclipse.team.core.TeamStatus;
Lines 45-50 Link Here
45
46
46
	// Path for resource related status
47
	// Path for resource related status
47
	private ICVSFolder commandRoot;
48
	private ICVSFolder commandRoot;
49
	private IPath commandPath;
48
	// Server information
50
	// Server information
49
	private ICVSRepositoryLocation cvsLocation;
51
	private ICVSRepositoryLocation cvsLocation;
50
52
Lines 65-70 Link Here
65
		this(severity, code, message, null, resource);
67
		this(severity, code, message, null, resource);
66
	}	
68
	}	
67
	
69
	
70
	public CVSStatus(int severity, int code, String message, IPath path) {
71
		this(severity, code, message, null, (IResource) null);
72
		commandPath = path;
73
	}
74
68
	public CVSStatus(int severity, int code, String message, Throwable t, ICVSFolder commandRoot) {
75
	public CVSStatus(int severity, int code, String message, Throwable t, ICVSFolder commandRoot) {
69
		super(severity, CVSProviderPlugin.ID, code, message, t, null);
76
		super(severity, CVSProviderPlugin.ID, code, message, t, null);
70
		this.commandRoot = commandRoot;
77
		this.commandRoot = commandRoot;
Lines 94-99 Link Here
94
		if (commandRoot != null) {
101
		if (commandRoot != null) {
95
			message = NLS.bind(CVSMessages.CVSStatus_messageWithRoot, new String[] { commandRoot.getName(), message }); 
102
			message = NLS.bind(CVSMessages.CVSStatus_messageWithRoot, new String[] { commandRoot.getName(), message }); 
96
		}
103
		}
104
		if (commandPath != null) {
105
			message = NLS.bind(CVSMessages.CVSStatus_messageWithRoot, new String[] { commandPath.toString(), message }); 
106
		}
97
		return message;
107
		return message;
98
	}
108
	}
99
109
(-)src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java (-1 / +3 lines)
Lines 685-690 Link Here
685
	}
685
	}
686
686
687
	private IStatus internalValidateCreateLink(IResource resource) {
687
	private IStatus internalValidateCreateLink(IResource resource) {
688
		/*  Allow creating linked resources of files already included in source repository.
688
		ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(resource.getParent().getFolder(new Path(resource.getName())));
689
		ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(resource.getParent().getFolder(new Path(resource.getName())));
689
		try {
690
		try {
690
			if (cvsFolder.isCVSFolder()) {
691
			if (cvsFolder.isCVSFolder()) {
Lines 700-706 Link Here
700
		} catch (CVSException e) {
701
		} catch (CVSException e) {
701
			CVSProviderPlugin.log(e);
702
			CVSProviderPlugin.log(e);
702
			return e.getStatus();
703
			return e.getStatus();
703
		}
704
		}*/
705
		
704
		return Status.OK_STATUS;
706
		return Status.OK_STATUS;
705
	}
707
	}
706
	
708
	
(-)src/org/eclipse/team/internal/ccvs/core/ICVSResource.java (+16 lines)
Lines 12-18 Link Here
12
12
13
13
14
import org.eclipse.core.resources.IResource;
14
import org.eclipse.core.resources.IResource;
15
import org.eclipse.core.runtime.IPath;
15
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.team.core.RepositoryProvider;
16
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
18
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
17
19
18
/**
20
/**
Lines 40-45 Link Here
40
	public String getName();
42
	public String getName();
41
	
43
	
42
	/**
44
	/**
45
	 * Returns the location of a resource in the file system, if it exists.
46
	 * 
47
	 * @return the location of the resource this handle represents. It can
48
	 * be <code>null</code>.
49
	 */
50
	public IPath getLocation();
51
52
	/**
43
	 * Answers if this resource has CVS synchronization information associated
53
	 * Answers if this resource has CVS synchronization information associated
44
	 * with it.
54
	 * with it.
45
	 * 
55
	 * 
Lines 170-173 Link Here
170
	 * @return boolean
180
	 * @return boolean
171
	 */
181
	 */
172
	public boolean isModified(IProgressMonitor monitor) throws CVSException;
182
	public boolean isModified(IProgressMonitor monitor) throws CVSException;
183
	
184
	/**
185
	 * Method isModified.
186
	 * @return boolean
187
	 */
188
	public RepositoryProvider getProvider();
173
}
189
}
(-)src/org/eclipse/team/internal/ccvs/core/messages.properties (-1 / +2 lines)
Lines 163-169 Link Here
163
CVSRepositoryLocation_hostRequired=A host name is required to make a connection
163
CVSRepositoryLocation_hostRequired=A host name is required to make a connection
164
CVSRepositoryLocation_rootRequired=A root path is required to make a connection
164
CVSRepositoryLocation_rootRequired=A root path is required to make a connection
165
CVSRepositoryLocation_noAuthenticator=No CVS authenticator is registered
165
CVSRepositoryLocation_noAuthenticator=No CVS authenticator is registered
166
166
CVSRepositoryLocation_mixedRepository=Projects resources belong to different cvs repositories
167
167
168
Util_timeout=A timeout occurred connecting to host {0}
168
Util_timeout=A timeout occurred connecting to host {0}
169
Util_processTimeout=A timeout occurred executing command ''{0}''
169
Util_processTimeout=A timeout occurred executing command ''{0}''
Lines 190-195 Link Here
190
CVSProvider_Scrubbing_projects_1=Scrubbing projects
190
CVSProvider_Scrubbing_projects_1=Scrubbing projects
191
CVSProvider_Creating_projects_2=Creating projects
191
CVSProvider_Creating_projects_2=Creating projects
192
192
193
Resource_not_in_CVS=Not CVS File: {0} ({1})
193
EclipseFile_Problem_deleting_resource=Problem deleting resource: {0}. {1}
194
EclipseFile_Problem_deleting_resource=Problem deleting resource: {0}. {1}
194
EclipseFile_Problem_accessing_resource=Problem accessing resource: {0}. {1} Perform a Refresh.
195
EclipseFile_Problem_accessing_resource=Problem accessing resource: {0}. {1} Perform a Refresh.
195
EclipseFile_Problem_writing_resource=Problem writing resource ''{0}''. {1}
196
EclipseFile_Problem_writing_resource=Problem writing resource ''{0}''. {1}
(-)src/org/eclipse/team/internal/ccvs/core/client/Command.java (-7 / +9 lines)
Lines 13-20 Link Here
13
13
14
import java.util.*;
14
import java.util.*;
15
15
16
import org.eclipse.core.resources.IFile;
16
import org.eclipse.core.filesystem.URIUtil;
17
import org.eclipse.core.resources.IResource;
17
import org.eclipse.core.resources.*;
18
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
19
import org.eclipse.osgi.util.NLS;
19
import org.eclipse.osgi.util.NLS;
20
import org.eclipse.team.internal.ccvs.core.*;
20
import org.eclipse.team.internal.ccvs.core.*;
Lines 309-319 Link Here
309
				// print the invocation string to the console
309
				// print the invocation string to the console
310
				if (session.isOutputToConsole() || Policy.isDebugProtocol()) {
310
				if (session.isOutputToConsole() || Policy.isDebugProtocol()) {
311
					IPath commandRootPath;
311
					IPath commandRootPath;
312
					IResource resource = session.getLocalRoot().getIResource();
312
					commandRootPath = session.getLocalRoot().getLocation();
313
					if (resource == null) {
313
					if (commandRootPath == null)
314
						commandRootPath = Path.EMPTY;
314
						commandRootPath = Path.EMPTY; 
315
					} else {
315
					else {
316
						commandRootPath = resource.getFullPath();
316
						IContainer[] containers = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(URIUtil.toURI(commandRootPath));
317
						if (containers.length > 0)
318
							commandRootPath = containers[0].getFullPath();
317
					}
319
					}
318
					String line = constructCommandInvocationString(commandRootPath, gOptions, lOptions, arguments);
320
					String line = constructCommandInvocationString(commandRootPath, gOptions, lOptions, arguments);
319
					ConsoleListeners.getInstance().commandInvoked(session, line);
321
					ConsoleListeners.getInstance().commandInvoked(session, line);
(-)src/org/eclipse/team/internal/ccvs/core/client/Session.java (-13 / +2 lines)
Lines 12-29 Link Here
12
package org.eclipse.team.internal.ccvs.core.client;
12
package org.eclipse.team.internal.ccvs.core.client;
13
13
14
import java.io.*;
14
import java.io.*;
15
import java.util.ArrayList;
15
import java.util.*;
16
import java.util.Arrays;
17
import java.util.Collection;
18
import java.util.Date;
19
import java.util.Iterator;
20
import java.util.List;
21
import java.util.Map;
22
23
import java.util.zip.GZIPInputStream;
16
import java.util.zip.GZIPInputStream;
24
import java.util.zip.GZIPOutputStream;
17
import java.util.zip.GZIPOutputStream;
25
18
26
import org.eclipse.core.resources.IResource;
27
import org.eclipse.core.runtime.*;
19
import org.eclipse.core.runtime.*;
28
import org.eclipse.osgi.util.NLS;
20
import org.eclipse.osgi.util.NLS;
29
import org.eclipse.team.core.RepositoryProvider;
21
import org.eclipse.team.core.RepositoryProvider;
Lines 921-933 Link Here
921
		}
913
		}
922
		// If there is a provider, use the providers setting for watch/edit
914
		// If there is a provider, use the providers setting for watch/edit
923
		try {
915
		try {
924
			IResource resource = getLocalRoot().getIResource();
916
			RepositoryProvider provider = getLocalRoot().getProvider();
925
			if (resource != null && resource.getType() != IResource.ROOT) {
926
				RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
927
				if (provider != null) {
917
				if (provider != null) {
928
					return ((CVSTeamProvider) provider).isWatchEditEnabled();
918
					return ((CVSTeamProvider) provider).isWatchEditEnabled();
929
				}
919
				}
930
			}
931
		} catch (CVSException e) {
920
		} catch (CVSException e) {
932
			CVSProviderPlugin.log(e);
921
			CVSProviderPlugin.log(e);
933
		}
922
		}
(-)src/org/eclipse/team/internal/ccvs/core/client/Update.java (-9 / +2 lines)
Lines 11-21 Link Here
11
package org.eclipse.team.internal.ccvs.core.client;
11
package org.eclipse.team.internal.ccvs.core.client;
12
12
13
13
14
import java.util.ArrayList;
14
import java.util.*;
15
import java.util.Arrays;
16
import java.util.List;
17
15
18
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IProgressMonitor;
20
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.core.runtime.IStatus;
21
import org.eclipse.osgi.util.NLS;
18
import org.eclipse.osgi.util.NLS;
Lines 124-142 Link Here
124
	 */
121
	 */
125
	protected boolean shouldRetrieveAbsentDirectories(Session session) {
122
	protected boolean shouldRetrieveAbsentDirectories(Session session) {
126
		// Look for absent directories if enabled and the option is not already included
123
		// Look for absent directories if enabled and the option is not already included
127
		IResource resource = null;
128
		RepositoryProvider provider = null;
124
		RepositoryProvider provider = null;
129
		// If there is a provider, use the providers setting
125
		// If there is a provider, use the providers setting
130
		try {
126
		try {
131
			resource = session.getLocalRoot().getIResource();
127
			provider = session.getLocalRoot().getProvider();
132
			if (resource != null) {
133
				provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
134
				if (provider != null) {
128
				if (provider != null) {
135
					if (((CVSTeamProvider)provider).getFetchAbsentDirectories()) {
129
					if (((CVSTeamProvider)provider).getFetchAbsentDirectories()) {
136
						return true;
130
						return true;
137
					}
131
					}
138
				}
132
				}
139
			}
140
		} catch (CVSException e) {
133
		} catch (CVSException e) {
141
			CVSProviderPlugin.log(e);
134
			CVSProviderPlugin.log(e);
142
		}
135
		}
(-)src/org/eclipse/team/internal/ccvs/core/resources/CVSFileSystemRoot.java (+42 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ccvs.core.resources;
12
13
import org.eclipse.core.runtime.IPath;
14
import org.eclipse.team.core.RepositoryProvider;
15
import org.eclipse.team.internal.ccvs.core.*;
16
17
/**
18
 * This class provides static methods for checking out projects from a repository
19
 * into the local file system (not necessarily mappable to a workspace resource)
20
 * and for converting IPaths into CVSRespources and sync trees.
21
 * Instances of this class represent a local workspace root (i.e. a project).
22
 */
23
public class CVSFileSystemRoot {
24
25
	public CVSFileSystemRoot(){
26
	}
27
				
28
	public static ICVSFolder getCVSFolderFor(IPath resource, RepositoryProvider repositoryProvider) {
29
		return new FileSystemFolder(resource, repositoryProvider);
30
	}
31
32
	public static ICVSFile getCVSFileFor(IPath resource, RepositoryProvider repositoryProvider) {
33
		return new FileSystemFile(resource, repositoryProvider);
34
	}
35
36
	public static ICVSResource getCVSResourceFor(IPath resource, RepositoryProvider repositoryProvider) {
37
		if (resource.toFile().isFile())
38
			return getCVSFileFor(resource, repositoryProvider);
39
		else
40
			return getCVSFolderFor(resource, repositoryProvider);
41
	}
42
}
(-)src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java (-1 lines)
Lines 236-242 Link Here
236
	 */
236
	 */
237
	public static boolean isSharedWithCVS(IResource resource) throws CVSException {
237
	public static boolean isSharedWithCVS(IResource resource) throws CVSException {
238
		if (!resource.isAccessible()) return false;
238
		if (!resource.isAccessible()) return false;
239
		if(isLinkedResource(resource)) return false;
240
	
239
	
241
		if(RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) == null) {
240
		if(RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) == null) {
242
			return false;
241
			return false;
(-)src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java (-2 / +24 lines)
Lines 11-18 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.team.internal.ccvs.core.resources;
12
package org.eclipse.team.internal.ccvs.core.resources;
13
13
14
import java.io.File;
14
import java.io.*;
15
import java.io.InputStream;
16
import java.util.ArrayList;
15
import java.util.ArrayList;
17
import java.util.Date;
16
import java.util.Date;
18
import java.util.List;
17
import java.util.List;
Lines 185-190 Link Here
185
					break;
184
					break;
186
				case MERGED: // merging contents into a file that exists locally
185
				case MERGED: // merging contents into a file that exists locally
187
					// Ensure we don't leave the file in a partially written state
186
					// Ensure we don't leave the file in a partially written state
187
					if (file.isLinked()) {
188
						IPath fileLocation = file.getLocation();
189
						IPath tempFile = file.getLocation().removeLastSegments(1).append(file.getName() + TEMP_FILE_EXTENSION);
190
						File javaTempFile = tempFile.toFile();
191
						if (javaTempFile.exists())
192
							javaTempFile.delete();
193
						ByteArrayOutputStream os = new ByteArrayOutputStream();
194
						int nextByte;
195
						while ((nextByte = stream.read() ) != -1) {
196
							os.write((byte) nextByte);
197
						}
198
						RandomAccessFile raFile = new RandomAccessFile(javaTempFile, "rw"); //$NON-NLS-1$
199
						raFile.write(os.toByteArray());
200
						raFile.setLength(os.toByteArray().length);
201
						raFile.close();
202
						fileLocation.toFile().delete();
203
						javaTempFile.renameTo(fileLocation.toFile());
204
						file.refreshLocal(IResource.DEPTH_ZERO, Policy.subMonitorFor(monitor, 100));
205
					}
206
					else {
188
					IFile tempFile = file.getParent().getFile(new Path(null, file.getName() + TEMP_FILE_EXTENSION));
207
					IFile tempFile = file.getParent().getFile(new Path(null, file.getName() + TEMP_FILE_EXTENSION));
189
					monitor.beginTask(null, 100);
208
					monitor.beginTask(null, 100);
190
					if (tempFile.exists()) 
209
					if (tempFile.exists()) 
Lines 192-203 Link Here
192
					tempFile.create(stream, true /*force*/, Policy.subMonitorFor(monitor, 25));
211
					tempFile.create(stream, true /*force*/, Policy.subMonitorFor(monitor, 25));
193
					file.delete(false /* force */, true /* keep history */, Policy.subMonitorFor(monitor, 25));
212
					file.delete(false /* force */, true /* keep history */, Policy.subMonitorFor(monitor, 25));
194
					tempFile.move(new Path(null, file.getName()), false /*force*/, true /*history*/, Policy.subMonitorFor(monitor, 25));
213
					tempFile.move(new Path(null, file.getName()), false /*force*/, true /*history*/, Policy.subMonitorFor(monitor, 25));
214
					}
195
					monitor.done();
215
					monitor.done();
196
					break;
216
					break;
197
				case UPDATE_EXISTING: // creating a new file so it should exist locally
217
				case UPDATE_EXISTING: // creating a new file so it should exist locally
198
					file.setContents(stream, false /*force*/, true /*keep history*/, monitor);
218
					file.setContents(stream, false /*force*/, true /*keep history*/, monitor);
199
					break;
219
					break;
200
			}
220
			}
221
		} catch(IOException e) {
222
			throw CVSException.wrapException(e);
201
		} catch(CoreException e) {
223
		} catch(CoreException e) {
202
			String message = null;
224
			String message = null;
203
			if (e.getStatus().getCode() == IResourceStatus.FAILED_READ_LOCAL) {
225
			if (e.getStatus().getCode() == IResourceStatus.FAILED_READ_LOCAL) {
(-)src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java (+2 lines)
Lines 350-357 Link Here
350
			boolean modified;
350
			boolean modified;
351
			if (state == ICVSFile.UNKNOWN) {
351
			if (state == ICVSFile.UNKNOWN) {
352
				
352
				
353
				if (getLocation() != null) {
353
				if (!isCVSFolder() && container.getType() == IResource.FOLDER) {
354
				if (!isCVSFolder() && container.getType() == IResource.FOLDER) {
354
					return container.exists();
355
					return container.exists();
356
					}
355
				}
357
				}
356
				
358
				
357
				// We have no cached info for the folder. We'll need to check directly,
359
				// We have no cached info for the folder. We'll need to check directly,
(-)src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java (-7 / +30 lines)
Lines 13-18 Link Here
13
13
14
import org.eclipse.core.resources.*;
14
import org.eclipse.core.resources.*;
15
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.runtime.*;
16
import org.eclipse.team.core.RepositoryProvider;
16
import org.eclipse.team.core.Team;
17
import org.eclipse.team.core.Team;
17
import org.eclipse.team.internal.ccvs.core.*;
18
import org.eclipse.team.internal.ccvs.core.*;
18
import org.eclipse.team.internal.ccvs.core.client.Session;
19
import org.eclipse.team.internal.ccvs.core.client.Session;
Lines 55-64 Link Here
55
	 */
56
	 */
56
	public String getRelativePath(ICVSFolder root) throws CVSException {
57
	public String getRelativePath(ICVSFolder root) throws CVSException {
57
		try {
58
		try {
58
			EclipseResource rootFolder;
59
			String result;
59
			String result;
60
			rootFolder = (EclipseResource)root;
60
			if (root instanceof EclipseResource) {
61
				EclipseResource rootFolder = (EclipseResource)root;
61
			result = Util.getRelativePath(rootFolder.getPath(), getPath());
62
			result = Util.getRelativePath(rootFolder.getPath(), getPath());
63
			} else
64
				result = Util.getRelativePath(root.getLocation(), getLocation());
65
				
62
			if (result.length() == 0) return CURRENT_LOCAL_FOLDER;
66
			if (result.length() == 0) return CURRENT_LOCAL_FOLDER;
63
			return result;	
67
			return result;	
64
		} catch (ClassCastException e) {
68
		} catch (ClassCastException e) {
Lines 85-90 Link Here
85
		if (parent==null) {
89
		if (parent==null) {
86
			return null;
90
			return null;
87
		}
91
		}
92
		if (getLocation() != null) {
93
			IPath fileSystemParent = getLocation().removeLastSegments(1);
94
			if (!fileSystemParent.equals(parent.getLocation()))
95
				return CVSFileSystemRoot.getCVSFolderFor(fileSystemParent, getProvider());
96
		}
88
		return new EclipseFolder(parent);
97
		return new EclipseFolder(parent);
89
	}
98
	}
90
99
Lines 104-111 Link Here
104
			return false;
113
			return false;
105
		}
114
		}
106
		
115
		
107
		// If the resource is a derived or linked resource, it is ignored
116
		// If the resource is a derived resource, it is ignored
108
		if (resource.isDerived() || resource.isLinked()) {
117
		if (resource.isDerived()) {
109
			return true;
118
			return true;
110
		}
119
		}
111
		
120
		
Lines 165-171 Link Here
165
		if (!(obj instanceof EclipseResource)) {
174
		if (!(obj instanceof EclipseResource)) {
166
			return false;
175
			return false;
167
		} else {
176
		} else {
168
			return getPath().equals(((EclipseResource) obj).getPath());
177
			return getLocation().equals(((EclipseResource) obj).getLocation());
169
		}
178
		}
170
	}
179
	}
171
			
180
			
Lines 176-181 Link Here
176
		return resource.getFullPath().toString();
185
		return resource.getFullPath().toString();
177
	}	
186
	}	
178
	
187
	
188
	public IPath getLocation() {
189
		return resource.getLocation();
190
	}	
191
	
179
	/*
192
	/*
180
	 * @see ICVSResource#isFolder()
193
	 * @see ICVSResource#isFolder()
181
	 */
194
	 */
Lines 187-192 Link Here
187
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getSyncBytes()
200
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getSyncBytes()
188
	 */
201
	 */
189
	public byte[] getSyncBytes() throws CVSException {
202
	public byte[] getSyncBytes() throws CVSException {
203
		if (getLocation() == null)
204
			return null;
190
		return EclipseSynchronizer.getInstance().getSyncBytes(getIResource());
205
		return EclipseSynchronizer.getInstance().getSyncBytes(getIResource());
191
	}
206
	}
192
	
207
	
Lines 194-199 Link Here
194
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#setSyncBytes(byte[])
209
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#setSyncBytes(byte[])
195
	 */
210
	 */
196
	public void setSyncBytes(byte[] syncBytes) throws CVSException {
211
	public void setSyncBytes(byte[] syncBytes) throws CVSException {
212
		if (resource.getType() == IResource.ROOT || resource.getType() == IResource.PROJECT)
213
			return;
197
		if (getParent().isCVSFolder()) {
214
		if (getParent().isCVSFolder()) {
198
			EclipseSynchronizer.getInstance().setSyncBytes(getIResource(), syncBytes);
215
			EclipseSynchronizer.getInstance().setSyncBytes(getIResource(), syncBytes);
199
		}
216
		}
Lines 231-238 Link Here
231
	 * @see Comparable#compareTo(Object)
248
	 * @see Comparable#compareTo(Object)
232
	 */
249
	 */
233
	public int compareTo(Object arg0) {
250
	public int compareTo(Object arg0) {
234
		EclipseResource other = (EclipseResource)arg0;
251
		ICVSResource other = (ICVSResource)arg0;
235
		return resource.getFullPath().toString().compareTo(other.resource.getFullPath().toString());
252
		return getLocation().toString().compareTo(other.getLocation().toString());
236
	}
253
	}
237
254
238
	/**
255
	/**
Lines 272-275 Link Here
272
			throw error[0];
289
			throw error[0];
273
		}
290
		}
274
	}
291
	}
292
293
	public RepositoryProvider getProvider() {
294
		if (resource != null && resource.getType() != IResource.ROOT)
295
			return RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
296
		return null;
297
	}
275
}
298
}
(-)src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java (-22 / +343 lines)
Lines 137-142 Link Here
137
	}
137
	}
138
	
138
	
139
	/**
139
	/**
140
	 * Sets the folder sync info for the specified folder.
141
	 * The folder must exist and must not be the workspace root.
142
	 * 
143
	 * @param folder the folder
144
	 * @param info the folder sync info, must not be null
145
	 * @see #getFolderSync, #deleteFolderSync
146
	 */
147
	public void setFolderSync(IPath folder, FolderSyncInfo info) throws CVSException {
148
		Assert.isNotNull(info); // enforce the use of deleteFolderSync
149
		// ignore folder sync on the root (i.e. CVSROOT/config/TopLevelAdmin=yes but we just ignore it)
150
		if (folder.isRoot()) return;
151
		if (!folder.toFile().exists()) {
152
			// This means that the folder doesn't exist and is not a phantom
153
			// Allow the set if the parent is a CVS folder since
154
			// this can occur when creating phantom folders
155
			if (getFolderSync(folder.removeLastSegments(1)) == null) {
156
				IStatus status = new CVSStatus(IStatus.ERROR, TeamException.UNABLE,
157
						NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingFolderSync, new String[] { folder.toOSString() }),folder);
158
				throw new CVSException(status); 
159
			}
160
		}
161
		SyncFileWriter.writeFolderSync(folder, info);
162
	}
163
	/**
140
	 * Gets the folder sync info for the specified folder.
164
	 * Gets the folder sync info for the specified folder.
141
	 * 
165
	 * 
142
	 * @param folder the folder
166
	 * @param folder the folder
Lines 159-164 Link Here
159
	}	
183
	}	
160
184
161
	/**
185
	/**
186
	 * Gets the folder sync info for the specified folder.
187
	 * 
188
	 * @param folder the folder
189
	 * @return the folder sync info associated with the folder, or null if none.
190
	 * @see #setFolderSync, #deleteFolderSync
191
	 */
192
	public FolderSyncInfo getFolderSync(IPath folder) throws CVSException {
193
		if (folder.isRoot() || !folder.toFile().exists()) return null;
194
        // Do a check outside the lock for any folder sync info
195
		FolderSyncInfo info;
196
		info = SyncFileWriter.readFolderSync(folder);
197
		return info;
198
	}	
199
200
	/**
162
	 * Deletes the folder sync for the specified folder and the resource sync
201
	 * Deletes the folder sync for the specified folder and the resource sync
163
	 * for all of its children.  Does not recurse.
202
	 * for all of its children.  Does not recurse.
164
	 * 
203
	 * 
Lines 256-263 Link Here
256
	 * @return the resource sync info associated with the resource, or null if none.
295
	 * @return the resource sync info associated with the resource, or null if none.
257
	 * @see #setResourceSync, #deleteResourceSync
296
	 * @see #setResourceSync, #deleteResourceSync
258
	 */
297
	 */
298
	public ResourceSyncInfo getResourceSync(IPath resource) throws CVSException {
299
		byte[] info = getSyncBytes(resource);
300
		if (info == null) return null;
301
		return new ResourceSyncInfo(info);
302
	}
303
304
	/**
305
	 * Gets the resource sync info for the specified folder.
306
	 * 
307
	 * @param resource the resource
308
	 * @return the resource sync info associated with the resource, or null if none.
309
	 * @see #setResourceSync, #deleteResourceSync
310
	 */
259
	public byte[] getSyncBytes(IResource resource) throws CVSException {
311
	public byte[] getSyncBytes(IResource resource) throws CVSException {
312
		if (resource.getLocation() == null)
313
			return null;
260
		IContainer parent = resource.getParent();
314
		IContainer parent = resource.getParent();
315
		if (shouldBeManagedOutsideOfTheWorkspace(resource, parent)) {
316
			// this means the resource is linked, and the parent should be checked in the file system directly.
317
			return getSyncBytes(resource.getLocation());
318
		}
261
		if (parent == null || parent.getType() == IResource.ROOT || !isValid(parent)) return null;
319
		if (parent == null || parent.getType() == IResource.ROOT || !isValid(parent)) return null;
262
        // Do a quick check outside the lock to see if there are sync butes for the resource.
320
        // Do a quick check outside the lock to see if there are sync butes for the resource.
263
        byte[] info = getSyncInfoCacheFor(resource).getCachedSyncBytes(resource, false /* not thread safe */);
321
        byte[] info = getSyncInfoCacheFor(resource).getCachedSyncBytes(resource, false /* not thread safe */);
Lines 287-292 Link Here
287
	}
345
	}
288
346
289
	/**
347
	/**
348
	 * Gets the resource sync info for the specified folder that exist outside the workspace.
349
	 * 
350
	 * @param path the resource
351
	 * @return the resource sync info associated with the resource, or null if none.
352
	 * @see #setResourceSync, #deleteResourceSync
353
	 */
354
	public byte[] getSyncBytes(IPath resource) throws CVSException {
355
		IPath parent = resource.removeLastSegments(1);
356
		if (parent == null || parent.isRoot() || !parent.toFile().exists()) return null;
357
        // Do a quick check outside the lock to see if there are sync butes for the resource.
358
		byte[] bytes =  getSyncBytesFromDisk(resource);
359
		if (!resource.toFile().exists() && bytes != null && !ResourceSyncInfo.isDeletion(bytes)) {
360
			bytes = ResourceSyncInfo.convertToDeletion(bytes);
361
		}
362
		return bytes;
363
	}
364
365
	/**
290
	 * Sets the resource sync info for the specified resource.
366
	 * Sets the resource sync info for the specified resource.
291
	 * The parent folder must exist and must not be the workspace root.
367
	 * The parent folder must exist and must not be the workspace root.
292
	 * 
368
	 * 
Lines 297-302 Link Here
297
	public void setSyncBytes(IResource resource, byte[] syncBytes) throws CVSException {
373
	public void setSyncBytes(IResource resource, byte[] syncBytes) throws CVSException {
298
		Assert.isNotNull(syncBytes); // enforce the use of deleteResourceSync
374
		Assert.isNotNull(syncBytes); // enforce the use of deleteResourceSync
299
		IContainer parent = resource.getParent();
375
		IContainer parent = resource.getParent();
376
		if (shouldBeManagedOutsideOfTheWorkspace(resource, parent)) {
377
			// this means the resource is linked, and the parent should be checked in the file system directly.
378
			setSyncBytes(resource.getLocation(), syncBytes);
379
			resourceChanged(resource);
380
			return;
381
		}
300
		if (parent == null || parent.getType() == IResource.ROOT || !isValid(parent)) {
382
		if (parent == null || parent.getType() == IResource.ROOT || !isValid(parent)) {
301
			IStatus status = new CVSStatus(IStatus.ERROR, TeamException.UNABLE,
383
			IStatus status = new CVSStatus(IStatus.ERROR, TeamException.UNABLE,
302
				NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingResourceSync, new String[] { resource.getFullPath().toString() }),resource);
384
				NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingResourceSync, new String[] { resource.getFullPath().toString() }),resource);
Lines 320-325 Link Here
320
	}
402
	}
321
		
403
		
322
	/**
404
	/**
405
	 * Sets the resource sync info for the specified resource.
406
	 * The parent folder must exist and must not be the workspace root.
407
	 * 
408
	 * @param resource the resource
409
	 * @param info the resource sync info, must not be null
410
	 * @see #getResourceSync, #deleteResourceSync
411
	 */
412
	public void setSyncBytes(IPath resource, byte[] syncBytes) throws CVSException {
413
		Assert.isNotNull(syncBytes); // enforce the use of deleteResourceSync
414
		IPath parent = resource.removeLastSegments(1);
415
		if (parent == null || parent.isRoot() || !parent.toFile().exists()) {
416
			IStatus status = new CVSStatus(IStatus.ERROR, 
417
					NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingResourceSync, new String[] { resource.toOSString() }));
418
			throw new CVSException(status); 
419
		}
420
		byte[][] infos = SyncFileWriter.readAllResourceSync(parent);
421
		if (infos == null) return;
422
		boolean added = false;
423
		for (int i = 0; i < infos.length; i++) {
424
			byte[] bytes = infos[i];
425
			if (resource.lastSegment().equals(getName(bytes))) {
426
				infos[i] = syncBytes;
427
				added = true;
428
			}
429
		}
430
		if (!added) {
431
			ArrayList list = new ArrayList(Arrays.asList(infos));
432
			list.add(syncBytes);
433
			infos = (byte[][]) list.toArray(new byte[0][]);
434
		}
435
		SyncFileWriter.writeAllResourceSync(parent, infos);
436
	}
437
438
	/**
323
	 * Deletes the resource sync info for the specified resource, if it exists.
439
	 * Deletes the resource sync info for the specified resource, if it exists.
324
	 * 
440
	 * 
325
	 * @param resource the resource
441
	 * @param resource the resource
Lines 327-332 Link Here
327
	 */
443
	 */
328
	public void deleteResourceSync(IResource resource) throws CVSException {
444
	public void deleteResourceSync(IResource resource) throws CVSException {
329
		IContainer parent = resource.getParent();
445
		IContainer parent = resource.getParent();
446
		if (shouldBeManagedOutsideOfTheWorkspace(resource, parent)) {
447
			// this means the resource is linked, and the parent should be checked in the file system directly.
448
			deleteResourceSync(resource.getLocation());
449
			return;
450
		}
330
		if (parent == null || parent.getType() == IResource.ROOT || !isValid(parent)) return;
451
		if (parent == null || parent.getType() == IResource.ROOT || !isValid(parent)) return;
331
		ISchedulingRule rule = null;
452
		ISchedulingRule rule = null;
332
		try {
453
		try {
Lines 348-353 Link Here
348
		}
469
		}
349
	}
470
	}
350
471
472
	private boolean shouldBeManagedOutsideOfTheWorkspace(IResource resource,
473
			IContainer parent) {
474
		// parent.getLocation() can be null
475
		return (parent != null) &&  (resource.getType() != IResource.PROJECT) && !resource.getLocation().removeLastSegments(1).equals(parent.getLocation());
476
	}
477
478
	/**
479
	 * Deletes the resource sync info for the specified resource, if it exists.
480
	 * 
481
	 * @param resource the resource
482
	 * @see #getResourceSync, #setResourceSync
483
	 */
484
	public void deleteResourceSync(IPath resource) throws CVSException {
485
		IPath parent = resource.removeLastSegments(1);
486
		if (parent == null || parent.isRoot() || !parent.toFile().exists()) return;
487
		ArrayList newInfos = new ArrayList();
488
		byte[][] infos = SyncFileWriter.readAllResourceSync(parent);
489
		if (infos == null) return;
490
		for (int i = 0; i < infos.length; i++) {
491
			byte[] bytes = infos[i];
492
			if (!resource.lastSegment().equals(getName(bytes))) {
493
				newInfos.add(infos[i]);
494
			}
495
		}
496
		SyncFileWriter.writeAllResourceSync(parent, (byte[][]) newInfos.toArray(new byte[0][]));
497
	}
498
351
	/**
499
	/**
352
	 * @param resource
500
	 * @param resource
353
	 */
501
	 */
Lines 860-871 Link Here
860
		if (! getSyncInfoCacheFor(container).isResourceSyncInfoCached(container)) {
1008
		if (! getSyncInfoCacheFor(container).isResourceSyncInfoCached(container)) {
861
			// load the sync info from disk
1009
			// load the sync info from disk
862
			byte[][] infos;
1010
			byte[][] infos;
863
			// do not load the sync info for resources that are linked
864
			if (isLinkedResource(container)) {
865
				infos = null;
866
			} else {
867
				infos = SyncFileWriter.readAllResourceSync(container);
1011
				infos = SyncFileWriter.readAllResourceSync(container);
868
			}
869
			try {
1012
			try {
870
				if (infos != null) {
1013
				if (infos != null) {
871
					for (int i = 0; i < infos.length; i++) {
1014
					for (int i = 0; i < infos.length; i++) {
Lines 901-920 Link Here
901
		if (! getSyncInfoCacheFor(container).isFolderSyncInfoCached(container)) {
1044
		if (! getSyncInfoCacheFor(container).isFolderSyncInfoCached(container)) {
902
			// load the sync info from disk
1045
			// load the sync info from disk
903
			FolderSyncInfo info;
1046
			FolderSyncInfo info;
904
			// do not load the sync info for resources that are linked
905
			if (isLinkedResource(container)) {
906
				info = null;
907
			} else {
908
				info = SyncFileWriter.readFolderSync(container);
1047
				info = SyncFileWriter.readFolderSync(container);
909
			}
1048
			
910
			getSyncInfoCacheFor(container).setCachedFolderSync(container, info, false);
1049
			getSyncInfoCacheFor(container).setCachedFolderSync(container, info, false);
911
		}
1050
		}
912
	}
1051
	}
913
	
1052
	
914
	private boolean isLinkedResource(IResource resource) {
1053
/*	private boolean isLinkedResource(IResource resource) {
915
		return CVSWorkspaceRoot.isLinkedResource(resource);
1054
		return CVSWorkspaceRoot.isLinkedResource(resource);
916
	}
1055
	}
917
1056
*/
918
	/**
1057
	/**
919
	 * Load the sync info for the given resource from disk
1058
	 * Load the sync info for the given resource from disk
920
	 * @param resource
1059
	 * @param resource
Lines 933-938 Link Here
933
	}
1072
	}
934
	
1073
	
935
	/**
1074
	/**
1075
	 * Load the sync info for the given resource from disk
1076
	 * @param resource
1077
	 * @return byte[]
1078
	 */
1079
	private byte[] getSyncBytesFromDisk(IPath resource) throws CVSException {
1080
		byte[][] infos = SyncFileWriter.readAllResourceSync(resource.removeLastSegments(1));
1081
		if (infos == null) return null;
1082
		for (int i = 0; i < infos.length; i++) {
1083
			byte[] syncBytes = infos[i];
1084
			if (resource.lastSegment().equals(getName(syncBytes))) {
1085
				return syncBytes;
1086
			}
1087
		}
1088
		return null;
1089
	}
1090
1091
	/**
936
	 * Commits the cache after a series of operations.
1092
	 * Commits the cache after a series of operations.
937
	 * 
1093
	 * 
938
	 * Will return STATUS_OK unless there were problems writting sync 
1094
	 * Will return STATUS_OK unless there were problems writting sync 
Lines 961-968 Link Here
961
			for (int i = 0; i < changedResources.length; i++) {
1117
			for (int i = 0; i < changedResources.length; i++) {
962
				IResource resource = changedResources[i];
1118
				IResource resource = changedResources[i];
963
				IContainer folder = resource.getParent();
1119
				IContainer folder = resource.getParent();
1120
				if (!shouldBeManagedOutsideOfTheWorkspace(resource, folder)) {
964
				dirtyParents.add(folder);
1121
				dirtyParents.add(folder);
965
			}
1122
			}
1123
			}
966
			
1124
			
967
			monitor = Policy.monitorFor(monitor);
1125
			monitor = Policy.monitorFor(monitor);
968
			int numDirty = dirtyParents.size();
1126
			int numDirty = dirtyParents.size();
Lines 986-992 Link Here
986
						if (info == null) {
1144
						if (info == null) {
987
							// deleted folder sync info since we loaded it
1145
							// deleted folder sync info since we loaded it
988
							// (but don't overwrite the sync info for linked folders
1146
							// (but don't overwrite the sync info for linked folders
989
							if (!isLinkedResource(folder))
990
								SyncFileWriter.deleteFolderSync(folder);
1147
								SyncFileWriter.deleteFolderSync(folder);
991
							dirtyParents.remove(folder);
1148
							dirtyParents.remove(folder);
992
						} else {
1149
						} else {
Lines 1026-1033 Link Here
1026
								infos.add(syncBytes);
1183
								infos.add(syncBytes);
1027
							}
1184
							}
1028
						}
1185
						}
1029
						// do not overwrite the sync info for linked resources
1186
						if (infos.size() > 0)
1030
						if (infos.size() > 0 || !isLinkedResource(folder))
1031
							SyncFileWriter.writeAllResourceSync(folder,
1187
							SyncFileWriter.writeAllResourceSync(folder,
1032
								(byte[][]) infos.toArray(new byte[infos.size()][]));
1188
								(byte[][]) infos.toArray(new byte[infos.size()][]));
1033
					} catch(CVSException e) {
1189
					} catch(CVSException e) {
Lines 1198-1206 Link Here
1198
	 */
1354
	 */
1199
	public void setNotifyInfo(IResource resource, NotifyInfo info) throws CVSException {
1355
	public void setNotifyInfo(IResource resource, NotifyInfo info) throws CVSException {
1200
		NotifyInfo[] infos = SyncFileWriter.readAllNotifyInfo(resource.getParent());
1356
		NotifyInfo[] infos = SyncFileWriter.readAllNotifyInfo(resource.getParent());
1357
		infos = setNotifyInfo(resource.getName(), info, infos);
1358
		if (infos != null)
1359
			SyncFileWriter.writeAllNotifyInfo(resource.getParent(), infos);
1360
	}
1361
1362
	/**
1363
	 * Add the entry to the CVS/Notify file. We are not initially concerned with efficiency
1364
	 * since edit/unedit are typically issued on a small set of files.
1365
	 * 
1366
	 * XXX If there was a previous notify entry for the resource, it is replaced. This is
1367
	 * probably not the proper behavior (see EclipseFile).
1368
	 * 
1369
	 * A value of null for info indicates that any entry for the given
1370
	 * resource is to be removed from the Notify file.
1371
	 * 
1372
	 * @param resource
1373
	 * @param info
1374
	 */
1375
	public void setNotifyInfo(IPath resource, NotifyInfo info) throws CVSException {
1376
		NotifyInfo[] infos = SyncFileWriter.readAllNotifyInfo(resource.removeLastSegments(1));
1377
		infos = setNotifyInfo(resource.lastSegment(), info, infos);
1378
		if (infos != null)
1379
			SyncFileWriter.writeAllNotifyInfo(resource.removeLastSegments(1), infos);
1380
	}
1381
1382
	private NotifyInfo[] setNotifyInfo(String name, NotifyInfo info,
1383
			NotifyInfo[] infos) {
1201
		if (infos == null) {
1384
		if (infos == null) {
1202
			// if the file is empty and we are removing an entry, just return;
1385
			// if the file is empty and we are removing an entry, just return;
1203
			if (info == null) return;
1386
			if (info == null) return null;
1204
			infos = new NotifyInfo[] { info };
1387
			infos = new NotifyInfo[] { info };
1205
		} else {
1388
		} else {
1206
			Map infoMap = new HashMap();
1389
			Map infoMap = new HashMap();
Lines 1210-1216 Link Here
1210
			}
1393
			}
1211
			if (info == null) {
1394
			if (info == null) {
1212
				// if the info is null, remove the entry
1395
				// if the info is null, remove the entry
1213
				infoMap.remove(resource.getName());
1396
				infoMap.remove(name);
1214
			} else {
1397
			} else {
1215
				// add the new entry to the list
1398
				// add the new entry to the list
1216
				infoMap.put(info.getName(), info);
1399
				infoMap.put(info.getName(), info);
Lines 1223-1229 Link Here
1223
			}
1406
			}
1224
			infos = newInfos;
1407
			infos = newInfos;
1225
		}
1408
		}
1226
		SyncFileWriter.writeAllNotifyInfo(resource.getParent(), infos);
1409
		return infos;
1227
	}
1410
	}
1228
1411
1229
	/**
1412
	/**
Lines 1244-1249 Link Here
1244
	}
1427
	}
1245
1428
1246
	/**
1429
	/**
1430
	 * Method getNotifyInfo.
1431
	 * @param resource
1432
	 * @return NotifyInfo
1433
	 */
1434
	public NotifyInfo getNotifyInfo(IPath resource) throws CVSException {
1435
		NotifyInfo[] infos = SyncFileWriter.readAllNotifyInfo(resource.removeLastSegments(1));
1436
		if (infos == null) return null;
1437
		for (int i = 0; i < infos.length; i++) {
1438
			NotifyInfo notifyInfo = infos[i];
1439
			if (notifyInfo.getName().equals(resource.lastSegment())) {
1440
				return notifyInfo;
1441
			}
1442
		}
1443
		return null;
1444
	}
1445
1446
	/**
1247
	 * Method deleteNotifyInfo.
1447
	 * Method deleteNotifyInfo.
1248
	 * @param resource
1448
	 * @param resource
1249
	 */
1449
	 */
Lines 1265-1270 Link Here
1265
	}
1465
	}
1266
	
1466
	
1267
	/**
1467
	/**
1468
	 * Method deleteNotifyInfo.
1469
	 * @param resource
1470
	 */
1471
	public void deleteNotifyInfo(IPath resource) throws CVSException {
1472
		NotifyInfo[] infos = SyncFileWriter.readAllNotifyInfo(resource.removeLastSegments(1));
1473
		if (infos == null) return;
1474
		Map infoMap = new HashMap();
1475
		for (int i = 0; i < infos.length; i++) {
1476
			NotifyInfo notifyInfo = infos[i];
1477
			infoMap.put(notifyInfo.getName(), notifyInfo);
1478
		}
1479
		infoMap.remove(resource.lastSegment());
1480
		NotifyInfo[] newInfos = new NotifyInfo[infoMap.size()];
1481
		int i = 0;
1482
		for (Iterator iter = infoMap.values().iterator(); iter.hasNext();) {
1483
			newInfos[i++] = (NotifyInfo) iter.next();
1484
		}
1485
		SyncFileWriter.writeAllNotifyInfo(resource.removeLastSegments(1), newInfos);
1486
	}
1487
1488
	/**
1268
	 * Add the entry to the CVS/Baserev file. We are not initially concerned
1489
	 * Add the entry to the CVS/Baserev file. We are not initially concerned
1269
	 * with efficiency since edit/unedit are typically issued on a small set of
1490
	 * with efficiency since edit/unedit are typically issued on a small set of
1270
	 * files.
1491
	 * files.
Lines 1277-1282 Link Here
1277
	 */
1498
	 */
1278
	public void setBaserevInfo(IResource resource, BaserevInfo info) throws CVSException {
1499
	public void setBaserevInfo(IResource resource, BaserevInfo info) throws CVSException {
1279
		BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.getParent());
1500
		BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.getParent());
1501
		infos = setBaserevInfo(info, infos);
1502
		SyncFileWriter.writeAllBaserevInfo(resource.getParent(), infos);
1503
	}
1504
1505
	/**
1506
	 * Add the entry to the CVS/Baserev file. We are not initially concerned
1507
	 * with efficiency since edit/unedit are typically issued on a small set of
1508
	 * files.
1509
	 *
1510
	 * XXX If there was a previous notify entry for the resource, it is replaced. This is
1511
	 * probably not the proper behavior (see EclipseFile).
1512
	 *
1513
	 * @param resource
1514
	 * @param info
1515
	 */
1516
	public void setBaserevInfo(IPath resource, BaserevInfo info) throws CVSException {
1517
		BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.removeLastSegments(1));
1518
		infos = setBaserevInfo(info, infos);
1519
		SyncFileWriter.writeAllBaserevInfo(resource.removeLastSegments(1), infos);
1520
	}
1521
1522
	private BaserevInfo[] setBaserevInfo(BaserevInfo info, BaserevInfo[] infos) {
1280
		if (infos == null) {
1523
		if (infos == null) {
1281
			infos = new BaserevInfo[] { info };
1524
			infos = new BaserevInfo[] { info };
1282
		} else {
1525
		} else {
Lines 1292-1298 Link Here
1292
			}
1535
			}
1293
			infos = newInfos;
1536
			infos = newInfos;
1294
		}
1537
		}
1295
		SyncFileWriter.writeAllBaserevInfo(resource.getParent(), infos);
1538
		return infos;
1296
	}
1539
	}
1297
1540
1298
	/**
1541
	/**
Lines 1303-1311 Link Here
1303
	public BaserevInfo getBaserevInfo(IResource resource) throws CVSException {
1546
	public BaserevInfo getBaserevInfo(IResource resource) throws CVSException {
1304
		BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.getParent());
1547
		BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.getParent());
1305
		if (infos == null) return null;
1548
		if (infos == null) return null;
1549
		return getBaserevInfo(resource.getName(), infos);
1550
	}
1551
1552
	/**
1553
	 * Method getBaserevInfo.
1554
	 * @param resource
1555
	 * @return BaserevInfo
1556
	 */
1557
	public BaserevInfo getBaserevInfo(IPath resource) throws CVSException {
1558
		BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.removeLastSegments(1));
1559
		if (infos == null) return null;
1560
		return getBaserevInfo(resource.lastSegment(), infos);
1561
	}
1562
1563
	private BaserevInfo getBaserevInfo(String name, BaserevInfo[] infos) {
1306
		for (int i = 0; i < infos.length; i++) {
1564
		for (int i = 0; i < infos.length; i++) {
1307
			BaserevInfo info = infos[i];
1565
			BaserevInfo info = infos[i];
1308
			if (info.getName().equals(resource.getName())) {
1566
			if (info.getName().equals(name)) {
1309
				return info;
1567
				return info;
1310
			}
1568
			}
1311
		}
1569
		}
Lines 1319-1335 Link Here
1319
	public void deleteBaserevInfo(IResource resource) throws CVSException {
1577
	public void deleteBaserevInfo(IResource resource) throws CVSException {
1320
		BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.getParent());
1578
		BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.getParent());
1321
		if (infos == null) return;
1579
		if (infos == null) return;
1580
		BaserevInfo[] newInfos = deleteBaserevInfo(resource.getName(), infos);
1581
		SyncFileWriter.writeAllBaserevInfo(resource.getParent(), newInfos);
1582
	}
1583
1584
	/**
1585
	 * Method deleteNotifyInfo.
1586
	 * @param resource
1587
	 */
1588
	public void deleteBaserevInfo(IPath resource) throws CVSException {
1589
		BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.removeLastSegments(1));
1590
		if (infos == null) return;
1591
		BaserevInfo[] newInfos = deleteBaserevInfo(resource.lastSegment(), infos);
1592
		SyncFileWriter.writeAllBaserevInfo(resource.removeLastSegments(1), newInfos);
1593
	}
1594
1595
	private BaserevInfo[] deleteBaserevInfo(String name,
1596
			BaserevInfo[] infos) {
1322
		Map infoMap = new HashMap();
1597
		Map infoMap = new HashMap();
1323
		for (int i = 0; i < infos.length; i++) {
1598
		for (int i = 0; i < infos.length; i++) {
1324
			infoMap.put(infos[i].getName(), infos[i]);
1599
			infoMap.put(infos[i].getName(), infos[i]);
1325
		}
1600
		}
1326
		infoMap.remove(resource.getName());
1601
		infoMap.remove(name);
1327
		BaserevInfo[] newInfos = new BaserevInfo[infoMap.size()];
1602
		BaserevInfo[] newInfos = new BaserevInfo[infoMap.size()];
1328
		int i = 0;
1603
		int i = 0;
1329
		for (Iterator iter = infoMap.values().iterator(); iter.hasNext();) {
1604
		for (Iterator iter = infoMap.values().iterator(); iter.hasNext();) {
1330
			newInfos[i++] = (BaserevInfo) iter.next();
1605
			newInfos[i++] = (BaserevInfo) iter.next();
1331
		}
1606
		}
1332
		SyncFileWriter.writeAllBaserevInfo(resource.getParent(), newInfos);
1607
		return newInfos;
1333
	}
1608
	}
1334
1609
1335
	public void copyFileToBaseDirectory(final IFile file, IProgressMonitor monitor) throws CVSException {
1610
	public void copyFileToBaseDirectory(final IFile file, IProgressMonitor monitor) throws CVSException {
Lines 1350-1355 Link Here
1350
		}
1625
		}
1351
	}
1626
	}
1352
	
1627
	
1628
	public void copyFileToBaseDirectory(final IPath file, IProgressMonitor monitor) throws CVSException {
1629
		monitor = Policy.monitorFor(monitor);
1630
		monitor.beginTask(null, 100);
1631
		try {
1632
			ResourceSyncInfo info = getResourceSync(file);
1633
			// The file must exist remotely and locally
1634
			if (info == null || info.isAdded() || info.isDeleted())
1635
				return;
1636
			SyncFileWriter.writeFileToBaseDirectory(file, Policy.subMonitorFor(monitor, 80));
1637
		} finally {
1638
			monitor.done();
1639
		}
1640
	}
1641
1353
	public void restoreFileFromBaseDirectory(final IFile file, IProgressMonitor monitor) throws CVSException {
1642
	public void restoreFileFromBaseDirectory(final IFile file, IProgressMonitor monitor) throws CVSException {
1354
		monitor = Policy.monitorFor(monitor);
1643
		monitor = Policy.monitorFor(monitor);
1355
		monitor.beginTask(null, 100);
1644
		monitor.beginTask(null, 100);
Lines 1368-1373 Link Here
1368
		}
1657
		}
1369
	}
1658
	}
1370
	
1659
	
1660
	public void restoreFileFromBaseDirectory(final IPath file, IProgressMonitor monitor) throws CVSException {
1661
		monitor = Policy.monitorFor(monitor);
1662
		monitor.beginTask(null, 100);
1663
		try {
1664
			ResourceSyncInfo info = getResourceSync(file);
1665
			// The file must exist remotely
1666
			if (info == null || info.isAdded())
1667
				return;
1668
			SyncFileWriter.restoreFileFromBaseDirectory(file, Policy.subMonitorFor(monitor, 80));
1669
		} finally {
1670
			monitor.done();
1671
		}
1672
	}
1673
1371
	public void deleteFileFromBaseDirectory(final IFile file, IProgressMonitor monitor) throws CVSException {
1674
	public void deleteFileFromBaseDirectory(final IFile file, IProgressMonitor monitor) throws CVSException {
1372
		ResourceSyncInfo info = getResourceSync(file);
1675
		ResourceSyncInfo info = getResourceSync(file);
1373
		// The file must exist remotely
1676
		// The file must exist remotely
Lines 1376-1381 Link Here
1376
		SyncFileWriter.deleteFileFromBaseDirectory(file, monitor);
1679
		SyncFileWriter.deleteFileFromBaseDirectory(file, monitor);
1377
	}
1680
	}
1378
	
1681
	
1682
	public void deleteFileFromBaseDirectory(final IPath file, IProgressMonitor monitor) throws CVSException {
1683
		ResourceSyncInfo info = getResourceSync(file);
1684
		// The file must exist remotely
1685
		if (info == null || info.isAdded())
1686
			return;
1687
		SyncFileWriter.deleteFileFromBaseDirectory(file, monitor);
1688
	}
1689
1379
	/**
1690
	/**
1380
	 * Method isSyncInfoLoaded returns true if all the sync info for the
1691
	 * Method isSyncInfoLoaded returns true if all the sync info for the
1381
	 * provided resources is loaded into the internal cache.
1692
	 * provided resources is loaded into the internal cache.
Lines 1488-1493 Link Here
1488
		return SyncFileWriter.isEdited(resource);
1799
		return SyncFileWriter.isEdited(resource);
1489
	}
1800
	}
1490
	
1801
	
1802
	/**
1803
	 * Method isEdited returns true if a "cvs edit" was performed on the given
1804
	 * file and no commit or unedit has yet been performed.
1805
	 * @param iResource
1806
	 * @return boolean
1807
	 */
1808
	public boolean isEdited(IPath resource) {
1809
		return SyncFileWriter.isEdited(resource);
1810
	}
1811
1491
	/* package */ void adjustDirtyStateRecursively(IResource resource, String indicator) throws CVSException {
1812
	/* package */ void adjustDirtyStateRecursively(IResource resource, String indicator) throws CVSException {
1492
		if (resource.getType() == IResource.ROOT) return;
1813
		if (resource.getType() == IResource.ROOT) return;
1493
		try {
1814
		try {
(-)src/org/eclipse/team/internal/ccvs/core/resources/FileSystemFile.java (+595 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Red Hat Incorporated - is/setExecutable() code
11
 *******************************************************************************/
12
package org.eclipse.team.internal.ccvs.core.resources;
13
14
import java.io.*;
15
import java.util.*;
16
17
import org.eclipse.core.filesystem.*;
18
import org.eclipse.core.filesystem.URIUtil;
19
import org.eclipse.core.resources.IResource;
20
import org.eclipse.core.runtime.*;
21
import org.eclipse.team.core.RepositoryProvider;
22
import org.eclipse.team.core.TeamException;
23
import org.eclipse.team.internal.ccvs.core.*;
24
import org.eclipse.team.internal.ccvs.core.client.Session;
25
import org.eclipse.team.internal.ccvs.core.syncinfo.*;
26
27
/**
28
 * Represents handles to CVS resource on the local file system. Synchronization
29
 * information is taken from the CVS sub directories. 
30
 */
31
public class FileSystemFile extends FileSystemResource implements ICVSFile {
32
33
	private static final IPath PROJECT_META_DATA_PATH = new Path(".project");//$NON-NLS-1$
34
	
35
	/**
36
	 * Create a handle based on the given local resource.
37
	 */
38
	protected FileSystemFile(IPath resource,
39
			RepositoryProvider repositoryProvider) {
40
		super(resource, repositoryProvider);
41
	}
42
43
	/*
44
	 * @see ICVSResource#delete()
45
	 */
46
	public void delete() throws CVSException {
47
		resource.toFile().delete();
48
	}
49
	
50
	public long getSize() {
51
		return getIOFile().length();	
52
	}
53
54
	public InputStream getContents() throws CVSException {
55
 		try {
56
 			return new FileInputStream(resource.toFile());
57
		} catch (IOException e) {
58
 			throw CVSException.wrapException(e); // 
59
 		}
60
 	}
61
	
62
	/*
63
	 * @see ICVSFile#getTimeStamp()
64
	 */
65
	public Date getTimeStamp() {
66
		long timestamp = getFileInfo().getLastModified();
67
		if( timestamp == IResource.NULL_STAMP) {
68
			// If there is no file, return the same timestamp as ioFile.lastModified() would
69
			return new Date(0L);
70
		}			
71
		return new Date((timestamp/1000)*1000);
72
	}
73
74
	private IFileInfo getFileInfo() {
75
		try {
76
			return EFS.getStore(URIUtil.toURI(resource)).fetchInfo();
77
		} catch (CoreException e) {
78
			return EFS.createFileInfo();
79
		}
80
	}
81
 
82
	/*
83
	 * @see ICVSFile#setTimeStamp(Date)
84
	 */
85
	public void setTimeStamp(Date date) throws CVSException {
86
		long time;
87
		if (date == null) {
88
			time = System.currentTimeMillis();
89
		} else {
90
			time = date.getTime();
91
		}
92
		getFileInfo().setLastModified(time);
93
	}
94
95
	/*
96
	 * @see ICVSFile#isModified()
97
	 */
98
	public boolean isModified(IProgressMonitor monitor) throws CVSException {
99
		
100
		// ignore the monitor, there is no valuable progress to be shown when
101
		// calculating the dirty state for files. It is relatively fast.
102
		
103
		if (!exists()) {
104
			return getSyncBytes() != null;
105
		}
106
		return true;
107
	}
108
	
109
	/*
110
	 * @see ICVSResource#accept(ICVSResourceVisitor)
111
	 */
112
	public void accept(ICVSResourceVisitor visitor) throws CVSException {
113
		visitor.visitFile(this);
114
	}
115
116
	/*
117
	 * @see ICVSResource#accept(ICVSResourceVisitor, boolean)
118
	 */
119
	public void accept(ICVSResourceVisitor visitor, boolean recurse) throws CVSException {
120
		visitor.visitFile(this);
121
	}
122
	
123
	/*
124
	 * This is to be used by the Copy handler. The filename of the form .#filename
125
	 */
126
	public void copyTo(String filename) throws CVSException {
127
		try {
128
	        InputStream in = new FileInputStream(resource.toFile());
129
	        File targetFile = resource.removeLastSegments(1).append(filename).toFile();
130
	        if (targetFile.exists())
131
	        	targetFile.delete();
132
	        OutputStream out = new FileOutputStream(targetFile);
133
	    
134
	        // Transfer bytes from in to out
135
	        byte[] buf = new byte[1024];
136
	        int len;
137
	        while ((len = in.read(buf)) > 0) {
138
	            out.write(buf, 0, len);
139
	        }
140
	        in.close();
141
	        out.close();
142
		} catch(IOException e) {
143
			throw CVSException.wrapException(e);
144
		}
145
	}
146
147
	/*
148
	 * @see ICVSResource#getRemoteLocation()
149
	 */
150
	public String getRemoteLocation(ICVSFolder stopSearching) throws CVSException {
151
		return getParent().getRemoteLocation(stopSearching) + SEPARATOR + getName();
152
	}
153
		
154
	/*
155
	 * @see ICVSFile#setReadOnly()
156
	 */
157
	public void setContents(InputStream stream, int responseType, boolean keepLocalHistory, IProgressMonitor monitor) throws CVSException {
158
		try {
159
			if (PROJECT_META_DATA_PATH.equals(resource.lastSegment())) {
160
				responseType = UPDATED;
161
			}
162
			ByteArrayOutputStream os = new ByteArrayOutputStream();
163
			int nextByte;
164
			while ((nextByte = stream.read() ) != -1) {
165
				os.write((byte) nextByte);
166
			}
167
			switch (responseType) {
168
				case UPDATED:
169
					if (exists()) {
170
						writefile(os);
171
						break;
172
					}
173
				case CREATED: // creating a new file so it should not exist locally
174
				case MERGED: // merging contents into a file that exists locally
175
				case UPDATE_EXISTING: // creating a new file so it should exist locally
176
					writefile(os);
177
					break;
178
			}
179
		} catch(IOException e) {
180
			throw CVSException.wrapException(e);
181
		}
182
	}
183
184
	private void writefile(ByteArrayOutputStream os)
185
			throws FileNotFoundException, IOException {
186
		RandomAccessFile raFile = new RandomAccessFile(getIOFile(), "rw"); //$NON-NLS-1$
187
		raFile.write(os.toByteArray());
188
		raFile.setLength(os.toByteArray().length);
189
		raFile.close();
190
	}
191
			
192
	/*
193
	 * @see ICVSFile#setReadOnly()
194
	 */
195
	public void setReadOnly(boolean readOnly) throws CVSException {
196
		try {
197
			IFileStore fileStore = EFS.getStore(URIUtil.toURI(resource));
198
			if (fileStore != null) {
199
				IFileInfo fileInfo = fileStore.fetchInfo();
200
				if (fileInfo != null)
201
					fileInfo.setAttribute(EFS.ATTRIBUTE_READ_ONLY, readOnly);
202
			}
203
		} catch (CoreException e) {
204
			CVSException.wrapException(e);
205
			}
206
	}
207
208
	/*
209
	 * @see ICVSFile#isReadOnly()
210
	 */
211
	public boolean isReadOnly() throws CVSException {
212
		return !getIOFile().canWrite();
213
	}
214
	
215
	/*
216
	 * @see ICVSFile#setExecutable()
217
	 */
218
	public void setExecutable(boolean executable) throws CVSException {
219
		try {
220
			IFileStore fileStore = EFS.getStore(URIUtil.toURI(resource));
221
			if (fileStore != null) {
222
				IFileInfo fileInfo = fileStore.fetchInfo();
223
				if (fileInfo != null)
224
					fileInfo.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, executable);
225
			}
226
		} catch (CoreException e) {
227
			CVSException.wrapException(e);
228
		}
229
	}
230
231
	/*
232
	 * @see ICVSFile#isExectuable()
233
	 */
234
	public boolean isExecutable() throws CVSException {
235
		try {
236
			IFileStore fileStore = EFS.getStore(URIUtil.toURI(resource));
237
			if (fileStore != null) {
238
				IFileInfo fileInfo = fileStore.fetchInfo();
239
				if (fileInfo != null)
240
					return fileInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE);
241
			}
242
		} catch (CoreException e) {
243
			CVSException.wrapException(e);
244
		}
245
		return false;
246
	}
247
	
248
	/*
249
	 * To allow accessing size and timestamp for the underlying java.io.File
250
	 */
251
	private File getIOFile() {
252
		return resource.toFile();
253
	}
254
	/**
255
	 * @see ICVSFile#getLogEntries(IProgressMonitor)
256
	 */
257
	public ILogEntry[] getLogEntries(IProgressMonitor monitor)	throws TeamException {
258
		byte[] syncBytes = getSyncBytes();
259
		if(syncBytes != null && !ResourceSyncInfo.isAddition(syncBytes)) {
260
			ICVSRemoteResource remoteFile = CVSWorkspaceRoot.getRemoteResourceFor(this);
261
			if (remoteFile != null)
262
				return ((ICVSRemoteFile)remoteFile).getLogEntries(monitor);
263
		}
264
		return new ILogEntry[0];
265
	}
266
	/**
267
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#setNotifyInfo(NotifyInfo)
268
	 */
269
	public void setNotifyInfo(NotifyInfo info) throws CVSException {
270
		if (isManaged()) {
271
			EclipseSynchronizer.getInstance().setNotifyInfo(resource, info);
272
			// On an edit, the base should be cached
273
			// On an unedit, the base should be restored (and cleared?)
274
			// On a commit, the base should be cleared
275
		}
276
	}
277
278
	/**
279
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getNotifyInfo()
280
	 */
281
	public NotifyInfo getNotifyInfo() throws CVSException {
282
		if (isManaged()) {
283
			return EclipseSynchronizer.getInstance().getNotifyInfo(resource);		
284
		}
285
		return null;
286
	}
287
288
	/**
289
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#setNotifyInfo(NotifyInfo)
290
	 */
291
	public void setBaserevInfo(BaserevInfo info) throws CVSException {
292
		if (isManaged()) {
293
			if (info == null) {
294
				EclipseSynchronizer.getInstance().deleteBaserevInfo(resource);
295
				EclipseSynchronizer.getInstance().deleteFileFromBaseDirectory(resource, null);
296
			} else
297
				EclipseSynchronizer.getInstance().setBaserevInfo(resource, info);
298
		}
299
	}
300
	/**
301
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getNotifyInfo()
302
	 */
303
	public BaserevInfo getBaserevInfo() throws CVSException {
304
		if (isManaged()) {
305
			return EclipseSynchronizer.getInstance().getBaserevInfo(resource);
306
		}
307
		return null;
308
	}
309
	
310
	/**
311
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#checkout(int)
312
	 */
313
	public void edit(final int notifications, boolean notifyForWritable, IProgressMonitor monitor) throws CVSException {
314
		if (!notifyForWritable && !isReadOnly()) return;
315
		run(new ICVSRunnable() {
316
			public void run(IProgressMonitor monitor) throws CVSException {
317
				byte[] syncBytes = getSyncBytes();
318
				if (syncBytes == null || ResourceSyncInfo.isAddition(syncBytes)) return;
319
				
320
				// convert the notifications to internal form
321
				char[] internalFormat;
322
				if (notifications == NO_NOTIFICATION) {
323
					internalFormat = null;
324
				} else if (notifications == NOTIFY_ON_ALL) {
325
					internalFormat = NotifyInfo.ALL;
326
				} else {
327
					List notificationCharacters = new ArrayList();
328
					if ((notifications & NOTIFY_ON_EDIT) >0) 
329
						notificationCharacters.add(new Character(NotifyInfo.EDIT));
330
					if ((notifications & NOTIFY_ON_UNEDIT) >0) 
331
						notificationCharacters.add(new Character(NotifyInfo.UNEDIT));
332
					if ((notifications & NOTIFY_ON_COMMIT) >0) 
333
						notificationCharacters.add(new Character(NotifyInfo.COMMIT));
334
					internalFormat = new char[notificationCharacters.size()];
335
					for (int i = 0; i < internalFormat.length; i++) {
336
						internalFormat[i] = ((Character)notificationCharacters.get(i)).charValue();
337
					}
338
				}
339
				
340
				// record the notification
341
				NotifyInfo notifyInfo = new NotifyInfo(getName(), NotifyInfo.EDIT, new Date(), internalFormat);
342
				setNotifyInfo(notifyInfo);
343
				
344
				// Only record the base if the file is not modified
345
				if (!isModified(null)) {
346
					EclipseSynchronizer.getInstance().copyFileToBaseDirectory(resource, monitor);
347
					setBaserevInfo(new BaserevInfo(getName(), ResourceSyncInfo.getRevision(syncBytes)));
348
				}
349
				
350
				try {
351
                    // allow editing
352
                    setReadOnly(false);
353
                } catch (CVSException e) {
354
                    // Just log and keep going
355
                    CVSProviderPlugin.log(e);
356
                }
357
			}
358
		}, monitor);
359
		
360
	}
361
362
	/**
363
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#uncheckout()
364
	 */
365
	public void unedit(IProgressMonitor monitor) throws CVSException {
366
		if (isReadOnly()) return;
367
		run(new ICVSRunnable() {
368
			public void run(IProgressMonitor monitor) throws CVSException {
369
				// record the notification
370
				NotifyInfo info = getNotifyInfo();
371
				if (info != null && info.getNotificationType() == NotifyInfo.EDIT) {
372
					info = null;
373
				} else {
374
					info = new NotifyInfo(getName(), NotifyInfo.UNEDIT, new Date(), null);
375
				}
376
				setNotifyInfo(info);
377
					
378
				if (isModified(null)) {
379
					ResourceSyncInfo syncInfo = getSyncInfo();
380
					BaserevInfo baserevInfo = getBaserevInfo();
381
					EclipseSynchronizer.getInstance().restoreFileFromBaseDirectory(resource, monitor);
382
					// reset any changes that may have been merged from the server
383
					if (!syncInfo.getRevision().equals(baserevInfo.getRevision())) {
384
						MutableResourceSyncInfo newInfo = syncInfo.cloneMutable();
385
						newInfo.setRevision(baserevInfo.getRevision());
386
						newInfo.setTimeStamp(getTimeStamp());
387
						newInfo.setDeleted(false);
388
						setSyncInfo(newInfo, ICVSFile.CLEAN);
389
					} else {
390
						// an unedited file is no longer modified
391
						// external files have no modified states
392
						//EclipseSynchronizer.getInstance().setModified(resource, CLEAN);
393
					}
394
				} else {
395
					// We still need to report a state change
396
					setSyncBytes(getSyncBytes(), ICVSFile.CLEAN);
397
				}
398
				setBaserevInfo(null);
399
					
400
				try {
401
                    // prevent editing
402
                    setReadOnly(true);
403
                } catch (CVSException e) {
404
                    // Just log and keep going
405
                    CVSProviderPlugin.log(e);
406
                }
407
			}
408
		}, monitor);
409
	}
410
411
	/**
412
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#notificationCompleted()
413
	 */
414
	public void notificationCompleted() throws CVSException {
415
		EclipseSynchronizer.getInstance().deleteNotifyInfo(resource);
416
	}
417
418
	/**
419
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getPendingNotification()
420
	 */
421
	public NotifyInfo getPendingNotification() throws CVSException {
422
		return getNotifyInfo();
423
	}
424
	
425
	/* (non-Javadoc)
426
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#checkedIn(java.lang.String)
427
	 */
428
	public void checkedIn(String entryLine, boolean commit) throws CVSException {
429
		ResourceSyncInfo oldInfo = getSyncInfo();
430
		ResourceSyncInfo newInfo = null;
431
		int modificationState = ICVSFile.CLEAN;
432
		if (entryLine == null) {
433
			// cvs commit: the file contents matched the server contents so no entry line was sent
434
			if (oldInfo == null) return;
435
			// We should never make the timestamp go backwards so we'll set
436
			// the entry line timestamp to match that of the file
437
			if(! oldInfo.isAdded()) {
438
				MutableResourceSyncInfo mutable = oldInfo.cloneMutable();
439
				mutable.setTimeStamp(getTimeStamp(), true /* clear merged */);
440
				newInfo = mutable;
441
			}
442
			// (modified = false) the file will be no longer modified
443
		} else if (oldInfo == null) {
444
			// cvs add: addition of a file
445
			newInfo = new ResourceSyncInfo(entryLine, null);
446
			// an added file should show up as modified
447
			modificationState = ICVSFile.DIRTY;
448
		} else {
449
			// cvs commit: commit of a changed file
450
		    // cvs update: update of a file whose contents match the server contents
451
		    Date timeStamp;
452
		    if (commit) {
453
		        // This is a commit. Put the file timestamp in the entry
454
		        timeStamp = getTimeStamp();
455
		    } else {
456
		        // This is an update. We need to change the tiemstamp in the
457
                // entry file to match the file timestamp returned by Java
458
		        timeStamp = oldInfo.getTimeStamp();
459
		        if (timeStamp == null) {
460
		            timeStamp = getTimeStamp();
461
		        } else {
462
                    // First, set the timestamp of the file to the timestamp from the entry
463
                    // There is a chance this will do nothing as the call to Java on some
464
                    // file systems munges the timestamps
465
		            setTimeStamp(timeStamp);
466
                    // To compensate for the above, reset the timestamp in the entry
467
                    // to match the timestamp in the file
468
                    timeStamp = getTimeStamp();
469
		        }
470
		    }
471
	        newInfo = new ResourceSyncInfo(entryLine, timeStamp);
472
			
473
		}
474
		//see bug 106876
475
		if (newInfo != null){
476
			CVSTag tag = newInfo.getTag();
477
			if(tag != null && CVSEntryLineTag.BASE.getName().equals(tag.getName())){
478
				newInfo = newInfo.cloneMutable();
479
				((MutableResourceSyncInfo)newInfo).setTag(oldInfo.getTag());
480
			}
481
			setSyncInfo(newInfo, modificationState);
482
		}
483
		clearCachedBase();
484
	}
485
	
486
	private void clearCachedBase() throws CVSException {
487
		BaserevInfo base = getBaserevInfo();
488
		if (base != null) {
489
			setBaserevInfo(null);
490
			try {
491
                setReadOnly(true);
492
            } catch (CVSException e) {
493
                // Just log and keep going
494
                CVSProviderPlugin.log(e);
495
            }
496
		} else {
497
            // Check to see if watch-edit is enabled for the project
498
            if (repositoryProvider != null && ((CVSTeamProvider) repositoryProvider).isWatchEditEnabled()) {
499
                try {
500
                    setReadOnly(true);
501
                } catch (CVSException e) {
502
                    // Just log and keep going
503
                    CVSProviderPlugin.log(e);
504
                }
505
            }
506
        }
507
	}
508
509
	/**
510
	 * @see org.eclipse.team.internal.ccvs.core.ICVSResource#unmanage(org.eclipse.core.runtime.IProgressMonitor)
511
	 */
512
	public void unmanage(IProgressMonitor monitor) throws CVSException {
513
		run(new ICVSRunnable() {
514
			public void run(IProgressMonitor monitor) throws CVSException {
515
				FileSystemFile.super.unmanage(monitor);
516
				clearCachedBase();
517
			}
518
		}, monitor);
519
	}
520
	
521
	/**
522
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#isEdited()
523
	 */
524
	public boolean isEdited() throws CVSException {
525
		return EclipseSynchronizer.getInstance().isEdited(resource);
526
	}
527
528
	/**
529
	 * @see org.eclipse.team.internal.ccvs.core.ICVSResource#setSyncInfo(org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo)
530
	 */
531
	public void setSyncInfo(ResourceSyncInfo info, int modificationState) throws CVSException {
532
		setSyncBytes(info.getBytes(), info, modificationState);
533
	}
534
	
535
	/**
536
	 * @see ICVSResource#isFolder()
537
	 */
538
	public boolean isFolder() {
539
		return false;
540
	}
541
542
	/**
543
	 * @see org.eclipse.team.internal.ccvs.core.resources.EclipseResource#setSyncBytes(byte[], int)
544
	 */
545
	public void setSyncBytes(byte[] syncBytes, int modificationState) throws CVSException {
546
		setSyncBytes(syncBytes, null, modificationState);
547
	}
548
	
549
	/*
550
	 * @see org.eclipse.team.internal.ccvs.core.resources.EclipseResource#setSyncBytes(byte[], int)
551
	 */
552
	private void setSyncBytes(byte[] syncBytes, ResourceSyncInfo info, int modificationState) throws CVSException {
553
		Assert.isNotNull(syncBytes);
554
		setSyncBytes(syncBytes);
555
		// external files have no modified states
556
		//EclipseSynchronizer.getInstance().setModified(this, modificationState);
557
	}
558
	
559
	public void handleModification(boolean forAddition) throws CVSException {
560
		// external files have no modified states
561
	}
562
563
	/* (non-Javadoc)
564
	 * @see org.eclipse.team.internal.ccvs.core.ICVSResource#getRepositoryRelativePath()
565
	 */
566
	public String getRepositoryRelativePath() throws CVSException {
567
		if (!isManaged()) return null;
568
		String parentPath = getParent().getRepositoryRelativePath();
569
		if (parentPath == null) return null;
570
		return parentPath + Session.SERVER_SEPARATOR + getName();
571
	}
572
	
573
	protected boolean isDirty() throws CVSException {
574
		boolean dirty;
575
		byte[] syncBytes = getSyncBytes();
576
		if (syncBytes == null) {
577
			dirty = exists();
578
		} else {
579
			// isMerged() must be called because when a file is updated and merged by the cvs server the timestamps
580
			// are equal. Merged files should however be reported as dirty because the user should take action and commit
581
			// or review the merged contents.
582
			if(ResourceSyncInfo.isAddition(syncBytes) || ResourceSyncInfo.isMerge(syncBytes) || !exists()) {
583
				dirty = true;
584
			} else {
585
				// TODO: non-optimal as ResourceSyncInfo is created each time
586
				ResourceSyncInfo info = new ResourceSyncInfo(syncBytes);
587
				dirty = !getTimeStamp().equals(info.getTimeStamp());
588
			}
589
		}
590
		return dirty;
591
	}
592
593
}
594
595
(-)src/org/eclipse/team/internal/ccvs/core/resources/FileSystemFolder.java (+363 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ccvs.core.resources;
12
13
import java.io.File;
14
import java.util.ArrayList;
15
import java.util.List;
16
17
import org.eclipse.core.filesystem.*;
18
import org.eclipse.core.filesystem.URIUtil;
19
import org.eclipse.core.resources.*;
20
import org.eclipse.core.runtime.*;
21
import org.eclipse.osgi.util.NLS;
22
import org.eclipse.team.core.RepositoryProvider;
23
import org.eclipse.team.internal.ccvs.core.*;
24
import org.eclipse.team.internal.ccvs.core.client.Session;
25
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
26
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
27
import org.eclipse.team.internal.ccvs.core.util.Util;
28
29
/**
30
 * Implements the ICVSFolder interface on top of an 
31
 * instance of the ICVSFolder interface
32
 * 
33
 * @see ICVSFolder
34
 */
35
class FileSystemFolder extends FileSystemResource implements ICVSFolder {
36
37
	protected FileSystemFolder(IPath resource, RepositoryProvider repositoryProvider) {
38
		super(resource, repositoryProvider);		
39
	}
40
	
41
	/**
42
	 * @see ICVSFolder#members(int)
43
	 */
44
	public ICVSResource[] members(int flags) throws CVSException {		
45
		final List result = new ArrayList();
46
		File resources[] = resource.toFile().listFiles();
47
		boolean includeFiles = (((flags & FILE_MEMBERS) != 0) || ((flags & (FILE_MEMBERS | FOLDER_MEMBERS)) == 0));
48
		boolean includeFolders = (((flags & FOLDER_MEMBERS) != 0) || ((flags & (FILE_MEMBERS | FOLDER_MEMBERS)) == 0));
49
		boolean includeManaged = (((flags & MANAGED_MEMBERS) != 0) || ((flags & (MANAGED_MEMBERS | UNMANAGED_MEMBERS | IGNORED_MEMBERS)) == 0));
50
		boolean includeUnmanaged = (((flags & UNMANAGED_MEMBERS) != 0) || ((flags & (MANAGED_MEMBERS | UNMANAGED_MEMBERS | IGNORED_MEMBERS)) == 0));
51
		boolean includeIgnored = ((flags & IGNORED_MEMBERS) != 0);
52
		boolean includeExisting = (((flags & EXISTING_MEMBERS) != 0) || ((flags & (EXISTING_MEMBERS | PHANTOM_MEMBERS)) == 0));
53
		boolean includePhantoms = (((flags & PHANTOM_MEMBERS) != 0) || ((flags & (EXISTING_MEMBERS | PHANTOM_MEMBERS)) == 0));
54
		for (int i = 0; i < resources.length; i++) {
55
			File resource = resources[i];
56
            if ((includeFiles && resource.isFile()) 
57
					|| (includeFolders && resource.isDirectory())) {
58
                boolean exists = resource.exists();
59
                if ((includeExisting && exists) || (includePhantoms && !exists)) {
60
                    ICVSResource cvsResource = CVSFileSystemRoot.getCVSResourceFor(new Path(resource.getAbsolutePath()), repositoryProvider);
61
                    boolean includeResource = false;
62
                    if ((includeManaged && includeUnmanaged && includeIgnored)) {
63
                        includeResource = true;
64
                    } else {
65
        				boolean isManaged = cvsResource.isManaged();
66
                        if (isManaged && includeManaged) {
67
                            includeResource = true;
68
                        } else if (exists) {
69
            				boolean isIgnored = cvsResource.isIgnored();
70
                            if (isIgnored && includeIgnored) {
71
                                includeResource = true;
72
                            } else if (! isManaged && ! isIgnored && includeUnmanaged) {
73
                                includeResource = true;
74
            				}
75
                        }
76
                    }
77
                    if (includeResource) {
78
                        result.add(cvsResource);
79
                    }
80
                }
81
			}		
82
		}	
83
		return (ICVSResource[]) result.toArray(new ICVSResource[result.size()]);
84
	}
85
86
	public boolean isManaged() throws CVSException {
87
		boolean result = super.isManaged();
88
		if (!result) {
89
			FolderSyncInfo info = getFolderSyncInfo();
90
			if (info != null) // returns true is this is the root of the file system CVS repository
91
				result = info.getRepository().equals(resource.lastSegment());  
92
		}
93
		return result;
94
	}
95
96
	/**
97
	 * @see ICVSFolder#createFolder(String)
98
	 */
99
	public ICVSFolder getFolder(String name) throws CVSException {
100
		if ((CURRENT_LOCAL_FOLDER.equals(name)) || ((CURRENT_LOCAL_FOLDER + SEPARATOR).equals(name)))
101
			return this;
102
		IPath folderLocation = resource.append(name);
103
		IProject project = repositoryProvider.getProject();
104
		if (project != null) {
105
			IContainer[]folders = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(URIUtil.toURI(folderLocation));
106
			if (folders.length > 0) {
107
				for (int i = 0; i < folders.length; i++) {
108
					if (folders[i].getProject().equals(project))
109
						return new EclipseFolder(folders[i]);
110
				}
111
			}
112
		}
113
		return new FileSystemFolder(folderLocation, repositoryProvider);
114
	}
115
116
	/**
117
	 * @see ICVSFolder#createFile(String)
118
	 */
119
	public ICVSFile getFile(String name) throws CVSException {
120
		IPath fileLocation = resource.append(name);
121
		IProject project = repositoryProvider.getProject();
122
		if (project != null) {
123
			IFile[]files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(URIUtil.toURI(fileLocation));
124
			if (files.length > 0) {
125
				for (int i = 0; i < files.length; i++) {
126
					if (files[i].exists() && files[i].getProject().equals(project))
127
						return new EclipseFile(files[i]);
128
				}
129
			}
130
		}
131
		return new FileSystemFile(fileLocation, repositoryProvider);
132
	}
133
134
	/**
135
	 * @see ICVSFolder#mkdir()
136
	 */
137
	public void mkdir() throws CVSException {
138
		resource.toFile().mkdir();
139
		// EclipseSynchronizer.getInstance().created(resource);;
140
	}
141
		
142
	/**
143
	 * @see ICVSResource#isFolder()
144
	 */
145
	public boolean isFolder() {
146
		return true;
147
	}
148
		
149
	/**
150
	 * @see ICVSFolder#acceptChildren(ICVSResourceVisitor)
151
	 */
152
	public void acceptChildren(ICVSResourceVisitor visitor) throws CVSException {
153
		
154
		// Visit files and then folders
155
		ICVSResource[] subFiles = members(FILE_MEMBERS);
156
		for (int i=0; i<subFiles.length; i++) {
157
			subFiles[i].accept(visitor);
158
		}
159
		ICVSResource[] subFolders = members(FOLDER_MEMBERS);
160
		for (int i=0; i<subFolders.length; i++) {
161
			subFolders[i].accept(visitor);
162
		}
163
	}
164
165
	/**
166
	 * @see ICVSResource#accept(ICVSResourceVisitor)
167
	 */
168
	public void accept(ICVSResourceVisitor visitor) throws CVSException {
169
		visitor.visitFolder(this);
170
	}
171
	
172
	/**
173
	 * @see ICVSResource#accept(ICVSResourceVisitor, boolean)
174
	 */
175
	public void accept(ICVSResourceVisitor visitor, boolean recurse) throws CVSException {
176
		visitor.visitFolder(this);
177
		ICVSResource[] resources;
178
		if (recurse) {
179
			resources = members(ICVSFolder.ALL_MEMBERS);
180
		} else {
181
			resources = members(ICVSFolder.FILE_MEMBERS);
182
		}
183
		for (int i = 0; i < resources.length; i++) {
184
			resources[i].accept(visitor, recurse);
185
		}
186
	}
187
188
	/**
189
	 * @see ICVSResource#getRemoteLocation(ICVSFolder)
190
	 */
191
	public String getRemoteLocation(ICVSFolder stopSearching) throws CVSException {
192
				
193
		if (getFolderSyncInfo() != null) {
194
			return getFolderSyncInfo().getRemoteLocation();
195
		}			
196
197
		ICVSFolder parent = getParent();
198
		if(parent!=null && !equals(stopSearching)) {
199
			String parentLocation;
200
			parentLocation = parent.getRemoteLocation(stopSearching);
201
			if (parentLocation!=null) {
202
				return parentLocation + SEPARATOR + getName();
203
			}		
204
		}
205
		return null;
206
	}
207
208
	/*
209
	 * @see ICVSFolder#getFolderInfo()
210
	 */
211
	public FolderSyncInfo getFolderSyncInfo() throws CVSException {
212
		return EclipseSynchronizer.getInstance().getFolderSync(resource);
213
	}
214
215
	/*
216
	 * @see ICVSFolder#setFolderInfo(FolderSyncInfo)
217
	 */
218
	public void setFolderSyncInfo(final FolderSyncInfo folderInfo) throws CVSException {
219
		// ignore folder sync on the root (i.e. CVSROOT/config/TopLevelAdmin=yes but we just ignore it)
220
		if (resource.isRoot()) return;
221
		run(new ICVSRunnable() {
222
			public void run(IProgressMonitor monitor) throws CVSException {
223
				EclipseSynchronizer synchronizer = EclipseSynchronizer.getInstance();
224
				IResource workspaceResource = getIResource();
225
				if (workspaceResource != null)
226
					synchronizer.setFolderSync((IContainer)workspaceResource, folderInfo);
227
				else
228
					synchronizer.setFolderSync(resource, folderInfo);
229
				// the server won't add directories as sync info, therefore it must be done when
230
				// a directory is shared with the repository.
231
				byte[] newSyncBytes = new ResourceSyncInfo(getName()).getBytes();
232
				byte[] oldSyncBytes = getSyncBytes();
233
				// only set the bytes if the new differs from the old.
234
				// this avoids unnecessary saving of sync files
235
				if (oldSyncBytes == null || ! Util.equals(newSyncBytes, oldSyncBytes))
236
					setSyncBytes(newSyncBytes);
237
			}
238
		}, null);
239
240
	}
241
242
	/*
243
	 * @see ICVSFolder#isCVSFolder()
244
	 */
245
	public boolean isCVSFolder() throws CVSException {
246
		return EclipseSynchronizer.getInstance().getFolderSync(resource) != null;
247
	}
248
249
	/*
250
	 * @see ICVSResource#unmanage()
251
	 */
252
	public void unmanage(IProgressMonitor monitor) throws CVSException {
253
		run(new ICVSRunnable() {
254
			public void run(IProgressMonitor monitor) throws CVSException {
255
				monitor = Policy.monitorFor(monitor);
256
				monitor.beginTask(null, 100);
257
				recursiveUnmanage(resource.toFile(), Policy.subMonitorFor(monitor, 99));
258
				FileSystemFolder.super.unmanage(Policy.subMonitorFor(monitor, 1));
259
				monitor.done();	
260
			}
261
		}, Policy.subMonitorFor(monitor, 99));
262
	}
263
	
264
	/* private */ static void recursiveUnmanage(File container, IProgressMonitor monitor) {
265
		try {
266
			monitor.beginTask(null, 10);
267
			monitor.subTask(NLS.bind(CVSMessages.EclipseFolder_0, new String[] {container.getAbsolutePath()}));
268
	
269
			File[] members = container.listFiles();
270
			for (int i = 0; i < members.length; i++) {
271
				monitor.worked(1);
272
				File resource = members[i];
273
				if (resource.isFile()) {
274
					if (!resource.canWrite()) {
275
						try {
276
							IFileStore fileStore = EFS.getStore(resource.toURI());
277
							if (fileStore != null) {
278
								IFileInfo fileInfo = fileStore.fetchInfo();
279
								if (fileInfo != null)
280
									fileInfo.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false);
281
							}
282
						} catch (CoreException e) {
283
							CVSException.wrapException(e);
284
						}
285
					}
286
                } else {
287
					recursiveUnmanage(resource, monitor);
288
				}
289
			}
290
		} finally {
291
			monitor.done();
292
		}
293
	}
294
	
295
	/*
296
	 * @see ICVSResource#isIgnored()
297
	 */
298
	public boolean isIgnored() throws CVSException {
299
		if(isCVSFolder()) {
300
			return false;
301
		}		
302
		return super.isIgnored();
303
	}
304
	
305
	/*
306
	 * @see ICVSFolder#getChild(String)
307
	 */
308
	public ICVSResource getChild(String namedPath) throws CVSException {
309
	    if (namedPath.equals(Session.CURRENT_LOCAL_FOLDER)) {
310
	        return this;
311
	    }
312
	    IPath newPath = resource.append(namedPath);
313
		if(newPath.toFile().isFile())
314
			return getFile(namedPath);
315
		else
316
			return new FileSystemFolder(newPath, repositoryProvider);
317
	}
318
	
319
	/**
320
	 * @see ICVSFolder#fetchChildren(IProgressMonitor)
321
	 */
322
	public ICVSResource[] fetchChildren(IProgressMonitor monitor) throws CVSException {
323
		return members(FILE_MEMBERS | FOLDER_MEMBERS);
324
	}
325
	/**
326
	 * @see org.eclipse.team.internal.ccvs.core.ICVSResource#delete()
327
	 */
328
	public void delete() throws CVSException {
329
		if (!exists()) return;
330
		resource.toFile().delete();
331
	}
332
	
333
	/**
334
	 * Assumption this is only called from decorator and isIgnored() is purposely
335
	 * omitted here for performance reasons. 
336
	 */
337
	public boolean isModified(IProgressMonitor monitor) throws CVSException {
338
		return false;
339
	}
340
	
341
	public void handleModification(boolean forAddition) throws CVSException {
342
		// For non-additions, we are only interested in sync info changes
343
		if (isIgnored() || !forAddition) return;
344
345
		// the folder is an addition.
346
		FolderSyncInfo info = getFolderSyncInfo();
347
		// if the folder has sync info, it was handled is setFolderInfo
348
		// otherwise, flush the ancestors to recalculate
349
		if (info == null) {
350
			EclipseSynchronizer.getInstance().setDirtyIndicator(getIResource(), true);
351
		}
352
	}
353
	
354
	/* (non-Javadoc)
355
	 * @see org.eclipse.team.internal.ccvs.core.ICVSResource#getRepositoryRelativePath()
356
	 */
357
	public String getRepositoryRelativePath() throws CVSException {
358
		FolderSyncInfo info = getFolderSyncInfo();
359
		if (info == null) return null;
360
		// The REPOSITORY property of the folder info is the repository relative path
361
		return info.getRepository();
362
	}
363
}
(-)src/org/eclipse/team/internal/ccvs/core/resources/FileSystemResource.java (+304 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ccvs.core.resources;
12
13
14
import java.net.URI;
15
16
import org.eclipse.core.filesystem.URIUtil;
17
import org.eclipse.core.resources.*;
18
import org.eclipse.core.runtime.*;
19
import org.eclipse.team.core.RepositoryProvider;
20
import org.eclipse.team.internal.ccvs.core.*;
21
import org.eclipse.team.internal.ccvs.core.client.Session;
22
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
23
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
24
import org.eclipse.team.internal.ccvs.core.util.Util;
25
26
27
/**
28
 * Represents handles to CVS resource on the local file system. Synchronization
29
 * information is taken from the CVS sub directories. 
30
 * 
31
 * @see LocalFolder
32
 * @see LocalFile
33
 */
34
abstract class FileSystemResource implements ICVSResource, Comparable {
35
36
	// The separator that must be used when creating CVS resource paths. Never use
37
	 // the platform default separator since it is not compatible with CVS resources.
38
	protected static final String SEPARATOR = Session.SERVER_SEPARATOR;
39
	protected static final String CURRENT_LOCAL_FOLDER = Session.CURRENT_LOCAL_FOLDER;
40
		
41
	/*
42
	 * The local resource represented by this handle
43
	 */
44
	IPath resource;
45
	IResource cachedResource = null;
46
	boolean cachedResourceInitialized = false;
47
	RepositoryProvider repositoryProvider;
48
	
49
	public FileSystemResource(IPath resource,
50
			RepositoryProvider repositoryProvider) {
51
		this.resource = resource;
52
		this.repositoryProvider = repositoryProvider;
53
	}
54
55
	/*
56
	 * Get the extention of the path of resource relative to the path of root
57
	 * 
58
	 * @throws CVSException if root is not a root-folder of resource
59
	 */
60
	public String getRelativePath(ICVSFolder root) throws CVSException {
61
		try {
62
			String result;
63
			result = Util.getRelativePath(root.getLocation(), getLocation());
64
			if (result.length() == 0) return CURRENT_LOCAL_FOLDER;
65
			return result;	
66
		} catch (ClassCastException e) {
67
			IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, CVSMessages.EclipseResource_invalidResourceClass, e, root);
68
			throw new CVSException(status); 
69
		}
70
	}
71
72
	/*
73
	 * @see ICVSResource#exists()
74
	 */
75
	public boolean exists() {
76
		return resource.toFile().exists();
77
	}
78
79
	/*
80
	 * Returns the parent folder of this resource of <code>null</code> if resource
81
	 * the resource.
82
	 * 
83
	 * @see ICVSResource#getParent()
84
	 */
85
	public ICVSFolder getParent() {
86
		if (resource.isRoot())
87
			return null;
88
		IPath newResource = resource.removeLastSegments(1);
89
		return new FileSystemFolder(newResource, repositoryProvider);
90
	}
91
92
	/*
93
	 * @see ICVSResource#getName()
94
	 */
95
	public String getName() {
96
		return resource.lastSegment();
97
	}
98
99
	/*
100
	 * @see ICVSResource#isIgnored()
101
	 */
102
	public boolean isIgnored() throws CVSException {
103
		// a managed resource is never ignored
104
		if(isManaged() || resource.isRoot()) {
105
			return false;
106
		}
107
108
		// always ignore CVS
109
		String name = getName();
110
		if (name.equals("CVS")) return true; //$NON-NLS-1$
111
112
		/* do something with the ignore files
113
		// check ignore patterns from the .cvsignore file.
114
		if(EclipseSynchronizer.getInstance().isIgnored(resource)) {
115
			return true;
116
		}
117
		*/
118
119
		// check the parent, if the parent is ignored or mapped to CVSROOT/Emptydir
120
		// then this resource is ignored also
121
		ICVSFolder parent = getParent();
122
		if(parent==null) return false;
123
		if (parent.isIgnored()) return true;
124
		FolderSyncInfo info = parent.getFolderSyncInfo();
125
		if (info == null) return false;
126
		return info.isVirtualDirectory();
127
	}
128
	
129
	/*
130
	 * @see ICVSResource#setIgnoredAs(String)
131
	 */
132
	public void setIgnoredAs(final String pattern) throws CVSException {
133
		Assert.isTrue(false);
134
	}
135
136
	/*
137
	 * @see ICVSResource#isManaged()
138
	 */
139
	public boolean isManaged() throws CVSException {
140
		return isManaged(getSyncBytes());
141
	}
142
	
143
	/*
144
	 * Helper method that captures the sematics of isManaged given a ResourceSyncInfo
145
	 */
146
	public boolean isManaged(byte[] syncBytes) {
147
		return syncBytes != null;
148
	}
149
	
150
	/**
151
	 * Two ManagedResources are equal, if there cvsResources are
152
	 * equal (and that is, if the point to the same file)
153
	 */
154
	public boolean equals(Object obj) {
155
		
156
		if (!(obj instanceof ICVSResource)) {
157
			return false;
158
		} else {
159
			return getLocation().equals(((ICVSResource) obj).getLocation());
160
		}
161
	}
162
			
163
	/*
164
	 * @see ICVSResource#getPath()
165
	 */
166
	public String getPath() {
167
		return resource.toString();
168
	}	
169
	
170
	public IPath getLocation() {
171
		return resource;
172
	}	
173
	
174
	/*
175
	 * @see ICVSResource#isFolder()
176
	 */
177
	public boolean isFolder() {
178
		return resource.toFile().isDirectory();
179
	}
180
	
181
	/*
182
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getSyncBytes()
183
	 */
184
	public byte[] getSyncBytes() throws CVSException {
185
		return EclipseSynchronizer.getInstance().getSyncBytes(resource);
186
	}
187
	
188
	/*
189
	 * @see org.eclipse.team.internal.ccvs.core.ICVSFile#setSyncBytes(byte[])
190
	 */
191
	public void setSyncBytes(byte[] syncBytes) throws CVSException {
192
		if (getParent().isCVSFolder()) {
193
			IResource workspaceResource = getIResource();
194
			if (workspaceResource != null)
195
				EclipseSynchronizer.getInstance().setSyncBytes(workspaceResource, syncBytes);
196
			else
197
				EclipseSynchronizer.getInstance().setSyncBytes(resource, syncBytes);
198
		}
199
	}
200
	
201
	/*
202
	 * @see ICVSResource#getSyncInfo()
203
	 */
204
	public ResourceSyncInfo getSyncInfo() throws CVSException {
205
		return EclipseSynchronizer.getInstance().getResourceSync(resource);
206
	}
207
	
208
	/*
209
	 * Implement the hashcode on the underlying strings, like it is done in the equals.
210
	 */
211
	public int hashCode() {
212
		return getPath().hashCode();
213
	}	
214
	
215
	/*
216
	 * Give the pathname back
217
	 */
218
	public String toString() {
219
		return getPath();
220
	}
221
	
222
	/*
223
	 * @see ICVSResource#unmanage()
224
	 */
225
	public void unmanage(IProgressMonitor monitor) throws CVSException {
226
		EclipseSynchronizer.getInstance().deleteResourceSync(resource);
227
	}
228
	
229
	/*
230
	 * @see Comparable#compareTo(Object)
231
	 */
232
	public int compareTo(Object arg0) {
233
		ICVSResource other = (ICVSResource)arg0;
234
		return getLocation().toString().compareTo(other.getLocation().toString());
235
	}
236
237
	/**
238
	 * @see org.eclipse.team.internal.ccvs.core.ICVSResource#getIResource()
239
	 */
240
	public IResource getIResource() {
241
		if (!cachedResourceInitialized) {
242
			cachedResourceInitialized = true;
243
			URI uri = URIUtil.toURI(resource);
244
			IFile files[] = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(uri);
245
			if (files.length > 0 && files[0].exists())
246
				cachedResource = files[0];
247
			else {
248
				IContainer containers[] = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(uri);
249
				if (containers.length > 0 && containers[0].exists())
250
					cachedResource = containers[0];
251
			}
252
		}
253
		return cachedResource;
254
	}
255
256
	/**
257
	 * Called by a resource change listener when a resource is changed or added. This allows
258
	 * CVS resources to adjust any internal state based on the change.
259
	 * 
260
	 * @param forAddition modification is an addition
261
	 * @throws CVSException
262
	 */
263
	public abstract void handleModification(boolean forAddition) throws CVSException;
264
	
265
	public void run(final ICVSRunnable job, IProgressMonitor monitor) throws CVSException {
266
		final IProject project = repositoryProvider.getProject();
267
		if (project != null) {
268
			final CVSException[] error = new CVSException[1];
269
			try {
270
				// Do not use a scheduling rule in the workspace run since one
271
				// will be obtained by the EclipseSynchronizer
272
				ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
273
					public void run(IProgressMonitor monitor) throws CoreException {
274
						try {
275
							EclipseSynchronizer.getInstance().run(project, job, monitor);
276
						} catch(CVSException e) {
277
							error[0] = e; 
278
						}
279
					}
280
				}, null /* no rule */, 0, monitor);
281
			} catch(CoreException e) {
282
				throw CVSException.wrapException(e);
283
			}
284
			if(error[0]!=null) {
285
				throw error[0];
286
			}
287
		}
288
		else {
289
			final CVSException[] error = new CVSException[1];
290
			try {
291
				job.run(monitor);
292
			} catch(CVSException e) {
293
				error[0] = e; 
294
			}
295
			if(error[0]!=null) {
296
				throw error[0];
297
			}
298
		}
299
	}
300
301
	public RepositoryProvider getProvider() {
302
		return repositoryProvider;
303
	}
304
}
(-)src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java (+5 lines)
Lines 18-23 Link Here
18
import org.eclipse.core.resources.IFile;
18
import org.eclipse.core.resources.IFile;
19
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.resources.IResource;
20
import org.eclipse.core.runtime.*;
20
import org.eclipse.core.runtime.*;
21
import org.eclipse.team.core.RepositoryProvider;
21
import org.eclipse.team.core.TeamException;
22
import org.eclipse.team.core.TeamException;
22
import org.eclipse.team.core.history.IFileRevision;
23
import org.eclipse.team.core.history.IFileRevision;
23
import org.eclipse.team.core.variants.CachedResourceVariant;
24
import org.eclipse.team.core.variants.CachedResourceVariant;
Lines 687-690 Link Here
687
		ResourceSyncInfo info = getSyncInfo();
688
		ResourceSyncInfo info = getSyncInfo();
688
		return new CVSURI(getRepository(), new Path(getRepositoryRelativePath()), info.getTag(), info.getRevision());
689
		return new CVSURI(getRepository(), new Path(getRepositoryRelativePath()), info.getTag(), info.getRevision());
689
	}
690
	}
691
692
	public RepositoryProvider getProvider() {
693
		return null;
694
	}
690
}
695
}
(-)src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java (+9 lines)
Lines 17-22 Link Here
17
import org.eclipse.core.resources.IResource;
17
import org.eclipse.core.resources.IResource;
18
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
19
import org.eclipse.osgi.util.NLS;
19
import org.eclipse.osgi.util.NLS;
20
import org.eclipse.team.core.RepositoryProvider;
20
import org.eclipse.team.core.TeamException;
21
import org.eclipse.team.core.TeamException;
21
import org.eclipse.team.internal.ccvs.core.*;
22
import org.eclipse.team.internal.ccvs.core.*;
22
import org.eclipse.team.internal.ccvs.core.client.*;
23
import org.eclipse.team.internal.ccvs.core.client.*;
Lines 594-598 Link Here
594
	protected void fetchContents(IProgressMonitor monitor) throws TeamException {
595
	protected void fetchContents(IProgressMonitor monitor) throws TeamException {
595
		// This should not get called for folders
596
		// This should not get called for folders
596
	}
597
	}
598
	
599
	public RepositoryProvider getProvider() {
600
		return null;
601
	}
602
603
	public IPath getLocation() {
604
		return null;
605
	}
597
606
598
}
607
}
(-)src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java (+4 lines)
Lines 226-229 Link Here
226
	public byte[] asBytes() {
226
	public byte[] asBytes() {
227
		return getSyncBytes();
227
		return getSyncBytes();
228
	}
228
	}
229
230
	public IPath getLocation() {
231
		return null;
232
	}
229
}
233
}
(-)src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSResourceVariantTree.java (+22 lines)
Lines 155-166 Link Here
155
	
155
	
156
	private byte[] getParentBytes(IResource resource) throws TeamException {
156
	private byte[] getParentBytes(IResource resource) throws TeamException {
157
		IContainer parent = resource.getParent();
157
		IContainer parent = resource.getParent();
158
		IPath parentLocation = resource.getLocation().removeLastSegments(1);
159
		if (parentLocation.equals(parent.getLocation())) {
158
		byte[] bytes =  getByteStore().getBytes(parent);
160
		byte[] bytes =  getByteStore().getBytes(parent);
159
		if (bytes == null ) {
161
		if (bytes == null ) {
160
			bytes = getBaseBytes(parent, getTag(resource));
162
			bytes = getBaseBytes(parent, getTag(resource));
161
		}
163
		}
162
		return bytes;
164
		return bytes;
163
	}
165
	}
166
		else 
167
			return getBaseBytes(parentLocation, getTag(resource), RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()));
168
	}
164
169
165
	private byte[] getBaseBytes(IContainer parent, CVSTag tag) throws CVSException {
170
	private byte[] getBaseBytes(IContainer parent, CVSTag tag) throws CVSException {
166
		byte[] bytes;
171
		byte[] bytes;
Lines 179-184 Link Here
179
		return bytes;
184
		return bytes;
180
	}
185
	}
181
	
186
	
187
	private byte[] getBaseBytes(IPath parent, CVSTag tag, RepositoryProvider repositoryProvider) throws CVSException {
188
		byte[] bytes;
189
		// Look locally for the folder bytes
190
		ICVSFolder local = CVSFileSystemRoot.getCVSFolderFor(parent, repositoryProvider);
191
		FolderSyncInfo info = local.getFolderSyncInfo();
192
		if (info == null) {
193
			bytes = null;
194
		} else {
195
			// Use the folder sync from the workspace and the tag from the store
196
            MutableFolderSyncInfo newInfo = info.cloneMutable();
197
            newInfo.setTag(tag);
198
            newInfo.setStatic(false);
199
			bytes = newInfo.getBytes();
200
		}
201
		return bytes;
202
	}
203
182
	private boolean hasLocalSyncInfo(IContainer folder) {
204
	private boolean hasLocalSyncInfo(IContainer folder) {
183
		ICVSFolder local = CVSWorkspaceRoot.getCVSFolderFor(folder);
205
		ICVSFolder local = CVSWorkspaceRoot.getCVSFolderFor(folder);
184
		try {
206
		try {
(-)src/org/eclipse/team/internal/ccvs/core/syncinfo/NotifyInfo.java (-2 / +2 lines)
Lines 15-21 Link Here
15
import java.text.ParseException;
15
import java.text.ParseException;
16
import java.util.Date;
16
import java.util.Date;
17
17
18
import org.eclipse.core.resources.IContainer;
18
import org.eclipse.core.runtime.IPath;
19
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.osgi.util.NLS;
20
import org.eclipse.osgi.util.NLS;
21
import org.eclipse.team.internal.ccvs.core.*;
21
import org.eclipse.team.internal.ccvs.core.*;
Lines 55-61 Link Here
55
	 * Constructor for a line from the CVS/Notify file
55
	 * Constructor for a line from the CVS/Notify file
56
	 * @param line
56
	 * @param line
57
	 */
57
	 */
58
	public NotifyInfo(IContainer parent, String line) throws CVSException {
58
	public NotifyInfo(IPath parent, String line) throws CVSException {
59
		String[] strings = Util.parseIntoSubstrings(line, ResourceSyncInfo.SEPARATOR);
59
		String[] strings = Util.parseIntoSubstrings(line, ResourceSyncInfo.SEPARATOR);
60
		if(strings.length != 4) {
60
		if(strings.length != 4) {
61
			IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR_LINE, NLS.bind(CVSMessages.NotifyInfo_MalformedLine, new String[] { line }), parent);
61
			IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR_LINE, NLS.bind(CVSMessages.NotifyInfo_MalformedLine, new String[] { line }), parent);
(-)src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java (-28 / +466 lines)
Lines 15-22 Link Here
15
import java.net.URI;
15
import java.net.URI;
16
import java.util.*;
16
import java.util.*;
17
17
18
import org.eclipse.core.filesystem.EFS;
18
import org.eclipse.core.filesystem.*;
19
import org.eclipse.core.filesystem.IFileStore;
20
import org.eclipse.core.resources.*;
19
import org.eclipse.core.resources.*;
21
import org.eclipse.core.runtime.*;
20
import org.eclipse.core.runtime.*;
22
import org.eclipse.osgi.util.NLS;
21
import org.eclipse.osgi.util.NLS;
Lines 72-83 Link Here
72
        	return null;
71
        	return null;
73
        }
72
        }
74
        
73
        
74
		// process Entries file contents
75
		String[] entries = readLines(cvsSubDir.getFile(ENTRIES));
76
		String[] entriesLog = readLines(cvsSubDir.getFile(ENTRIES_LOG));
77
		return readAllResourceSync(parent.getFullPath().toOSString(), entries, entriesLog);
78
	}
79
	
80
	/**
81
	 * Reads the CVS/Entries, CVS/Entries.log and CVS/Permissions files from the
82
	 * specified folder and returns ResourceSyncInfo instances for the data stored therein.
83
	 * If the folder does not have a CVS subdirectory then <code>null</code> is returned.
84
	 */
85
	private static byte[][] readAllResourceSync(String userPath, String[] entries, String[] entriesLog) throws CVSException {
75
		if (Policy.DEBUG_METAFILE_CHANGES) {
86
		if (Policy.DEBUG_METAFILE_CHANGES) {
76
			System.out.println("Reading Entries file for " + parent.getFullPath()); //$NON-NLS-1$
87
			System.out.println("Reading Entries file for " + userPath); //$NON-NLS-1$
77
		}
88
		}
78
89
79
		// process Entries file contents
90
		// process Entries file contents
80
		String[] entries = readLines(cvsSubDir.getFile(ENTRIES));
81
		if (entries == null) return null;
91
		if (entries == null) return null;
82
		Map infos = new TreeMap();
92
		Map infos = new TreeMap();
83
		for (int i = 0; i < entries.length; i++) {
93
		for (int i = 0; i < entries.length; i++) {
Lines 89-101 Link Here
89
				} catch (CVSException e) {
99
				} catch (CVSException e) {
90
					// There was a problem parsing the entry line.
100
					// There was a problem parsing the entry line.
91
					// Log the problem and skip the entry
101
					// Log the problem and skip the entry
92
					CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR, NLS.bind(CVSMessages.SyncFileWriter_0, new String[] { parent.getFullPath().toString() }), e)); 
102
					CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR, NLS.bind(CVSMessages.SyncFileWriter_0, new String[] { userPath }), e)); 
93
				}			
103
				}			
94
			}
104
			}
95
		}
105
		}
96
		
106
		
97
		// process Entries.log file contents
107
		// process Entries.log file contents
98
		String[] entriesLog = readLines(cvsSubDir.getFile(ENTRIES_LOG));
99
		if (entriesLog != null) {
108
		if (entriesLog != null) {
100
			for (int i = 0; i < entriesLog.length; i++) {
109
			for (int i = 0; i < entriesLog.length; i++) {
101
				String line = entriesLog[i];
110
				String line = entriesLog[i];
Lines 121-126 Link Here
121
		return result;
130
		return result;
122
	}
131
	}
123
	
132
	
133
	public static byte[][] readAllResourceSync(IPath parent) throws CVSException {
134
        IPath cvsSubDir = getCVSSubdirectory(parent);
135
        
136
        if (!cvsSubDir.toFile().exists()){
137
        	return null;
138
        }
139
        
140
		// process Entries file contents
141
		String[] entries = readLines(cvsSubDir.append(ENTRIES));
142
		// process Entries.log file contents
143
		String[] entriesLog = readLines(cvsSubDir.append(ENTRIES_LOG));
144
		return readAllResourceSync(parent.toOSString(), entries, entriesLog);
145
	}
146
124
	private static boolean folderExists(IFolder cvsSubDir) throws CVSException {
147
	private static boolean folderExists(IFolder cvsSubDir) throws CVSException {
125
	    try {
148
	    try {
126
	    	URI uri = cvsSubDir.getLocationURI();
149
	    	URI uri = cvsSubDir.getLocationURI();
Lines 136-141 Link Here
136
		return false;
159
		return false;
137
	}
160
	}
138
161
162
	private static boolean folderExists(IPath cvsSubDir) throws CVSException {
163
		return cvsSubDir.toFile().exists();
164
	}
165
139
	public static void writeAllResourceSync(IContainer parent, byte[][] infos) throws CVSException {
166
	public static void writeAllResourceSync(IContainer parent, byte[][] infos) throws CVSException {
140
		try {
167
		try {
141
			if (Policy.DEBUG_METAFILE_CHANGES) {
168
			if (Policy.DEBUG_METAFILE_CHANGES) {
Lines 159-164 Link Here
159
			throw CVSException.wrapException(e);
186
			throw CVSException.wrapException(e);
160
		}
187
		}
161
	}
188
	}
189
190
	public static void writeAllResourceSync(IPath parent, byte[][] infos) throws CVSException {
191
		try {
192
			if (Policy.DEBUG_METAFILE_CHANGES) {
193
				System.out.println("Writing Entries file for folder " + parent.toOSString()); //$NON-NLS-1$
194
			}
195
			IPath cvsSubDir = getCVSSubdirectory(parent);
196
			if (!cvsSubDir.toFile().exists()) {
197
				cvsSubDir.toFile().mkdir();
198
			}
199
200
			// format file contents
201
			String[] entries = new String[infos.length];
202
			for (int i = 0; i < infos.length; i++) {
203
				byte[] info = infos[i];
204
				entries[i] = new String(info);
205
			}
206
207
			// write Entries
208
			writeLines(cvsSubDir.append(ENTRIES), entries);
209
210
			// delete Entries.log
211
			cvsSubDir.append(ENTRIES_LOG).toFile().delete();
212
		} catch(IOException e) {
213
			throw CVSException.wrapException(e);
214
		}
215
	}
216
162
	/**
217
	/**
163
	 * Reads the CVS/Root, CVS/Repository, CVS/Tag, and CVS/Entries.static files from
218
	 * Reads the CVS/Root, CVS/Repository, CVS/Tag, and CVS/Entries.static files from
164
	 * the specified folder and returns a FolderSyncInfo instance for the data stored therein.
219
	 * the specified folder and returns a FolderSyncInfo instance for the data stored therein.
Lines 211-216 Link Here
211
	}
266
	}
212
	
267
	
213
	/**
268
	/**
269
	 * Reads the CVS/Root, CVS/Repository, CVS/Tag, and CVS/Entries.static files from
270
	 * the specified folder and returns a FolderSyncInfo instance for the data stored therein.
271
	 * If the folder does not have a CVS subdirectory then <code>null</code> is returned.
272
	 */
273
	public static FolderSyncInfo readFolderSync(IPath folder) throws CVSException {
274
		IPath cvsSubDir = getCVSSubdirectory(folder);
275
		
276
        if (!folderExists(cvsSubDir)){
277
        	return null;
278
        }
279
280
        if (Policy.DEBUG_METAFILE_CHANGES) {
281
			System.out.println("Reading Root/Repository files for " + folder.toOSString()); //$NON-NLS-1$
282
		}
283
		
284
		// read CVS/Root
285
		String root = readFirstLine(cvsSubDir.append(ROOT));
286
		if (root == null) return null;
287
		
288
		// read CVS/Repository
289
		String repository = readFirstLine(cvsSubDir.append(REPOSITORY));
290
		if (repository == null) return null;
291
		
292
		// read CVS/Tag
293
		String tag = readFirstLine(cvsSubDir.append(TAG));
294
		if (Policy.DEBUG_METAFILE_CHANGES && tag != null) {
295
			System.out.println("Reading Tag file for " + folder.toOSString()); //$NON-NLS-1$
296
		}
297
		CVSTag cvsTag = (tag != null) ? new CVSEntryLineTag(tag) : null;
298
299
		// read Entries.Static
300
		String staticDir = readFirstLine(cvsSubDir.append(STATIC));
301
		if (Policy.DEBUG_METAFILE_CHANGES && staticDir != null) {
302
			System.out.println("Reading Static file for " + folder.toOSString()); //$NON-NLS-1$
303
		}
304
		boolean isStatic = (staticDir != null);
305
		
306
		// return folder sync
307
		return new FolderSyncInfo(repository, root, cvsTag, isStatic);		
308
	}
309
310
	/**
214
	 * Writes the CVS/Root, CVS/Repository, CVS/Tag, and CVS/Entries.static files to the
311
	 * Writes the CVS/Root, CVS/Repository, CVS/Tag, and CVS/Entries.static files to the
215
	 * specified folder using the data contained in the specified FolderSyncInfo instance.
312
	 * specified folder using the data contained in the specified FolderSyncInfo instance.
216
	 */
313
	 */
Lines 265-270 Link Here
265
	}
362
	}
266
363
267
	/**
364
	/**
365
	 * Writes the CVS/Root, CVS/Repository, CVS/Tag, and CVS/Entries.static files to the
366
	 * specified folder using the data contained in the specified FolderSyncInfo instance.
367
	 */
368
	public static void writeFolderSync(IPath folder, FolderSyncInfo info) throws CVSException {
369
		try {
370
			if (Policy.DEBUG_METAFILE_CHANGES) {
371
				System.out.println("Writing Root/Respository files for " + folder.toOSString()); //$NON-NLS-1$
372
			}
373
			IPath cvsSubDir = createCVSSubdirectory(folder);
374
	
375
			// write CVS/Root
376
			writeLines(cvsSubDir.append(ROOT), new String[] {info.getRoot()});
377
			
378
			// write CVS/Repository
379
			writeLines(cvsSubDir.append(REPOSITORY), new String[] {info.getRepository()});
380
			
381
			// write CVS/Tag
382
			IPath tagFile = cvsSubDir.append(TAG);
383
			if (info.getTag() != null) {
384
				if (Policy.DEBUG_METAFILE_CHANGES) {
385
					System.out.println("Writing Tag file for " + folder.toOSString()); //$NON-NLS-1$
386
				}
387
				writeLines(tagFile, new String[] {info.getTag().toEntryLineFormat(false)});
388
			} else {
389
				if(tagFile.toFile().exists()) {
390
					if (Policy.DEBUG_METAFILE_CHANGES) {
391
						System.out.println("Deleting Tag file for " + folder.toOSString()); //$NON-NLS-1$
392
					}
393
					tagFile.toFile().delete();
394
				}
395
			}
396
			
397
			// write CVS/Entries.Static
398
			IPath staticFile = cvsSubDir.append(STATIC);
399
			if(info.getIsStatic()) {
400
				// the existance of the file is all that matters
401
				if (Policy.DEBUG_METAFILE_CHANGES) {
402
					System.out.println("Writing Static file for " + folder.toOSString()); //$NON-NLS-1$
403
				}
404
				writeLines(staticFile, new String[] {""}); //$NON-NLS-1$
405
			} else {
406
				if(staticFile.toFile().exists()) {
407
					if (Policy.DEBUG_METAFILE_CHANGES) {
408
						System.out.println("Deleting Static file for " + folder.toOSString()); //$NON-NLS-1$
409
					}
410
					staticFile.toFile().delete();
411
				}
412
			}
413
		} catch(CoreException e) {
414
			throw CVSException.wrapException(e);
415
		} catch (IOException e) {
416
			throw CVSException.wrapException(e);
417
		}
418
	}
419
420
	/**
268
	 * Returns all .cvsignore entries for the specified folder.
421
	 * Returns all .cvsignore entries for the specified folder.
269
	 */
422
	 */
270
	public static String[] readCVSIgnoreEntries(IContainer folder) throws CVSException {
423
	public static String[] readCVSIgnoreEntries(IContainer folder) throws CVSException {
Lines 328-342 Link Here
328
        	return null;
481
        	return null;
329
        }
482
        }
330
        
483
        
331
		// process Notify file contents
332
		String[] entries = readLines(cvsSubDir.getFile(NOTIFY));
484
		String[] entries = readLines(cvsSubDir.getFile(NOTIFY));
485
		return readAllNotifyInfo(parent.getFullPath(), entries);
486
	}
487
488
	/**
489
	 * Reads the CVS/Notify file from the specified folder and returns NotifyInfo instances 
490
	 * for the data stored therein. If the folder does not have a CVS subdirectory then <code>null</code> is returned.
491
	 */
492
	public static NotifyInfo[] readAllNotifyInfo(IPath parent) throws CVSException {
493
		IPath cvsSubDir = getCVSSubdirectory(parent);
494
495
        if (!folderExists(cvsSubDir)){
496
        	return null;
497
        }
498
        
499
		String[] entries = readLines(cvsSubDir.append(NOTIFY));
500
		return readAllNotifyInfo(parent, entries);
501
	}
502
503
	private static NotifyInfo[] readAllNotifyInfo(IPath path, String[] entries) throws CVSException {
504
		// process Notify file contents
333
		if (entries == null) return null;
505
		if (entries == null) return null;
334
		Map infos = new TreeMap();
506
		Map infos = new TreeMap();
335
		for (int i = 0; i < entries.length; i++) {
507
		for (int i = 0; i < entries.length; i++) {
336
			String line = entries[i];
508
			String line = entries[i];
337
			if(!"".equals(line)) { //$NON-NLS-1$
509
			if(!"".equals(line)) { //$NON-NLS-1$
338
				try {
510
				try {
339
                    NotifyInfo info = new NotifyInfo(parent, line);
511
                    NotifyInfo info = new NotifyInfo(path, line);
340
                    infos.put(info.getName(), info);
512
                    infos.put(info.getName(), info);
341
                } catch (CVSException e) {
513
                } catch (CVSException e) {
342
                    // We couldn't parse the notify info
514
                    // We couldn't parse the notify info
Lines 383-388 Link Here
383
	}
555
	}
384
556
385
	/**
557
	/**
558
	 * Writes the CVS/Notify file to the specified folder using the data contained in the 
559
	 * specified NotifyInfo instances. A CVS subdirectory must already exist (an exception 
560
	 * is thrown if it doesn't).
561
	 */
562
	public static void writeAllNotifyInfo(IPath parent, NotifyInfo[] infos) throws CVSException {
563
		// get the CVS directory
564
		IPath cvsSubDir = getCVSSubdirectory(parent);
565
		// write lines will throw an exception if the CVS directory does not exist
566
		
567
		if (infos.length == 0) {
568
			IPath notifyFile = cvsSubDir.append(NOTIFY);
569
			if(notifyFile.toFile().exists()) {
570
				notifyFile.toFile().delete();
571
			}
572
		} else {
573
			// format file contents
574
			String[] entries = new String[infos.length];
575
			for (int i = 0; i < infos.length; i++) {
576
				NotifyInfo info = infos[i];
577
				entries[i] = info.getNotifyLine();
578
			}
579
	
580
			// write Notify entries
581
			try {
582
				writeLines(cvsSubDir.append(NOTIFY), entries);
583
			} catch (IOException e) {
584
				throw CVSException.wrapException(e);
585
			}
586
		}
587
	}
588
589
	/**
386
	 * Reads the CVS/Baserev file from the specified folder and returns
590
	 * Reads the CVS/Baserev file from the specified folder and returns
387
	 * BaserevInfo instances for the data stored therein. If the folder does not
591
	 * BaserevInfo instances for the data stored therein. If the folder does not
388
	 * have a CVS subdirectory then <code>null</code> is returned.
592
	 * have a CVS subdirectory then <code>null</code> is returned.
Lines 396-401 Link Here
396
        
600
        
397
		// process Notify file contents
601
		// process Notify file contents
398
		String[] entries = readLines(cvsSubDir.getFile(BASEREV));
602
		String[] entries = readLines(cvsSubDir.getFile(BASEREV));
603
		return readAllBaserevInfo(entries);
604
	}
605
606
	/**
607
	 * Reads the CVS/Baserev file from the specified folder and returns
608
	 * BaserevInfo instances for the data stored therein. If the folder does not
609
	 * have a CVS subdirectory then <code>null</code> is returned.
610
	 */
611
	public static BaserevInfo[] readAllBaserevInfo(IPath parent) throws CVSException {
612
		IPath cvsSubDir = getCVSSubdirectory(parent);
613
        
614
        if (!folderExists(cvsSubDir)){
615
        	return null;
616
        }
617
        
618
		// process Notify file contents
619
		String[] entries = readLines(cvsSubDir.append(BASEREV));
620
		return readAllBaserevInfo(entries);
621
	}
622
623
	private static BaserevInfo[] readAllBaserevInfo(String[] entries)
624
			throws CVSException {
399
		if (entries == null) return null;
625
		if (entries == null) return null;
400
		Map infos = new TreeMap();
626
		Map infos = new TreeMap();
401
		for (int i = 0; i < entries.length; i++) {
627
		for (int i = 0; i < entries.length; i++) {
Lines 419-433 Link Here
419
		IFolder cvsSubDir = getCVSSubdirectory(parent);
645
		IFolder cvsSubDir = getCVSSubdirectory(parent);
420
		// write lines will throw an exception if the CVS directory does not exist
646
		// write lines will throw an exception if the CVS directory does not exist
421
647
648
		String[] entries = formatBaserevInfo(infos);
649
650
		// write Notify entries
651
		writeLines(cvsSubDir.getFile(BASEREV), entries);
652
	}
653
				
654
	/**
655
	 * Writes the CVS/Baserev file to the specified folder using the data
656
	 * contained in the specified BaserevInfo instances. A CVS subdirectory must
657
	 * already exist (an exception is thrown if it doesn't).
658
	 */
659
	public static void writeAllBaserevInfo(IPath parent, BaserevInfo[] infos) throws CVSException {
660
		// get the CVS directory
661
		IPath cvsSubDir = getCVSSubdirectory(parent);
662
		// write lines will throw an exception if the CVS directory does not exist
663
664
		String[] entries = formatBaserevInfo(infos);
665
666
		// write Notify entries
667
		try {
668
			writeLines(cvsSubDir.append(BASEREV), entries);
669
		} catch (IOException e) {
670
			CVSException.wrapException(e);
671
		}
672
	}
673
674
	private static String[] formatBaserevInfo(BaserevInfo[] infos) {
422
		// format file contents
675
		// format file contents
423
		String[] entries = new String[infos.length];
676
		String[] entries = new String[infos.length];
424
		for (int i = 0; i < infos.length; i++) {
677
		for (int i = 0; i < infos.length; i++) {
425
			BaserevInfo info = infos[i];
678
			BaserevInfo info = infos[i];
426
			entries[i] = info.getEntryLine();
679
			entries[i] = info.getEntryLine();
427
		}
680
		}
428
681
		return entries;
429
		// write Notify entries
430
		writeLines(cvsSubDir.getFile(BASEREV), entries);
431
	}
682
	}
432
				
683
				
433
	/**
684
	/**
Lines 438-443 Link Here
438
	}
689
	}
439
	
690
	
440
	/**
691
	/**
692
	 * Returns the CVS subdirectory for this folder.
693
	 */
694
	private static IPath getCVSSubdirectory(IPath folder) {
695
		return folder.append(CVS_DIRNAME);
696
	}
697
698
	/**
441
	 * Creates and makes team-private and returns a CVS subdirectory in this folder.
699
	 * Creates and makes team-private and returns a CVS subdirectory in this folder.
442
	 */
700
	 */
443
	private static IFolder createCVSSubdirectory(IContainer folder) throws CVSException {
701
	private static IFolder createCVSSubdirectory(IContainer folder) throws CVSException {
Lines 471-476 Link Here
471
		}
729
		}
472
	}
730
	}
473
731
732
	/**
733
	 * Creates and makes team-private and returns a CVS subdirectory in this folder.
734
	 */
735
	private static IPath createCVSSubdirectory(IPath folder) throws CVSException {
736
		final IPath cvsSubDir = getCVSSubdirectory(folder);
737
		if (! cvsSubDir.toFile().exists())
738
			cvsSubDir.toFile().mkdir();
739
		return cvsSubDir;
740
	}
741
474
	protected static boolean existsInFileSystem(IFolder cvsSubDir) {
742
	protected static boolean existsInFileSystem(IFolder cvsSubDir) {
475
		URI uri = cvsSubDir.getLocationURI();
743
		URI uri = cvsSubDir.getLocationURI();
476
		if (uri != null) {
744
		if (uri != null) {
Lines 493-498 Link Here
493
	private static String readFirstLine(IFile file) throws CVSException {
761
	private static String readFirstLine(IFile file) throws CVSException {
494
		try {
762
		try {
495
			InputStream in = getInputStream(file);
763
			InputStream in = getInputStream(file);
764
			return readFirstLine(in);
765
		} catch (IOException e) {
766
			throw CVSException.wrapException(e);
767
		} catch (CoreException e) {
768
			// If the IFile doesn't exist or the underlying File doesn't exist,
769
			// just return null to indicate the absence of the file
770
			if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND
771
					|| e.getStatus().getCode() == IResourceStatus.FAILED_READ_LOCAL)
772
				return null;
773
			throw CVSException.wrapException(e);
774
		}
775
	}
776
777
	/*
778
	 * Reads the first line of the specified file.
779
	 * Returns null if the file does not exist, or the empty string if it is blank.
780
	 */
781
	private static String readFirstLine(IPath file) throws CVSException {
782
		try {
783
			if (!file.toFile().exists())
784
				return null;
785
			InputStream in = new FileInputStream(file.toFile());
786
			return readFirstLine(in);
787
		} catch (IOException e) {
788
			throw CVSException.wrapException(e);
789
		}
790
	}
791
792
	private static String readFirstLine(InputStream in) throws IOException {
496
			if (in != null) {
793
			if (in != null) {
497
				BufferedReader reader = new BufferedReader(new InputStreamReader(in), 512);
794
				BufferedReader reader = new BufferedReader(new InputStreamReader(in), 512);
498
				try {
795
				try {
Lines 504-519 Link Here
504
				}
801
				}
505
            }
802
            }
506
            return null;
803
            return null;
507
		} catch (IOException e) {
508
			throw CVSException.wrapException(e);
509
		} catch (CoreException e) {
510
			// If the IFile doesn't exist or the underlying File doesn't exist,
511
			// just return null to indicate the absence of the file
512
			if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND
513
					|| e.getStatus().getCode() == IResourceStatus.FAILED_READ_LOCAL)
514
				return null;
515
			throw CVSException.wrapException(e);
516
		}
517
	}
804
	}
518
805
519
	private static InputStream getInputStream(IFile file) throws CoreException, FileNotFoundException {
806
	private static InputStream getInputStream(IFile file) throws CoreException, FileNotFoundException {
Lines 547-552 Link Here
547
	private static String[] readLines(IFile file) throws CVSException {
834
	private static String[] readLines(IFile file) throws CVSException {
548
		try {
835
		try {
549
			InputStream in = getInputStream(file);
836
			InputStream in = getInputStream(file);
837
			return readLines(in);
838
		} catch (IOException e) {
839
			throw CVSException.wrapException(e);
840
		} catch (CoreException e) {
841
			// If the IFile doesn't exist or the underlying File doesn't exist,
842
			// just return null to indicate the absence of the file
843
			if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND
844
					|| e.getStatus().getCode() == IResourceStatus.FAILED_READ_LOCAL)
845
				return null;
846
			throw CVSException.wrapException(e);
847
		}
848
	}
849
850
	private static String[] readLines(InputStream in) throws IOException {
550
			if (in != null) {
851
			if (in != null) {
551
				BufferedReader reader = new BufferedReader(new InputStreamReader(in), 512);
852
				BufferedReader reader = new BufferedReader(new InputStreamReader(in), 512);
552
				List fileContentStore = new ArrayList();
853
				List fileContentStore = new ArrayList();
Lines 561-574 Link Here
561
				}
862
				}
562
			}
863
			}
563
			return null;
864
			return null;
564
		} catch (IOException e) {
865
	}
565
			throw CVSException.wrapException(e);
866
	
566
		} catch (CoreException e) {
867
	/*
567
			// If the IFile doesn't exist or the underlying File doesn't exist,
868
	 * Reads all lines of the specified file.
568
			// just return null to indicate the absence of the file
869
	 * Returns null if the file does not exist.
569
			if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND
870
	 */
570
					|| e.getStatus().getCode() == IResourceStatus.FAILED_READ_LOCAL)
871
	private static String[] readLines(IPath file) throws CVSException {
872
		try {
873
			if (!file.toFile().exists())
571
				return null;
874
				return null;
875
			InputStream in = new FileInputStream(file.toFile());
876
			return readLines(in);
877
		} catch (IOException e) {
572
			throw CVSException.wrapException(e);
878
			throw CVSException.wrapException(e);
573
		}
879
		}
574
	}
880
	}
Lines 604-609 Link Here
604
		}
910
		}
605
	}
911
	}
606
	
912
	
913
	/*
914
	 * Writes all lines to the specified file, using linefeed terminators for
915
	 * compatibility with other CVS clients.
916
	 */
917
	private static void writeLines(IPath file, final String[] contents) throws IOException, CVSException {
918
		ByteArrayOutputStream os = new ByteArrayOutputStream();
919
		writeLinesToStreamAndClose(os, contents);
920
		File javaFile = file.toFile();
921
		RandomAccessFile raFile = new RandomAccessFile(javaFile, "rw"); //$NON-NLS-1$
922
		raFile.write(os.toByteArray());
923
		raFile.setLength(os.toByteArray().length);
924
		raFile.close();
925
	}
926
607
	private static void writeLinesToStreamAndClose(OutputStream os, String[] contents) throws CVSException {
927
	private static void writeLinesToStreamAndClose(OutputStream os, String[] contents) throws CVSException {
608
		byte[] lineEnd = getLineDelimiter();
928
		byte[] lineEnd = getLineDelimiter();
609
		try {
929
		try {
Lines 650-655 Link Here
650
		}
970
		}
651
	}
971
	}
652
	/**
972
	/**
973
	 * Method writeFileToBaseDirectory.
974
	 * 
975
	 * @param file
976
	 * @param info
977
	 */
978
	public static void writeFileToBaseDirectory(IPath file, IProgressMonitor monitor) throws CVSException {
979
		monitor = Policy.monitorFor(monitor);
980
		monitor.beginTask(null, 100);
981
		try {
982
			IPath baseFolder = getBaseDirectory(file);
983
			if (!baseFolder.toFile().exists()) {
984
				baseFolder.toFile().createNewFile();
985
			}
986
			IPath target = baseFolder.append(file.lastSegment());
987
			if (target.toFile().exists()) {
988
				// XXX Should ensure that we haven't already copied it
989
				// XXX write the revision to the CVS/Baserev file
990
				setReadOnly(target, false);
991
				target.toFile().delete();
992
			}
993
	        InputStream in = new FileInputStream(file.toFile());
994
	        OutputStream out = new FileOutputStream(target.toFile());
995
	    
996
	        // Transfer bytes from in to out
997
	        byte[] buf = new byte[1024];
998
	        int len;
999
	        while ((len = in.read(buf)) > 0) {
1000
	            out.write(buf, 0, len);
1001
	        }
1002
	        in.close();
1003
	        out.close();
1004
	        target.toFile().setLastModified(file.toFile().lastModified());
1005
		} catch (IOException e) {
1006
			throw CVSException.wrapException(e);
1007
		} finally {
1008
			monitor.done();
1009
		}
1010
	}
1011
	/**
653
	 * Method restoreFileFromBaseDirectory.
1012
	 * Method restoreFileFromBaseDirectory.
654
	 * @param file
1013
	 * @param file
655
	 * @param info
1014
	 * @param info
Lines 678-683 Link Here
678
			monitor.done();
1037
			monitor.done();
679
		}
1038
		}
680
	}
1039
	}
1040
	/**
1041
	 * Method restoreFileFromBaseDirectory.
1042
	 * @param file
1043
	 * @param info
1044
	 * @param monitor
1045
	 */
1046
	public static void restoreFileFromBaseDirectory(IPath file, IProgressMonitor monitor) throws CVSException {
1047
		monitor = Policy.monitorFor(monitor);
1048
		monitor.beginTask(null, 100);
1049
		try {
1050
			IPath baseFolder = getBaseDirectory(file);
1051
			IPath source = baseFolder.append(file.lastSegment());
1052
			if (!source.toFile().exists()) {
1053
				IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSMessages.SyncFileWriter_baseNotAvailable, new String[] { file.toOSString() }), file);
1054
				throw new CVSException(status); 
1055
			}
1056
			if (file.toFile().exists()) {
1057
				file.toFile().delete();
1058
			}
1059
			// Make the source writable to avoid problems on some file systems (bug 109308)
1060
			setReadOnly(source, false);
1061
			// Copy the file so the timestamp is maintained
1062
			source.toFile().renameTo(file.toFile());
1063
		} catch (CoreException e) {
1064
			throw CVSException.wrapException(e);
1065
		} finally {
1066
			monitor.done();
1067
		}
1068
	}
681
1069
682
	private static void setReadOnly(IFile source, boolean readOnly) {
1070
	private static void setReadOnly(IFile source, boolean readOnly) {
683
		ResourceAttributes attrs = source.getResourceAttributes();
1071
		ResourceAttributes attrs = source.getResourceAttributes();
Lines 692-697 Link Here
692
		}
1080
		}
693
	}
1081
	}
694
	
1082
	
1083
	private static void setReadOnly(IPath source, boolean readOnly) {
1084
		try {
1085
			IFileStore fileStore = EFS.getStore(source.toFile().toURI());
1086
			if (fileStore != null) {
1087
				IFileInfo fileInfo = fileStore.fetchInfo();
1088
				if (fileInfo != null)
1089
					fileInfo.setAttribute(EFS.ATTRIBUTE_READ_ONLY, readOnly);
1090
			}
1091
		} catch (CoreException e) {
1092
			CVSException.wrapException(e);
1093
		}
1094
	}
1095
695
	/**
1096
	/**
696
	 * Method deleteFileFromBaseDirectory.
1097
	 * Method deleteFileFromBaseDirectory.
697
	 * @param file
1098
	 * @param file
Lines 714-725 Link Here
714
		}
1115
		}
715
	}
1116
	}
716
1117
1118
	/**
1119
	 * Method deleteFileFromBaseDirectory.
1120
	 * @param file
1121
	 * @param monitor
1122
	 */
1123
	public static void deleteFileFromBaseDirectory(IPath file, IProgressMonitor monitor) throws CVSException {
1124
		monitor = Policy.monitorFor(monitor);
1125
		monitor.beginTask(null, 100);
1126
		try {
1127
			IPath baseFolder = getBaseDirectory(file);
1128
			IPath source = baseFolder.append(file.lastSegment());
1129
			if (source.toFile().exists()) {
1130
				setReadOnly(source, false);
1131
				source.toFile().delete();
1132
			}
1133
		} finally {
1134
			monitor.done();
1135
		}
1136
	}
1137
717
	private static IFolder getBaseDirectory(IFile file) {
1138
	private static IFolder getBaseDirectory(IFile file) {
718
		IContainer cvsFolder = getCVSSubdirectory(file.getParent());
1139
		IContainer cvsFolder = getCVSSubdirectory(file.getParent());
719
		IFolder baseFolder = cvsFolder.getFolder(new Path(BASE_DIRNAME));
1140
		IFolder baseFolder = cvsFolder.getFolder(new Path(BASE_DIRNAME));
720
		return baseFolder;
1141
		return baseFolder;
721
	}
1142
	}
722
	
1143
	
1144
	private static IPath getBaseDirectory(IPath file) {
1145
		IPath cvsFolder = getCVSSubdirectory(file.removeLastSegments(1));
1146
		IPath baseFolder = cvsFolder.append(new Path(BASE_DIRNAME));
1147
		return baseFolder;
1148
	}
1149
723
	/**
1150
	/**
724
	 * Return a handle to the CVS/Template file for the given folder
1151
	 * Return a handle to the CVS/Template file for the given folder
725
	 * @param folder
1152
	 * @param folder
Lines 742-747 Link Here
742
		return baseFile.exists();
1169
		return baseFile.exists();
743
	}
1170
	}
744
	
1171
	
1172
	/**
1173
	 * Method isEdited.
1174
	 * @param resource
1175
	 * @return boolean
1176
	 */
1177
	public static boolean isEdited(IPath file) {
1178
		IPath baseFolder = getBaseDirectory(file);
1179
		IPath baseFile = baseFolder.append(file.lastSegment());
1180
		return baseFile.toFile().exists();
1181
	}
1182
745
	private static byte[] getLineDelimiter() {
1183
	private static byte[] getLineDelimiter() {
746
		if (CVSProviderPlugin.getPlugin().isUsePlatformLineend()) {
1184
		if (CVSProviderPlugin.getPlugin().isUsePlatformLineend()) {
747
			String property = System.getProperty("line.separator"); //$NON-NLS-1$
1185
			String property = System.getProperty("line.separator"); //$NON-NLS-1$
(-)src/org/eclipse/team/internal/ccvs/core/util/Util.java (+34 lines)
Lines 101-106 Link Here
101
		return result;
101
		return result;
102
	}
102
	}
103
	
103
	
104
	/*
105
	 * *
106
	 * Get the extention of the path of resource
107
	 * relative to the path of root
108
	 * 
109
	 * @throws CVSException if root is not a root-folder of resource
110
	 */
111
	public static String getRelativePath(IPath rootName, IPath resourceName) 
112
		throws CVSException {
113
114
		if (!rootName.isPrefixOf(resourceName)) {
115
			int count = rootName.matchingFirstSegments(resourceName);
116
			if (count == 0)
117
				throw new CVSException(CVSMessages.Util_Internal_error__resource_does_not_start_with_root_3); 
118
			resourceName = resourceName.removeFirstSegments(count);
119
			for (int i = 0; i < rootName.segmentCount() - count; i++)
120
				resourceName = new Path("..").append(resourceName); //$NON-NLS-1$
121
			return resourceName.toPortableString();
122
		}
123
		
124
		// Otherwise we would get an ArrayOutOfBoundException
125
		// in case of two equal Resources
126
		if (rootName.segmentCount() == resourceName.segmentCount()) {
127
			return ""; //$NON-NLS-1$
128
		}
129
		
130
		// Remove leading slash if there is one
131
		String result = resourceName.toString().substring(rootName.toString().length());
132
		if (result.startsWith("/")) { //$NON-NLS-1$
133
			result = result.substring(1);
134
		}
135
		return result;
136
	}
137
104
	/**
138
	/**
105
	 * Append the prefix and suffix to form a valid CVS path.
139
	 * Append the prefix and suffix to form a valid CVS path.
106
	 */
140
	 */
(-)src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java (-1 / +2 lines)
Lines 276-281 Link Here
276
		ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
276
		ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
277
		cvsDecoration.setResourceType(resource.getType());
277
		cvsDecoration.setResourceType(resource.getType());
278
		
278
		
279
		boolean locationIsNull = resource.getLocation() == null;
279
		cvsDecoration.setHasRemote(hasRemote(cvsResource));
280
		cvsDecoration.setHasRemote(hasRemote(cvsResource));
280
		if (cvsResource.isIgnored()) {
281
		if (cvsResource.isIgnored()) {
281
			cvsDecoration.setIgnored(true);
282
			cvsDecoration.setIgnored(true);
Lines 304-310 Link Here
304
			if (store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION)) {
305
			if (store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION)) {
305
				if (cvsResource.exists()) {
306
				if (cvsResource.exists()) {
306
					if (cvsResource.isFolder()) {
307
					if (cvsResource.isFolder()) {
307
						if (!((ICVSFolder) cvsResource).isCVSFolder()) {
308
						if (!((ICVSFolder) cvsResource).isCVSFolder() && !locationIsNull) {
308
							cvsDecoration.setNewResource(true);
309
							cvsDecoration.setNewResource(true);
309
						}
310
						}
310
					} else if (!cvsResource.isManaged()) {
311
					} else if (!cvsResource.isManaged()) {
(-)src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java (-3 lines)
Lines 97-105 Link Here
97
	 * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
97
	 * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
98
	 */
98
	 */
99
	protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
99
	protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
100
		// Add to version control should never be enabled for linked resources
101
		IResource resource = cvsResource.getIResource();
102
		if (resource.isLinked()) return false;
103
		return super.isEnabledForCVSResource(cvsResource);
100
		return super.isEnabledForCVSResource(cvsResource);
104
	}
101
	}
105
102
(-)src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java (+2 lines)
Lines 109-114 Link Here
109
	 * Recursively check for and handle orphaned CVS folders
109
	 * Recursively check for and handle orphaned CVS folders
110
	 */
110
	 */
111
	private void handleOrphanedSubtree(final ICVSFolder folder) throws CVSException {
111
	private void handleOrphanedSubtree(final ICVSFolder folder) throws CVSException {
112
		if (folder.getIResource() != null) {
112
		if (folder.getIResource().getType() == IResource.PROJECT) return;
113
		if (folder.getIResource().getType() == IResource.PROJECT) return;
113
		if (CVSWorkspaceRoot.isOrphanedSubtree((IContainer)folder.getIResource())) {
114
		if (CVSWorkspaceRoot.isOrphanedSubtree((IContainer)folder.getIResource())) {
114
			try {
115
			try {
Lines 129-134 Link Here
129
		}
130
		}
130
		handleOrphanedSubtree(folder.getParent());
131
		handleOrphanedSubtree(folder.getParent());
131
	}
132
	}
133
	}
132
	
134
	
133
	/**
135
	/**
134
	 * Return true if the sync info is loaded for all selected resources.
136
	 * Return true if the sync info is loaded for all selected resources.
(-)src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java (-7 / +22 lines)
Lines 103-109 Link Here
103
	 * must be included in the resources array.
103
	 * must be included in the resources array.
104
	 * </p>
104
	 * </p>
105
	 */
105
	 */
106
	private void add(CVSTeamProvider provider, IResource[] resources, int depth, IProgressMonitor progress) throws CVSException {	
106
	private void add(final CVSTeamProvider provider, IResource[] resources, int depth, final IProgressMonitor progress) throws CVSException {	
107
		
107
		
108
		// Visit the children of the resources using the depth in order to
108
		// Visit the children of the resources using the depth in order to
109
		// determine which folders, text files and binary files need to be added
109
		// determine which folders, text files and binary files need to be added
Lines 121-127 Link Here
121
				// Auto-add parents if they are not already managed
121
				// Auto-add parents if they are not already managed
122
				IContainer parent = currentResource.getParent();
122
				IContainer parent = currentResource.getParent();
123
				ICVSResource cvsParentResource = CVSWorkspaceRoot.getCVSResourceFor(parent);
123
				ICVSResource cvsParentResource = CVSWorkspaceRoot.getCVSResourceFor(parent);
124
				while (parent.getType() != IResource.ROOT && parent.getType() != IResource.PROJECT && ! isManaged(cvsParentResource)) {
124
				while (parent.getType() != IResource.ROOT 
125
						&& parent.getType() != IResource.PROJECT 
126
						&& ! isManaged(cvsParentResource)
127
						&& cvsParentResource.getLocation() != null) {
125
					folders.add(cvsParentResource);
128
					folders.add(cvsParentResource);
126
					parent = parent.getParent();
129
					parent = parent.getParent();
127
					cvsParentResource = cvsParentResource.getParent();
130
					cvsParentResource = cvsParentResource.getParent();
Lines 135-141 Link Here
135
							ICVSResource mResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
138
							ICVSResource mResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
136
							// Add the resource is its not already managed and it was either
139
							// Add the resource is its not already managed and it was either
137
							// added explicitly (is equal currentResource) or is not ignored
140
							// added explicitly (is equal currentResource) or is not ignored
138
							if (! isManaged(mResource) && (currentResource.equals(resource) || ! mResource.isIgnored())) {
141
							if ((mResource.getLocation() != null) && !isManaged(mResource) && (currentResource.equals(resource) || ! mResource.isIgnored())) {
139
								if (resource.getType() == IResource.FILE) {
142
								if (resource.getType() == IResource.FILE) {
140
								    KSubstOption ksubst= getKSubstOption((IFile)resource);
143
								    KSubstOption ksubst= getKSubstOption((IFile)resource);
141
									Set set = (Set) files.get(ksubst);
144
									Set set = (Set) files.get(ksubst);
Lines 172-185 Link Here
172
		progress.beginTask(null, files.size() * 10 + (folders.isEmpty() ? 0 : 10));
175
		progress.beginTask(null, files.size() * 10 + (folders.isEmpty() ? 0 : 10));
173
		try {
176
		try {
174
			if (!folders.isEmpty()) {
177
			if (!folders.isEmpty()) {
175
				Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
178
				LocalRootRunnable runnable = new LocalRootRunnable(provider) {
179
					public void executeSession(ICVSFolder localRoot, ICVSResource resources[], boolean recurse) throws CVSException, InterruptedException {
180
						Session session = new Session(getRemoteLocation(provider), localRoot, true /* output to console */);
176
				session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
181
				session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
177
				try {
182
				try {
178
					IStatus status = Command.ADD.execute(
183
					IStatus status = Command.ADD.execute(
179
						session,
184
						session,
180
						Command.NO_GLOBAL_OPTIONS,
185
						Command.NO_GLOBAL_OPTIONS,
181
						Command.NO_LOCAL_OPTIONS,
186
						Command.NO_LOCAL_OPTIONS,
182
						(ICVSResource[])folders.toArray(new ICVSResource[folders.size()]),
187
								resources,
183
						null,
188
						null,
184
						Policy.subMonitorFor(progress, 8));
189
						Policy.subMonitorFor(progress, 8));
185
					if (status.getCode() == CVSStatus.SERVER_ERROR) {
190
					if (status.getCode() == CVSStatus.SERVER_ERROR) {
Lines 189-206 Link Here
189
					session.close();
194
					session.close();
190
				}
195
				}
191
			}
196
			}
197
				};
198
				runnable.run(getLocalRoot(provider), (ICVSResource[]) folders.toArray(new ICVSResource[0]), false);
199
			}
192
			for (Iterator it = files.entrySet().iterator(); it.hasNext();) {
200
			for (Iterator it = files.entrySet().iterator(); it.hasNext();) {
193
				Map.Entry entry = (Map.Entry) it.next();
201
				Map.Entry entry = (Map.Entry) it.next();
194
				final KSubstOption ksubst = (KSubstOption) entry.getKey();
202
				final KSubstOption ksubst = (KSubstOption) entry.getKey();
195
				final Set set = (Set) entry.getValue();
203
				final Set set = (Set) entry.getValue();
196
				Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
204
				LocalRootRunnable runnable = new LocalRootRunnable(provider) {
205
					public void executeSession(ICVSFolder localRoot, ICVSResource resources[], boolean recurse) throws CVSException, InterruptedException {
206
						Session session = new Session(getRemoteLocation(provider), localRoot, true /* output to console */);
197
				session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
207
				session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
198
				try {
208
				try {
199
					IStatus status = Command.ADD.execute(
209
					IStatus status = Command.ADD.execute(
200
						session,
210
						session,
201
						Command.NO_GLOBAL_OPTIONS,
211
						Command.NO_GLOBAL_OPTIONS,
202
						new LocalOption[] { ksubst },
212
						new LocalOption[] { ksubst },
203
						(ICVSResource[])set.toArray(new ICVSResource[set.size()]),
213
								resources,
204
						null,
214
						null,
205
						Policy.subMonitorFor(progress, 8));
215
						Policy.subMonitorFor(progress, 8));
206
					if (status.getCode() == CVSStatus.SERVER_ERROR) {
216
					if (status.getCode() == CVSStatus.SERVER_ERROR) {
Lines 210-215 Link Here
210
					session.close();
220
					session.close();
211
				}
221
				}
212
			}
222
			}
223
				};
224
				runnable.run(getLocalRoot(provider), (ICVSResource[]) set.toArray(new ICVSResource[0]), false);
225
			}
226
		} catch (InterruptedException e) {
227
			CVSException.wrapException(e);
213
		} finally {
228
		} finally {
214
			progress.done();
229
			progress.done();
215
		}
230
		}
(-)src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java (-7 / +11 lines)
Lines 130-150 Link Here
130
		}
130
		}
131
	}
131
	}
132
132
133
	private void makeBranch(CVSTeamProvider provider, IResource[] resources, final CVSTag versionTag, final CVSTag branchTag, boolean moveToBranch, boolean recurse, IProgressMonitor monitor) throws TeamException {
133
	private void makeBranch(final CVSTeamProvider provider, IResource[] resources, final CVSTag versionTag, final CVSTag branchTag, boolean moveToBranch, boolean recurse, final IProgressMonitor monitor) throws TeamException {
134
		
134
		
135
		// Determine the total amount of work
135
		// Determine the total amount of work
136
		int totalWork = (versionTag!= null ? 60 : 40) + (moveToBranch ? 20 : 0);
136
		int totalWork = (versionTag!= null ? 60 : 40) + (moveToBranch ? 20 : 0);
137
		monitor.beginTask(CVSUIMessages.CVSTeamProvider_makeBranch, totalWork);  
137
		monitor.beginTask(CVSUIMessages.CVSTeamProvider_makeBranch, totalWork);  
138
		try {
138
		try {
139
			// Build the arguments list
139
			// Build the arguments list
140
			LocalRootRunnable runnable = new LocalRootRunnable() {
141
				public void executeSession(ICVSFolder localRoot, IResource resources[], boolean recurse) throws CVSException, InterruptedException, CVSServerException {
140
			ICVSResource[] arguments = getCVSArguments(resources);
142
			ICVSResource[] arguments = getCVSArguments(resources);
141
            LocalOption[] localOptions = getLocalOptions(recurse);
143
            LocalOption[] localOptions = getLocalOptions(recurse);
142
			
143
			// Tag the remote resources
144
			// Tag the remote resources
144
			IStatus status = null;
145
			IStatus status = null;
145
			if (versionTag != null) {
146
			if (versionTag != null) {
146
				// Version using a custom tag command that skips added but not commited reesources
147
				// Version using a custom tag command that skips added but not commited reesources
147
				Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
148
						Session session = new Session(getRemoteLocation(provider),localRoot, true /* output to console */);
148
				session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
149
				session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
149
				try {
150
				try {
150
					status = Command.CUSTOM_TAG.execute(
151
					status = Command.CUSTOM_TAG.execute(
Lines 160-166 Link Here
160
				}
161
				}
161
				if (status.isOK()) {
162
				if (status.isOK()) {
162
					// Branch using the tag
163
					// Branch using the tag
163
					session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
164
							session = new Session(getRemoteLocation(provider), localRoot, true /* output to console */);
164
					session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
165
					session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
165
					try {
166
					try {
166
						status = Command.CUSTOM_TAG.execute(
167
						status = Command.CUSTOM_TAG.execute(
Lines 177-183 Link Here
177
				}
178
				}
178
			} else {
179
			} else {
179
				// Just branch using tag
180
				// Just branch using tag
180
				Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
181
						Session session = new Session(getRemoteLocation(provider), localRoot, true /* output to console */);
181
				session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
182
				session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
182
				try {
183
				try {
183
                    status = Command.CUSTOM_TAG.execute(
184
                    status = Command.CUSTOM_TAG.execute(
Lines 191-207 Link Here
191
				} finally {
192
				} finally {
192
					session.close();
193
					session.close();
193
				}
194
				}
194
195
			}
195
			}
196
			if ( ! status.isOK()) {
196
			if ( ! status.isOK()) {
197
				throw new CVSServerException(status);
197
				throw new CVSServerException(status);
198
			}
198
			}
199
			
199
				}
200
			};
201
			runnable.run(getLocalRoot(provider), resources, recurse);
200
			// Set the tag of the local resources to the branch tag (The update command will not
202
			// Set the tag of the local resources to the branch tag (The update command will not
201
			// properly update "cvs added" and "cvs removed" resources so a custom visitor is used
203
			// properly update "cvs added" and "cvs removed" resources so a custom visitor is used
202
			if (moveToBranch) {
204
			if (moveToBranch) {
203
				setTag(provider, resources, branchTag, recurse, Policy.subMonitorFor(monitor, 20));
205
				setTag(provider, resources, branchTag, recurse, Policy.subMonitorFor(monitor, 20));
204
			}
206
			}
207
		} catch (InterruptedException e) {
208
			CVSException.wrapException(e);
205
		} finally {
209
		} finally {
206
			monitor.done();
210
			monitor.done();
207
		}
211
		}
(-)src/org/eclipse/team/internal/ccvs/ui/operations/LocalRootRunnable.java (+395 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ccvs.ui.operations;
12
13
import java.util.*;
14
15
import org.eclipse.core.resources.IContainer;
16
import org.eclipse.core.resources.IResource;
17
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.Status;
19
import org.eclipse.osgi.util.NLS;
20
import org.eclipse.team.internal.ccvs.core.*;
21
import org.eclipse.team.internal.ccvs.core.client.*;
22
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
23
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
24
import org.eclipse.team.internal.ccvs.core.resources.CVSFileSystemRoot;
25
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
26
import org.eclipse.team.internal.ccvs.ui.Policy;
27
28
public class LocalRootRunnable {
29
30
	private CVSTeamProvider provider;
31
	
32
	public LocalRootRunnable() {
33
		super();
34
	}
35
	
36
	public LocalRootRunnable(CVSTeamProvider provider) {
37
		super();
38
		this.provider = provider;
39
	}
40
41
	protected void executeSession(ICVSFolder localRoot, IResource resources[], boolean recurse) throws CVSException, InterruptedException, CVSServerException {}
42
43
	protected void executeSession(ICVSFolder localRoot, ICVSResource resources[], boolean recurse) throws CVSException, InterruptedException, CVSServerException {}
44
45
	protected IStatus executeSessionWithStatus(ICVSFolder localRoot, IResource resources[], boolean recurse) throws CVSException, InterruptedException, CVSServerException {return Status.OK_STATUS;}
46
47
	protected IStatus executeSessionWithStatus(ICVSFolder localRoot, ICVSResource resources[], boolean recurse) throws CVSException, InterruptedException, CVSServerException {return Status.OK_STATUS;}
48
49
	private static class Root
50
	{
51
		public Root(ICVSFolder localRoot, List resources, boolean recurse) {
52
			super();
53
			this.localRoot = localRoot;
54
			this.resources = resources;
55
			this.recurse = recurse;
56
		}
57
		ICVSFolder localRoot;
58
		List resources;  // either IResource or ICVSResource
59
		boolean recurse;
60
		
61
		public boolean contains(Root newRoot) {
62
			if (localRoot.getClass().equals(newRoot.localRoot.getClass()) && (recurse == newRoot.recurse))
63
				return localRoot.getLocation().isPrefixOf(newRoot.localRoot.getLocation());
64
			return false;
65
		}
66
67
		public void merge(Root root) {
68
			ArrayList newList = new ArrayList(resources);
69
			resources = newList;
70
			resources.addAll(root.resources);
71
		}
72
	}
73
	
74
	/*
75
	 * Represents either a IResource or ICVSResource
76
	 */
77
	private static class CommonResource {
78
		IResource workspaceResource = null;
79
		ICVSResource cvsResource = null;
80
81
		public CommonResource(ICVSResource resource) {
82
			cvsResource = resource;
83
		}
84
85
		public CommonResource(IResource resource) {
86
			workspaceResource = resource;
87
		}
88
89
		public String toString() {
90
			if (cvsResource != null)
91
				return cvsResource.toString();
92
			return workspaceResource.toString();
93
		}
94
		
95
		public boolean isFolder() {
96
			if (cvsResource != null)
97
				return cvsResource.isFolder();
98
			return workspaceResource instanceof IContainer;
99
		}
100
		
101
		public IPath getLocation() {
102
			if (cvsResource != null)
103
				return cvsResource.getLocation();
104
			return workspaceResource.getLocation();
105
		}
106
107
		public CommonResource[] members() throws CoreException {
108
			if (cvsResource != null) {
109
				ICVSResource[] resources = ((ICVSFolder) cvsResource).members(ICVSFolder.FILE_MEMBERS | ICVSFolder.FOLDER_MEMBERS);
110
				CommonResource[] result = new CommonResource[resources.length];
111
				for (int i = 0; i < result.length; i++)
112
					result[i] = new CommonResource(resources[i]);
113
				return result;
114
			}
115
			IResource[] resources = ((IContainer) workspaceResource).members();
116
			CommonResource[] result = new CommonResource[resources.length];
117
			for (int i = 0; i < result.length; i++)
118
				result[i] = new CommonResource(resources[i]);
119
			return result;
120
		}
121
122
		public ICVSResource getCVSResource() {
123
			if (cvsResource != null)
124
				return cvsResource;
125
			return CVSWorkspaceRoot.getCVSResourceFor(workspaceResource);
126
		}
127
	}
128
	
129
	/*
130
	 * Returns the root that is sufficient to accommodate all resources to be committed.
131
	 * For example, if the local root's location is c:\foo\bar\, but the resource's location
132
	 * is c:\foo\other\res.txt, the common root will be 'c:\foo'
133
	 */
134
	private Root[] getCommonRoots(ICVSFolder localRoot,
135
			IResource[] resources, boolean recurse) throws CVSException {
136
		ArrayList/*<Root>*/ list = new ArrayList();
137
		getCommonRoots(list, localRoot, toCommonRootArray(resources), recurse);
138
		return (Root[]) list.toArray(new Root[0]);
139
	}
140
141
	private CommonResource[] toCommonRootArray(IResource[] resources) {
142
		CommonResource[] result = new CommonResource[resources.length];
143
		for (int i = 0;i < resources.length; i++)
144
			result[i] = new CommonResource(resources[i]);
145
		return result;
146
	}
147
148
	private Root[] getCommonRoots(ICVSFolder localRoot,
149
			ICVSResource[] resources, boolean recurse) throws CVSException {
150
		ArrayList/*<Root>*/ list = new ArrayList();
151
		getCommonRoots(list, localRoot, toCommonRootArray(resources), recurse);
152
		return (Root[]) list.toArray(new Root[0]);
153
	}
154
155
	private CommonResource[] toCommonRootArray(ICVSResource[] resources) {
156
		CommonResource[] result = new CommonResource[resources.length];
157
		for (int i = 0;i < resources.length; i++)
158
			result[i] = new CommonResource(resources[i]);
159
		return result;
160
	}
161
162
	private ICVSFolder selectAppropriateRoot(ICVSResource cvsResource)
163
			throws CVSException {
164
		ICVSFolder newRoot = null;
165
		IPath location = cvsResource.getLocation();
166
		if (!cvsResource.isFolder())
167
			newRoot = cvsResource.getParent();
168
		else
169
			newRoot = (ICVSFolder) cvsResource;
170
		while (newRoot != null && !newRoot.isCVSFolder() && newRoot.getLocation().isPrefixOf(location)) {
171
			newRoot = newRoot.getParent();
172
		}
173
		if ( newRoot != null && (!newRoot.isCVSFolder() || !newRoot.getLocation().isPrefixOf(location)))
174
			newRoot = null;
175
		return newRoot;
176
	}
177
	
178
	private boolean isCVSResource(ICVSResource cvsResource) throws CVSException {
179
		ICVSFolder root = null;
180
		if (!cvsResource.isFolder())
181
			root = cvsResource.getParent();
182
		else
183
			root = (ICVSFolder) cvsResource;
184
185
		while (root != null && !root.isCVSFolder() && root.getLocation().isPrefixOf(cvsResource.getLocation())) {
186
			root = root.getParent();
187
		}
188
		
189
		return !(root == null);
190
	}
191
192
	/*
193
	 * Returns true if the root was changed
194
	 */
195
	private boolean getCommonRoots(ArrayList list, ICVSFolder localRoot,
196
			CommonResource[] resources, boolean recurse) throws CVSException {
197
		boolean wasChanged = false;
198
		IPath rootLocation = localRoot.getLocation();
199
		if (rootLocation != null) {
200
			ArrayList/*<CommonResource>*/ notAdded = new ArrayList();
201
			Vector notCVS = new Vector();
202
			for (int i = 0; i < resources.length; i++) {
203
				boolean added = false;
204
				boolean isCVS = true;
205
				IPath location = resources[i].getLocation();
206
				if (location != null) {
207
					if (!rootLocation.isPrefixOf(location)) {
208
						// first, try to get the root as the resource itself, and its immediate workspace parents.
209
						CommonResource cvsResource = resources[i];
210
						if (isCVSResource(cvsResource.getCVSResource())) {
211
							ICVSFolder newRoot = null;
212
							newRoot = selectAppropriateRoot(cvsResource.getCVSResource());
213
							
214
							if (newRoot == null) {
215
								// create FileSystem Parent Resources.
216
								cvsResource = new CommonResource(CVSFileSystemRoot.getCVSResourceFor(cvsResource.getLocation(), localRoot.getProvider()));
217
								newRoot = selectAppropriateRoot(cvsResource.getCVSResource());
218
							}
219
							if (newRoot == null)
220
								throw new CVSException(new CVSStatus(IStatus.ERROR,
221
										CVSMessages.CVSRepositoryLocation_mixedRepository)); 
222
							added = true;
223
							wasChanged = true;
224
							getCommonChildrenRoots(list, new CommonResource[] {resources[i]}, recurse, newRoot);
225
						} else {
226
							notCVS.add(resources[i]); 
227
							isCVS = false;
228
						}
229
					}
230
				}
231
				if (!added && isCVS)
232
					notAdded.add(resources[i]);
233
			}
234
			if (!notAdded.isEmpty())
235
				wasChanged |= getCommonChildrenRoots(list, (CommonResource[]) notAdded.toArray(new CommonResource[0]), recurse, localRoot);
236
237
			// write to log the files that are located somewhere not under cvs root
238
			if (!notCVS.isEmpty()) {
239
				if (provider != null) {
240
					Session session = new Session(provider.getCVSWorkspaceRoot().getRemoteLocation(), localRoot, true);
241
					session.open(Policy.subMonitorFor(null, 2), true /* open for modification */);
242
					try {
243
						ICommandOutputListener listener = new CommandOutputListener(); 
244
						for (int i = 0; i < notCVS.size(); i++){
245
							CommonResource cvsResource = (CommonResource) notCVS.get(i);
246
							String argument = NLS.bind(CVSMessages.Resource_not_in_CVS, 
247
									new String[] {cvsResource.getCVSResource().getRelativePath(localRoot), 
248
									cvsResource.getLocation().toString()});
249
							IStatus status = listener.messageLine(argument, session.getCVSRepositoryLocation(), session.getLocalRoot(), null);
250
							session.addError(status); // The session ignores OK status
251
							ConsoleListeners.getInstance().messageLineReceived(session, argument, status);
252
						}
253
					} finally {
254
						session.close();
255
					}
256
				}
257
			}
258
		}
259
		else
260
			wasChanged = getCommonChildrenRoots(list, resources, recurse, localRoot);
261
		return wasChanged;
262
	}
263
264
	private boolean getCommonChildrenRoots(ArrayList list,
265
			CommonResource[] resources, boolean recurse, ICVSFolder newRoot)
266
			throws CVSException {
267
		boolean wasChanged = false;
268
		if (recurse) {
269
			boolean hadFolderChildren = false;
270
			ArrayList/*<CommonResource>*/ notAdded = new ArrayList();
271
			for (int i = 0; i < resources.length; i++) {
272
				CommonResource resource = resources[i];
273
				 if (resource.isFolder()) {
274
					hadFolderChildren = true;
275
					try {
276
						CommonResource[] resChildren = null;
277
						try {
278
							resChildren = resource.members();
279
						} catch (CoreException e) {
280
							addToList(list, new Root(newRoot, Arrays.asList(new CommonResource[] {resource}), true));
281
						}
282
						if (resChildren != null) {
283
							ArrayList childrenList = new ArrayList();
284
							boolean changed = getCommonRoots(childrenList, newRoot, resChildren, true);
285
							if (changed) {
286
								list.addAll(childrenList);
287
								recurse = false;
288
								wasChanged = true;
289
							}
290
							else {
291
								if (!newRoot.getLocation().isPrefixOf(resource.getLocation())) {
292
									ICVSFolder localRoot = selectAppropriateRoot(newRoot);
293
									addToList(list, new Root(localRoot, Arrays.asList(new CommonResource[] {resource}), true));
294
								}
295
								else
296
									notAdded.add(resource);
297
							}
298
						}
299
					} catch (CoreException e) {
300
						throw CVSException.wrapException(e);
301
					}
302
				}
303
				 else
304
					 notAdded.add(resource);
305
			}
306
			if (!notAdded.isEmpty())
307
				addToList(list, new Root(newRoot, notAdded, recurse && hadFolderChildren));
308
		}
309
		else
310
			addToList(list, new Root(newRoot, Arrays.asList(resources), recurse));
311
		return wasChanged;
312
	}
313
314
	private void addToList(ArrayList list, Root newRoot) {
315
		Iterator it = list.iterator();
316
		while (it.hasNext()) {
317
			Root root = (Root) it.next();
318
			if (root.contains(newRoot)) {
319
				root.merge(newRoot);
320
				return;
321
			}
322
			if (newRoot.contains(root)) {
323
				newRoot.merge(root);
324
				list.remove(root);
325
				list.add(newRoot);
326
				return;
327
			}
328
		}
329
		list.add(newRoot);
330
	}
331
332
	public void run(ICVSFolder localRoot, IResource[] resources,
333
			boolean recurse) throws CVSException, InterruptedException, CVSServerException {
334
		Root commonRoots[] = getCommonRoots(localRoot, resources, recurse);
335
		for (int i = 0; i < commonRoots.length; i++) {
336
			IResource [] array = toIResourceArray(commonRoots[i].resources);
337
			executeSession(commonRoots[i].localRoot, array, commonRoots[i].recurse);
338
		}
339
	}
340
341
	public IStatus runWithStatus(ICVSFolder localRoot, IResource[] resources,
342
			boolean recurse) throws CVSException, InterruptedException, CVSServerException {
343
		Root commonRoots[] = getCommonRoots(localRoot, resources, recurse);
344
		for (int i = 0; i < commonRoots.length; i++) {
345
			IResource [] array = toIResourceArray(commonRoots[i].resources);
346
			IStatus status = executeSessionWithStatus(commonRoots[i].localRoot, array, commonRoots[i].recurse);
347
			if (!status.isOK()) 
348
				return status;
349
		}
350
		return Status.OK_STATUS;
351
	}
352
353
	private IResource[] toIResourceArray(List resources) {
354
		IResource[] result = new IResource[resources.size()];
355
		Iterator it = resources.iterator();
356
		int i = 0;
357
		while (it.hasNext()) {
358
			CommonResource commonRes = (CommonResource) it.next();
359
			result[i++] = commonRes.workspaceResource;
360
		}
361
		return result;
362
	}
363
364
	public void run(ICVSFolder localRoot, ICVSResource[] resources,
365
			boolean recurse) throws CVSException, InterruptedException, CVSServerException {
366
		Root commonRoots[] = getCommonRoots(localRoot, resources, recurse);
367
		for (int i = 0; i < commonRoots.length; i++) {
368
			ICVSResource [] array = toICVSResourceArray(commonRoots[i].resources);
369
			executeSession(commonRoots[i].localRoot, array, commonRoots[i].recurse);
370
		}
371
	}
372
373
	public IStatus runWithStatus(ICVSFolder localRoot, ICVSResource[] resources,
374
			boolean recurse) throws CVSException, InterruptedException, CVSServerException {
375
		Root commonRoots[] = getCommonRoots(localRoot, resources, recurse);
376
		for (int i = 0; i < commonRoots.length; i++) {
377
			ICVSResource [] array = toICVSResourceArray(commonRoots[i].resources);
378
			IStatus status = executeSessionWithStatus(commonRoots[i].localRoot, array, commonRoots[i].recurse);
379
			if (!status.isOK()) 
380
				return status;
381
		}
382
		return Status.OK_STATUS;
383
	}
384
385
	private ICVSResource[] toICVSResourceArray(List resources) {
386
		ICVSResource[] result = new ICVSResource[resources.size()];
387
		Iterator it = resources.iterator();
388
		int i = 0;
389
		while (it.hasNext()) {
390
			CommonResource commonRes = (CommonResource) it.next();
391
			result[i++] = commonRes.cvsResource;
392
		}
393
		return result;
394
	}
395
}
(-)src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java (-8 / +4 lines)
Lines 27-33 Link Here
27
import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
27
import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
28
import org.eclipse.team.internal.ccvs.core.*;
28
import org.eclipse.team.internal.ccvs.core.*;
29
import org.eclipse.team.internal.ccvs.core.client.Command;
29
import org.eclipse.team.internal.ccvs.core.client.Command;
30
import org.eclipse.team.internal.ccvs.core.client.Session;
31
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
30
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
32
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
31
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
33
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
32
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
Lines 387-401 Link Here
387
	/*
386
	/*
388
	 * Get the arguments to be passed to a commit or update
387
	 * Get the arguments to be passed to a commit or update
389
	 */
388
	 */
390
	protected String[] getStringArguments(IResource[] resources) throws CVSException {
389
	protected String[] getStringArguments(ICVSFolder localRoot, IResource[] resources) throws CVSException {
391
		List arguments = new ArrayList(resources.length);
390
		List arguments = new ArrayList(resources.length);
392
		for (int i=0;i<resources.length;i++) {
391
		for (int i=0;i<resources.length;i++) {
393
			IPath cvsPath = resources[i].getFullPath().removeFirstSegments(1);
392
			ICVSResource res = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
394
			if (cvsPath.segmentCount() == 0) {
393
			String path = res.getRelativePath(localRoot);
395
				arguments.add(Session.CURRENT_LOCAL_FOLDER);
394
			arguments.add(path);
396
			} else {
397
				arguments.add(cvsPath.toString());
398
			}
399
		}
395
		}
400
		return (String[])arguments.toArray(new String[arguments.size()]);
396
		return (String[])arguments.toArray(new String[arguments.size()]);
401
	}
397
	}
(-)src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java (-2 / +8 lines)
Lines 17-22 Link Here
17
import org.eclipse.team.internal.ccvs.core.client.Command;
17
import org.eclipse.team.internal.ccvs.core.client.Command;
18
import org.eclipse.team.internal.ccvs.core.client.Session;
18
import org.eclipse.team.internal.ccvs.core.client.Session;
19
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
19
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
20
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
20
import org.eclipse.team.internal.ccvs.ui.Policy;
21
import org.eclipse.team.internal.ccvs.ui.Policy;
21
import org.eclipse.ui.IWorkbenchPart;
22
import org.eclipse.ui.IWorkbenchPart;
22
23
Lines 34-42 Link Here
34
	/* (non-Javadoc)
35
	/* (non-Javadoc)
35
	 * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
36
	 * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
36
	 */
37
	 */
37
	protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
38
	protected void execute(final CVSTeamProvider provider, IResource[] resources, boolean recurse, final IProgressMonitor monitor) throws CVSException, InterruptedException {
38
		monitor.beginTask(null, 100);
39
		monitor.beginTask(null, 100);
39
		Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
40
		LocalRootRunnable runnable = new LocalRootRunnable() {
41
			public void executeSession(ICVSFolder localRoot, IResource resources[], boolean recurse) throws CVSException, InterruptedException, CVSServerException {
42
				Session session = new Session(getRemoteLocation(provider), localRoot, true /* output to console */);
40
		session.open(Policy.subMonitorFor(monitor, 10), isServerModificationOperation());
43
		session.open(Policy.subMonitorFor(monitor, 10), isServerModificationOperation());
41
		try {
44
		try {
42
			IStatus status = executeCommand(session, provider, getCVSArguments(session, resources), recurse, Policy.subMonitorFor(monitor, 90));
45
			IStatus status = executeCommand(session, provider, getCVSArguments(session, resources), recurse, Policy.subMonitorFor(monitor, 90));
Lines 47-52 Link Here
47
			session.close();
50
			session.close();
48
		}
51
		}
49
	}
52
	}
53
		};
54
		runnable.run(getLocalRoot(provider), resources, recurse);
55
	}
50
56
51
	protected final ICVSResource[] getCVSArguments(IResource[] resources) {
57
	protected final ICVSResource[] getCVSArguments(IResource[] resources) {
52
		return super.getCVSArguments(resources);
58
		return super.getCVSArguments(resources);
(-)src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java (-3 / +15 lines)
Lines 24-29 Link Here
24
import org.eclipse.team.internal.ccvs.core.*;
24
import org.eclipse.team.internal.ccvs.core.*;
25
import org.eclipse.team.internal.ccvs.core.client.*;
25
import org.eclipse.team.internal.ccvs.core.client.*;
26
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
26
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
27
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
27
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
28
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
28
import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
29
import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
29
import org.eclipse.team.internal.ccvs.ui.Policy;
30
import org.eclipse.team.internal.ccvs.ui.Policy;
Lines 79-86 Link Here
79
	 *    any other code - warning messages received from the server
80
	 *    any other code - warning messages received from the server
80
	 * @param recurse 
81
	 * @param recurse 
81
	 */
82
	 */
82
	public IStatus tag(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor progress) throws CVSException {
83
	public IStatus tag(final CVSTeamProvider provider, IResource[] resources, boolean recurse, final IProgressMonitor progress) throws CVSException {
83
						
84
						
85
		LocalRootRunnable runnable = new LocalRootRunnable() {
86
			protected IStatus executeSessionWithStatus(ICVSFolder localRoot,
87
					IResource[] resources, boolean recurse)
88
					throws CVSException, InterruptedException,
89
					CVSServerException {
84
		LocalOption[] commandOptions = (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]);
90
		LocalOption[] commandOptions = (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]);
85
        if (recurse) {
91
        if (recurse) {
86
            commandOptions = Command.DO_NOT_RECURSE.removeFrom(commandOptions);
92
            commandOptions = Command.DO_NOT_RECURSE.removeFrom(commandOptions);
Lines 90-100 Link Here
90
        }
96
        }
91
				
97
				
92
		// Build the arguments list
98
		// Build the arguments list
93
		String[] arguments = getStringArguments(resources);
99
				String[] arguments = getStringArguments(localRoot, resources);
94
100
95
		// Execute the command
101
		// Execute the command
96
		CVSWorkspaceRoot root = provider.getCVSWorkspaceRoot();
102
		CVSWorkspaceRoot root = provider.getCVSWorkspaceRoot();
97
		Session s = new Session(root.getRemoteLocation(), root.getLocalRoot());
103
				Session s = new Session(root.getRemoteLocation(), localRoot);
98
		progress.beginTask(null, 100);
104
		progress.beginTask(null, 100);
99
		try {
105
		try {
100
			// Opening the session takes 20% of the time
106
			// Opening the session takes 20% of the time
Lines 110-115 Link Here
110
			s.close();
116
			s.close();
111
			progress.done();
117
			progress.done();
112
		}
118
		}
119
			} };
120
		try {
121
			return runnable.runWithStatus(provider.getCVSWorkspaceRoot().getLocalRoot(), resources, recurse);
122
		} catch (InterruptedException e) {
123
			throw CVSException.wrapException(e);
124
		}
113
	}
125
	}
114
	
126
	
115
	public void addLocalOption(LocalOption option)  {
127
	public void addLocalOption(LocalOption option)  {
(-)launchConfigurations/CVS UI Tests (1).launch (-138 / +152 lines)
Lines 1-166 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
2
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
3
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
3
<booleanAttribute key="askclear" value="false"/>
4
<booleanAttribute key="automaticAdd" value="true"/>
5
<booleanAttribute key="automaticValidate" value="false"/>
4
<stringAttribute key="bootstrap" value=""/>
6
<stringAttribute key="bootstrap" value=""/>
5
<booleanAttribute key="useProduct" value="false"/>
7
<stringAttribute key="checked" value="[NONE]"/>
6
<booleanAttribute key="tracing" value="true"/>
8
<booleanAttribute key="clearConfig" value="true"/>
9
<booleanAttribute key="clearws" value="true"/>
10
<booleanAttribute key="clearwslog" value="false"/>
11
<stringAttribute key="configLocation" value=""/>
12
<booleanAttribute key="default" value="false"/>
13
<booleanAttribute key="includeFragments" value="false"/>
14
<booleanAttribute key="includeOptional" value="true"/>
15
<stringAttribute key="location" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace2"/>
16
<stringAttribute key="location1" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace"/>
17
<booleanAttribute key="maximized" value="false"/>
18
<booleanAttribute key="onePlugin" value="false"/>
19
<stringAttribute key="onePluginID" value=""/>
20
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
21
<listEntry value="/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/AllTests.java"/>
22
</listAttribute>
23
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
24
<listEntry value="1"/>
25
</listAttribute>
26
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
7
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
27
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
8
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
28
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
9
</listAttribute>
29
</listAttribute>
10
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
30
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
31
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
32
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
33
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
34
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.AllTests"/>
35
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os win32 -ws win32 -arch x86 -nl en_CA"/>
36
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
37
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
38
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName2=testFileAdditions"/>
39
<stringAttribute key="pde.version" value="3.3"/>
40
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
41
<booleanAttribute key="run_in_ui_thread" value="true"/>
42
<stringAttribute key="selected_target_plugins" value="org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default"/>
43
<stringAttribute key="selected_workspace_plugins" value="org.eclipse.compare.tests@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.tests.harness@default:default,org.eclipse.core.tests.resources@default:default,org.eclipse.jface@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.team.tests.core@default:default,org.eclipse.team.tests.cvs.core@default:default,org.eclipse.test.performance@default:default,workspace_loc@default:default"/>
44
<booleanAttribute key="show_selected_only" value="false"/>
45
<booleanAttribute key="tracing" value="true"/>
11
<mapAttribute key="tracingOptions">
46
<mapAttribute key="tracingOptions">
47
<mapEntry key="org.eclipse.ant.core/buildfile/timing" value="false"/>
48
<mapEntry key="org.eclipse.ant.core/debug" value="true"/>
49
<mapEntry key="org.eclipse.core.boot/monitor/bundles" value="false"/>
12
<mapEntry key="org.eclipse.core.boot/monitor/classes" value="false"/>
50
<mapEntry key="org.eclipse.core.boot/monitor/classes" value="false"/>
13
<mapEntry key="org.eclipse.team.cvs.core/syncchangeevents" value="false"/>
51
<mapEntry key="org.eclipse.core.boot/monitor/plugins" value="false"/>
14
<mapEntry key="org.eclipse.team.cvs.ui/debug" value="false"/>
52
<mapEntry key="org.eclipse.core.boot/trace/classLoading" value="false"/>
15
<mapEntry key="org.eclipse.help.webapp/debug/workingsets" value="false"/>
16
<mapEntry key="org.eclipse.core.resources/save/snapshots" value="false"/>
17
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/loader" value="*"/>
18
<mapEntry key="org.eclipse.core.runtime/loader/debug/actions" value="false"/>
19
<mapEntry key="org.eclipse.core.runtime/timing/shutdown" value="false"/>
20
<mapEntry key="org.eclipse.core.runtime/url/debug/connect" value="false"/>
21
<mapEntry key="org.eclipse.team.ftp/debug" value="false"/>
22
<mapEntry key="org.eclipse.core.resources/restore/markers" value="false"/>
23
<mapEntry key="org.eclipse.core.boot/trace/filename" value="runtime.traces"/>
53
<mapEntry key="org.eclipse.core.boot/trace/filename" value="runtime.traces"/>
54
<mapEntry key="org.eclipse.core.boot/trace/filters" value="trace.properties"/>
55
<mapEntry key="org.eclipse.core.boot/trace/pluginActivation" value="false"/>
56
<mapEntry key="org.eclipse.core.resources/build/delta" value="false"/>
57
<mapEntry key="org.eclipse.core.resources/build/failure" value="false"/>
58
<mapEntry key="org.eclipse.core.resources/build/invoking" value="false"/>
24
<mapEntry key="org.eclipse.core.resources/build/needbuild" value="false"/>
59
<mapEntry key="org.eclipse.core.resources/build/needbuild" value="false"/>
25
<mapEntry key="org.eclipse.ui/trace/graphics" value="false"/>
60
<mapEntry key="org.eclipse.core.resources/debug" value="false"/>
26
<mapEntry key="org.eclipse.team.cvs.ssh/ssh_protocol" value="false"/>
61
<mapEntry key="org.eclipse.core.resources/history" value="false"/>
27
<mapEntry key="org.eclipse.help/debug/search" value="false"/>
62
<mapEntry key="org.eclipse.core.resources/monitor/builders" value="false"/>
28
<mapEntry key="org.eclipse.core.runtime/registry/debug" value="false"/>
29
<mapEntry key="org.eclipse.team.ftp/requests" value="true"/>
30
<mapEntry key="org.eclipse.core.runtime/loader/debug" value="false"/>
31
<mapEntry key="org.eclipse.core.resources/monitor/listeners" value="false"/>
63
<mapEntry key="org.eclipse.core.resources/monitor/listeners" value="false"/>
32
<mapEntry key="org.eclipse.ant.core/debug" value="true"/>
64
<mapEntry key="org.eclipse.core.resources/natures" value="false"/>
33
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes" value="false"/>
65
<mapEntry key="org.eclipse.core.resources/restore" value="false"/>
34
<mapEntry key="org.eclipse.core.boot/trace/pluginActivation" value="false"/>
66
<mapEntry key="org.eclipse.core.resources/restore/markers" value="false"/>
35
<mapEntry key="org.eclipse.core.runtime/url/debug" value="false"/>
67
<mapEntry key="org.eclipse.core.resources/restore/mastertable" value="false"/>
36
<mapEntry key="org.eclipse.update.core/debug" value="true"/>
68
<mapEntry key="org.eclipse.core.resources/restore/metainfo" value="false"/>
69
<mapEntry key="org.eclipse.core.resources/restore/snapshots" value="false"/>
70
<mapEntry key="org.eclipse.core.resources/restore/syncinfo" value="false"/>
71
<mapEntry key="org.eclipse.core.resources/restore/tree" value="false"/>
72
<mapEntry key="org.eclipse.core.resources/save" value="false"/>
73
<mapEntry key="org.eclipse.core.resources/save/markers" value="false"/>
74
<mapEntry key="org.eclipse.core.resources/save/mastertable" value="false"/>
75
<mapEntry key="org.eclipse.core.resources/save/metainfo" value="false"/>
76
<mapEntry key="org.eclipse.core.resources/save/snapshots" value="false"/>
77
<mapEntry key="org.eclipse.core.resources/save/syncinfo" value="false"/>
78
<mapEntry key="org.eclipse.core.resources/save/tree" value="false"/>
79
<mapEntry key="org.eclipse.core.runtime/config/debug" value="false"/>
80
<mapEntry key="org.eclipse.core.runtime/debug" value="false"/>
37
<mapEntry key="org.eclipse.core.runtime/debug/context" value="false"/>
81
<mapEntry key="org.eclipse.core.runtime/debug/context" value="false"/>
38
<mapEntry key="org.eclipse.help.ui/debug/ieadapter" value="false"/>
82
<mapEntry key="org.eclipse.core.runtime/jobs" value="false"/>
39
<mapEntry key="org.eclipse.jdt.core/debug/javamodel" value="false"/>
83
<mapEntry key="org.eclipse.core.runtime/jobs/beginend" value="false"/>
40
<mapEntry key="org.eclipse.team.core/streams" value="false"/>
84
<mapEntry key="org.eclipse.core.runtime/jobs/timing" value="false"/>
41
<mapEntry key="org.eclipse.core.boot/trace/classLoading" value="false"/>
85
<mapEntry key="org.eclipse.core.runtime/loader/debug" value="false"/>
86
<mapEntry key="org.eclipse.core.runtime/loader/debug/actions" value="false"/>
87
<mapEntry key="org.eclipse.core.runtime/loader/debug/activateplugin" value="false"/>
88
<mapEntry key="org.eclipse.core.runtime/loader/debug/create" value="false"/>
89
<mapEntry key="org.eclipse.core.runtime/loader/debug/failure" value="false"/>
90
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/class" value="*"/>
91
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/loader" value="*"/>
92
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/native" value="*"/>
93
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/resource" value="*"/>
94
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes" value="false"/>
95
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/failure" value="false"/>
96
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/success" value="false"/>
97
<mapEntry key="org.eclipse.core.runtime/loader/debug/properties" value="false"/>
98
<mapEntry key="org.eclipse.core.runtime/loader/debug/success" value="false"/>
99
<mapEntry key="org.eclipse.core.runtime/preferences/debug" value="false"/>
100
<mapEntry key="org.eclipse.core.runtime/registry/debug" value="false"/>
42
<mapEntry key="org.eclipse.core.runtime/registry/debug/dump" value=""/>
101
<mapEntry key="org.eclipse.core.runtime/registry/debug/dump" value=""/>
43
<mapEntry key="org.eclipse.jdt.core/debug" value="true"/>
102
<mapEntry key="org.eclipse.core.runtime/registry/debug/events/extension" value="false"/>
44
<mapEntry key="org.eclipse.core.resources/restore" value="false"/>
45
<mapEntry key="org.eclipse.update.core/debug/web" value="false"/>
46
<mapEntry key="org.eclipse.core.runtime/registry/debug/resolve" value="false"/>
47
<mapEntry key="org.eclipse.core.resources/build/delta" value="false"/>
48
<mapEntry key="org.eclipse.jdt.core/debug/search" value="false"/>
49
<mapEntry key="org.eclipse.core.boot/monitor/bundles" value="false"/>
50
<mapEntry key="org.eclipse.jdt.core/debug/compiler" value="false"/>
51
<mapEntry key="org.eclipse.core.runtime/registry/debug/events/plugin" value="false"/>
103
<mapEntry key="org.eclipse.core.runtime/registry/debug/events/plugin" value="false"/>
52
<mapEntry key="org.eclipse.update.core/debug/configuration" value="false"/>
104
<mapEntry key="org.eclipse.core.runtime/registry/debug/resolve" value="false"/>
53
<mapEntry key="org.eclipse.ui/trace/part.activate" value="false"/>
105
<mapEntry key="org.eclipse.core.runtime/timing/shutdown" value="false"/>
54
<mapEntry key="org.eclipse.help.ui/debug/infopop" value="false"/>
106
<mapEntry key="org.eclipse.core.runtime/timing/startup" value="false"/>
107
<mapEntry key="org.eclipse.core.runtime/url/debug" value="false"/>
108
<mapEntry key="org.eclipse.core.runtime/url/debug/cachecopy" value="false"/>
109
<mapEntry key="org.eclipse.core.runtime/url/debug/cachelookup" value="false"/>
110
<mapEntry key="org.eclipse.core.runtime/url/debug/connect" value="false"/>
111
<mapEntry key="org.eclipse.debug.core/debug" value="true"/>
112
<mapEntry key="org.eclipse.debug.ui/debug" value="true"/>
113
<mapEntry key="org.eclipse.help.ui/debug" value="true"/>
114
<mapEntry key="org.eclipse.help.ui/debug/ieadapter" value="false"/>
55
<mapEntry key="org.eclipse.help.ui/debug/ieadapter/inprocess" value="false"/>
115
<mapEntry key="org.eclipse.help.ui/debug/ieadapter/inprocess" value="false"/>
56
<mapEntry key="org.eclipse.jface/trace/actions" value="false"/>
116
<mapEntry key="org.eclipse.help.ui/debug/infopop" value="false"/>
57
<mapEntry key="org.eclipse.core.runtime/registry/debug/events/extension" value="false"/>
58
<mapEntry key="org.eclipse.jdt.core/debug/hierarchy" value="false"/>
59
<mapEntry key="org.eclipse.help.webapp/debug" value="true"/>
117
<mapEntry key="org.eclipse.help.webapp/debug" value="true"/>
60
<mapEntry key="org.eclipse.team.cvs.core/debug" value="true"/>
118
<mapEntry key="org.eclipse.help.webapp/debug/workingsets" value="false"/>
61
<mapEntry key="org.eclipse.jdt.core/debug/cpresolution" value="false"/>
119
<mapEntry key="org.eclipse.help/debug" value="true"/>
62
<mapEntry key="org.eclipse.team.cvs.core/threading" value="false"/>
63
<mapEntry key="org.eclipse.update.core/debug/warning" value="false"/>
64
<mapEntry key="org.eclipse.core.resources/save" value="false"/>
65
<mapEntry key="org.eclipse.update.core/debug/install" value="false"/>
66
<mapEntry key="org.eclipse.ui/debug/internalerror/openDialog" value="false"/>
67
<mapEntry key="org.eclipse.core.resources/debug" value="false"/>
68
<mapEntry key="org.eclipse.update.core/debug/parsing" value="false"/>
69
<mapEntry key="org.eclipse.core.resources/restore/syncinfo" value="false"/>
70
<mapEntry key="org.eclipse.core.boot/trace/filters" value="trace.properties"/>
71
<mapEntry key="org.eclipse.team.cvs.core/cvsprotocol" value="true"/>
72
<mapEntry key="org.eclipse.jdt.core/debug/postaction" value="false"/>
73
<mapEntry key="org.eclipse.core.runtime/url/debug/cachelookup" value="false"/>
74
<mapEntry key="org.eclipse.update.core/debug/reconciler" value="false"/>
75
<mapEntry key="org.eclipse.help/debug/context" value="false"/>
120
<mapEntry key="org.eclipse.help/debug/context" value="false"/>
121
<mapEntry key="org.eclipse.help/debug/protocols" value="false"/>
122
<mapEntry key="org.eclipse.help/debug/search" value="false"/>
123
<mapEntry key="org.eclipse.jdt.core/debug" value="true"/>
124
<mapEntry key="org.eclipse.jdt.core/debug/buffermanager" value="false"/>
76
<mapEntry key="org.eclipse.jdt.core/debug/builder" value="false"/>
125
<mapEntry key="org.eclipse.jdt.core/debug/builder" value="false"/>
77
<mapEntry key="org.eclipse.core.resources/save/syncinfo" value="false"/>
126
<mapEntry key="org.eclipse.jdt.core/debug/compiler" value="false"/>
78
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/resource" value="*"/>
127
<mapEntry key="org.eclipse.jdt.core/debug/completion" value="false"/>
79
<mapEntry key="org.eclipse.team.ftp/list" value="true"/>
128
<mapEntry key="org.eclipse.jdt.core/debug/cpresolution" value="false"/>
80
<mapEntry key="org.eclipse.core.runtime/loader/debug/activateplugin" value="false"/>
129
<mapEntry key="org.eclipse.jdt.core/debug/hierarchy" value="false"/>
81
<mapEntry key="org.eclipse.team.cvs.ssh/debug" value="false"/>
130
<mapEntry key="org.eclipse.jdt.core/debug/indexmanager" value="false"/>
82
<mapEntry key="org.eclipse.core.resources/monitor/builders" value="false"/>
83
<mapEntry key="org.eclipse.core.resources/save/markers" value="false"/>
84
<mapEntry key="org.eclipse.update.core/debug/installhandler" value="false"/>
85
<mapEntry key="org.eclipse.jdt.core/debug/javadelta" value="false"/>
131
<mapEntry key="org.eclipse.jdt.core/debug/javadelta" value="false"/>
132
<mapEntry key="org.eclipse.jdt.core/debug/javamodel" value="false"/>
133
<mapEntry key="org.eclipse.jdt.core/debug/postaction" value="false"/>
134
<mapEntry key="org.eclipse.jdt.core/debug/search" value="false"/>
86
<mapEntry key="org.eclipse.jdt.core/debug/selection" value="false"/>
135
<mapEntry key="org.eclipse.jdt.core/debug/selection" value="false"/>
87
<mapEntry key="org.eclipse.core.resources/restore/tree" value="false"/>
88
<mapEntry key="org.eclipse.ui/trace/workbench.restore" value="false"/>
89
<mapEntry key="org.eclipse.ui/trace/part.create" value="false"/>
90
<mapEntry key="org.eclipse.help/debug/protocols" value="false"/>
91
<mapEntry key="org.eclipse.core.resources/restore/snapshots" value="false"/>
92
<mapEntry key="org.eclipse.core.resources/natures" value="false"/>
93
<mapEntry key="org.eclipse.team.cvs.core/dirtycaching" value="false"/>
94
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/native" value="*"/>
95
<mapEntry key="org.eclipse.jdt.core/debug/zipaccess" value="false"/>
136
<mapEntry key="org.eclipse.jdt.core/debug/zipaccess" value="false"/>
96
<mapEntry key="org.eclipse.core.runtime/url/debug/cachecopy" value="false"/>
137
<mapEntry key="org.eclipse.jdt.debug.ui/debug" value="true"/>
97
<mapEntry key="org.eclipse.core.runtime/loader/debug/properties" value="false"/>
138
<mapEntry key="org.eclipse.jdt.debug/debug" value="true"/>
98
<mapEntry key="org.eclipse.core.runtime/loader/debug/create" value="false"/>
139
<mapEntry key="org.eclipse.jface/trace/actions" value="false"/>
99
<mapEntry key="org.eclipse.core.runtime/jobs/beginend" value="false"/>
100
<mapEntry key="org.eclipse.team.cvs.core/metafiles" value="false"/>
101
<mapEntry key="org.eclipse.team.ftp/responses" value="true"/>
102
<mapEntry key="org.eclipse.team.core/debug" value="false"/>
140
<mapEntry key="org.eclipse.team.core/debug" value="false"/>
103
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/success" value="false"/>
104
<mapEntry key="org.eclipse.core.runtime/jobs" value="false"/>
105
<mapEntry key="org.eclipse.core.boot/monitor/plugins" value="false"/>
106
<mapEntry key="org.eclipse.ui/trace/workbench.start" value="false"/>
107
<mapEntry key="org.eclipse.core.resources/save/metainfo" value="false"/>
108
<mapEntry key="org.eclipse.core.runtime/timing/startup" value="false"/>
109
<mapEntry key="org.eclipse.team.cvs.ui/consolebuffering" value="false"/>
110
<mapEntry key="org.eclipse.core.resources/build/invoking" value="false"/>
111
<mapEntry key="org.eclipse.core.runtime/loader/debug/failure" value="false"/>
112
<mapEntry key="org.eclipse.update.core/debug/type" value="false"/>
113
<mapEntry key="org.eclipse.core.resources/history" value="false"/>
114
<mapEntry key="org.eclipse.team.core/refreshjob" value="false"/>
141
<mapEntry key="org.eclipse.team.core/refreshjob" value="false"/>
115
<mapEntry key="org.eclipse.ant.core/buildfile/timing" value="false"/>
142
<mapEntry key="org.eclipse.team.core/streams" value="false"/>
116
<mapEntry key="org.eclipse.jdt.core/debug/completion" value="false"/>
143
<mapEntry key="org.eclipse.team.cvs.core/cvsprotocol" value="true"/>
117
<mapEntry key="org.eclipse.jdt.debug.ui/debug" value="true"/>
144
<mapEntry key="org.eclipse.team.cvs.core/debug" value="true"/>
118
<mapEntry key="org.eclipse.debug.core/debug" value="true"/>
145
<mapEntry key="org.eclipse.team.cvs.core/dirtycaching" value="false"/>
119
<mapEntry key="org.eclipse.help/debug" value="true"/>
146
<mapEntry key="org.eclipse.team.cvs.core/metafiles" value="false"/>
120
<mapEntry key="org.eclipse.ui/trace/perspective" value="false"/>
147
<mapEntry key="org.eclipse.team.cvs.core/syncchangeevents" value="false"/>
148
<mapEntry key="org.eclipse.team.cvs.core/threading" value="false"/>
149
<mapEntry key="org.eclipse.team.cvs.ssh/debug" value="false"/>
150
<mapEntry key="org.eclipse.team.cvs.ssh/ssh_protocol" value="false"/>
151
<mapEntry key="org.eclipse.team.cvs.ui/consolebuffering" value="false"/>
152
<mapEntry key="org.eclipse.team.cvs.ui/debug" value="false"/>
153
<mapEntry key="org.eclipse.team.ftp/debug" value="false"/>
154
<mapEntry key="org.eclipse.team.ftp/list" value="true"/>
155
<mapEntry key="org.eclipse.team.ftp/requests" value="true"/>
156
<mapEntry key="org.eclipse.team.ftp/responses" value="true"/>
121
<mapEntry key="org.eclipse.ui/debug" value="true"/>
157
<mapEntry key="org.eclipse.ui/debug" value="true"/>
122
<mapEntry key="org.eclipse.jdt.core/debug/indexmanager" value="false"/>
158
<mapEntry key="org.eclipse.ui/debug/internalerror/openDialog" value="false"/>
123
<mapEntry key="org.eclipse.core.resources/build/failure" value="false"/>
159
<mapEntry key="org.eclipse.ui/trace/graphics" value="false"/>
124
<mapEntry key="org.eclipse.core.resources/save/tree" value="false"/>
160
<mapEntry key="org.eclipse.ui/trace/part.activate" value="false"/>
125
<mapEntry key="org.eclipse.core.runtime/config/debug" value="false"/>
161
<mapEntry key="org.eclipse.ui/trace/part.create" value="false"/>
126
<mapEntry key="org.eclipse.help.ui/debug" value="true"/>
127
<mapEntry key="org.eclipse.core.resources/restore/metainfo" value="false"/>
128
<mapEntry key="org.eclipse.core.resources/save/mastertable" value="false"/>
129
<mapEntry key="org.eclipse.debug.ui/debug" value="true"/>
130
<mapEntry key="org.eclipse.jdt.debug/debug" value="true"/>
131
<mapEntry key="org.eclipse.core.runtime/debug" value="false"/>
132
<mapEntry key="org.eclipse.jdt.core/debug/buffermanager" value="false"/>
133
<mapEntry key="org.eclipse.ui/trace/part.listeners" value="false"/>
162
<mapEntry key="org.eclipse.ui/trace/part.listeners" value="false"/>
134
<mapEntry key="org.eclipse.core.runtime/loader/debug/success" value="false"/>
163
<mapEntry key="org.eclipse.ui/trace/perspective" value="false"/>
135
<mapEntry key="org.eclipse.core.resources/restore/mastertable" value="false"/>
164
<mapEntry key="org.eclipse.ui/trace/workbench.restore" value="false"/>
136
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/class" value="*"/>
165
<mapEntry key="org.eclipse.ui/trace/workbench.start" value="false"/>
137
<mapEntry key="org.eclipse.core.runtime/preferences/debug" value="false"/>
166
<mapEntry key="org.eclipse.update.core/debug" value="true"/>
138
<mapEntry key="org.eclipse.core.runtime/jobs/timing" value="false"/>
167
<mapEntry key="org.eclipse.update.core/debug/configuration" value="false"/>
139
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/failure" value="false"/>
168
<mapEntry key="org.eclipse.update.core/debug/install" value="false"/>
169
<mapEntry key="org.eclipse.update.core/debug/installhandler" value="false"/>
170
<mapEntry key="org.eclipse.update.core/debug/parsing" value="false"/>
171
<mapEntry key="org.eclipse.update.core/debug/reconciler" value="false"/>
172
<mapEntry key="org.eclipse.update.core/debug/type" value="false"/>
173
<mapEntry key="org.eclipse.update.core/debug/warning" value="false"/>
174
<mapEntry key="org.eclipse.update.core/debug/web" value="false"/>
140
</mapAttribute>
175
</mapAttribute>
141
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
176
<booleanAttribute key="useCustomFeatures" value="false"/>
142
<booleanAttribute key="automaticAdd" value="true"/>
143
<stringAttribute key="checked" value="[NONE]"/>
144
<booleanAttribute key="includeFragments" value="false"/>
145
<booleanAttribute key="clearws" value="true"/>
146
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.AllTests"/>
147
<stringAttribute key="location1" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace"/>
148
<booleanAttribute key="default" value="false"/>
149
<stringAttribute key="vmargs" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName2=testFileAdditions"/>
150
<booleanAttribute key="clearConfig" value="true"/>
151
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
152
<stringAttribute key="extplugins" value="org.eclipse.core.resources.compatibility;org.eclipse.jdt.doc.isv;org.eclipse.jdt.doc.user;org.eclipse.jdt.source;org.eclipse.pde.doc.user;org.eclipse.pde.source;org.eclipse.platform;org.eclipse.platform.source;org.eclipse.platform.source.win32.win32.x86;org.eclipse.sdk;"/>
153
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
154
<booleanAttribute key="useDefaultConfigArea" value="true"/>
155
<stringAttribute key="onePluginID" value=""/>
156
<booleanAttribute key="useDefaultConfig" value="true"/>
177
<booleanAttribute key="useDefaultConfig" value="true"/>
157
<stringAttribute key="progargs" value="-os win32 -ws win32 -arch x86 -nl en_CA"/>
178
<booleanAttribute key="useDefaultConfigArea" value="true"/>
158
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
179
<booleanAttribute key="useProduct" value="false"/>
159
<stringAttribute key="wsproject" value="org.eclipse.pde.ui;"/>
160
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
161
<booleanAttribute key="askclear" value="false"/>
162
<booleanAttribute key="onePlugin" value="false"/>
163
<booleanAttribute key="includeOptional" value="true"/>
164
<booleanAttribute key="maximized" value="false"/>
165
<stringAttribute key="location0" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace2"/>
166
</launchConfiguration>
180
</launchConfiguration>
(-)launchConfigurations/CVS UI Tests.launch (-113 / +116 lines)
Lines 9-15 Link Here
9
<booleanAttribute key="clearws" value="true"/>
9
<booleanAttribute key="clearws" value="true"/>
10
<booleanAttribute key="clearwslog" value="false"/>
10
<booleanAttribute key="clearwslog" value="false"/>
11
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/CVS UI Tests"/>
11
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/CVS UI Tests"/>
12
<booleanAttribute key="default" value="true"/>
12
<booleanAttribute key="default" value="false"/>
13
<booleanAttribute key="includeFragments" value="false"/>
13
<booleanAttribute key="includeFragments" value="false"/>
14
<booleanAttribute key="includeOptional" value="true"/>
14
<booleanAttribute key="includeOptional" value="true"/>
15
<stringAttribute key="location" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace"/>
15
<stringAttribute key="location" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace"/>
Lines 31-175 Link Here
31
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
31
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
32
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
32
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
33
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
33
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
34
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_20"/>
34
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.AllTests"/>
35
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.AllTests"/>
35
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os win32 -ws win32 -arch x86 -nl en_CA"/>
36
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os win32 -ws win32 -arch x86 -nl en_CA"/>
36
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
37
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
37
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
38
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
38
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName2=testFileAdditions"/>
39
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.cvs.properties=g:\eclipse\repository.properties -Declipse.cvs.testName2=testFileAdditions"/>
39
<stringAttribute key="pde.version" value="3.3"/>
40
<stringAttribute key="pde.version" value="3.3"/>
40
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
41
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
41
<booleanAttribute key="run_in_ui_thread" value="true"/>
42
<booleanAttribute key="run_in_ui_thread" value="true"/>
43
<stringAttribute key="selected_target_plugins" value="com.google.collect@default:default,com.google.inject@default:default,com.ibm.icu@default:default,com.jcraft.jsch@default:default,javax.servlet.jsp@default:default,javax.servlet@default:default,org.antlr.runtime@default:default,org.aopalliance@default:default,org.apache.ant@default:default,org.apache.commons.cli@default:default,org.apache.commons.codec@default:default,org.apache.commons.el@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging@default:default,org.apache.jasper@default:default,org.apache.log4j@default:default,org.apache.lucene.analysis@default:default,org.apache.lucene.core@default:default,org.apache.lucene.highlighter@default:default,org.apache.lucene.memory@default:default,org.apache.lucene.misc@default:default,org.apache.lucene.queries@default:default,org.apache.lucene.snowball@default:default,org.apache.lucene.spellchecker@default:default,org.apache.lucene@default:default,org.eclipse.ant.core@default:default,org.eclipse.ant.launching@default:default,org.eclipse.ant.ui@default:default,org.eclipse.compare.core@default:default,org.eclipse.compare.win32@default:default,org.eclipse.compare@default:default,org.eclipse.core.boot@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.filesystem.win32.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.win32.x86_64@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.cvs@default:default,org.eclipse.debug.core@default:default,org.eclipse.debug.ui@default:default,org.eclipse.draw2d.doc.isv@default:default,org.eclipse.draw2d@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf@default:default,org.eclipse.emf.codegen.ecore.ui@default:default,org.eclipse.emf.codegen.ecore@default:default,org.eclipse.emf.codegen@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.converter@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.emf.ecore.editor@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.emf.edit@default:default,org.eclipse.emf.mwe.activities@default:default,org.eclipse.emf.mwe.core@default:default,org.eclipse.emf.mwe.ui.simpleEditor@default:default,org.eclipse.emf.mwe.ui@default:default,org.eclipse.emf.mwe.utils@default:default,org.eclipse.emf.mwe2.language.ui@default:default,org.eclipse.emf.mwe2.language@default:default,org.eclipse.emf.mwe2.launch@default:default,org.eclipse.emf.mwe2.lib@default:default,org.eclipse.emf.mwe2.runtime@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.equinox.launcher.win32.win32.x86_64@default:false,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.equinox.p2.publisher.eclipse@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.equinox.p2.transport.ecf@default:default,org.eclipse.equinox.p2.ui.importexport@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.equinox.security.win32.x86_64@default:false,org.eclipse.equinox.security@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.util@default:default,org.eclipse.gef.doc.isv@default:default,org.eclipse.gef.examples.flow@default:default,org.eclipse.gef.examples.logic@default:default,org.eclipse.gef.examples.shapes@default:default,org.eclipse.gef.examples.text@default:default,org.eclipse.gef.examples.ui.pde@default:default,org.eclipse.gef@default:default,org.eclipse.help.appserver@default:default,org.eclipse.help.base@default:default,org.eclipse.help.ui@default:default,org.eclipse.help.webapp@default:default,org.eclipse.help@default:default,org.eclipse.jdt.apt.core@default:default,org.eclipse.jdt.apt.pluggable.core@default:default,org.eclipse.jdt.apt.ui@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.jdt.core@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.jdt.doc.isv@default:default,org.eclipse.jdt.doc.user@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.jdt.junit4.runtime@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.jdt@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.jsch.core@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.eclipse.pde.api.tools.ui@default:default,org.eclipse.pde.api.tools@default:default,org.eclipse.pde.build@default:default,org.eclipse.pde.core@default:default,org.eclipse.pde.doc.user@default:default,org.eclipse.pde.ds.core@default:default,org.eclipse.pde.ds.ui@default:default,org.eclipse.pde.junit.runtime@default:default,org.eclipse.pde.launching@default:default,org.eclipse.pde.runtime@default:default,org.eclipse.pde.ua.core@default:default,org.eclipse.pde.ua.ui@default:default,org.eclipse.pde.ui.templates@default:default,org.eclipse.pde.ui@default:default,org.eclipse.pde@default:default,org.eclipse.platform.doc.isv@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.platform@default:default,org.eclipse.rcp@default:default,org.eclipse.sdk@default:default,org.eclipse.search@default:default,org.eclipse.swt.win32.win32.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.team.ui@default:default,org.eclipse.text@default:default,org.eclipse.ui.browser@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.console@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.net@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.win32@default:false,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.eclipse.update.configurator@3:true,org.eclipse.update.core.win32@default:false,org.eclipse.update.core@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.update.ui@default:default,org.eclipse.xpand.activities@default:default,org.eclipse.xpand.ui@default:default,org.eclipse.xpand@default:default,org.eclipse.xtend.check.ui@default:default,org.eclipse.xtend.profiler@default:default,org.eclipse.xtend.shared.ui@default:default,org.eclipse.xtend.typesystem.emf.ui@default:default,org.eclipse.xtend.typesystem.emf@default:default,org.eclipse.xtend.ui@default:default,org.eclipse.xtend@default:default,org.eclipse.xtext.activities@default:default,org.eclipse.xtext.builder@default:default,org.eclipse.xtext.common.types.shared@default:default,org.eclipse.xtext.common.types.ui@default:default,org.eclipse.xtext.common.types@default:default,org.eclipse.xtext.doc@default:default,org.eclipse.xtext.ecore@default:default,org.eclipse.xtext.generator@default:default,org.eclipse.xtext.junit4@default:default,org.eclipse.xtext.junit@default:default,org.eclipse.xtext.logging@default:false,org.eclipse.xtext.purexbase.ui@default:default,org.eclipse.xtext.purexbase@default:default,org.eclipse.xtext.ui.codetemplates.ui@default:default,org.eclipse.xtext.ui.codetemplates@default:default,org.eclipse.xtext.ui.ecore@default:default,org.eclipse.xtext.ui.junit@default:default,org.eclipse.xtext.ui.shared@default:default,org.eclipse.xtext.ui@default:default,org.eclipse.xtext.util@default:default,org.eclipse.xtext.xbase.junit@default:default,org.eclipse.xtext.xbase.lib@default:default,org.eclipse.xtext.xbase.ui@default:default,org.eclipse.xtext.xbase@default:default,org.eclipse.xtext.xtend2.lib@default:default,org.eclipse.xtext.xtend2.ui@default:default,org.eclipse.xtext.xtend2@default:default,org.eclipse.xtext.xtext.ui.examples@default:default,org.eclipse.xtext.xtext.ui.graph@default:default,org.eclipse.xtext.xtext.ui@default:default,org.eclipse.xtext@default:default,org.hamcrest.core@default:default,org.junit*3.8.2.v3_8_2_v20100427-1100@default:default,org.junit*4.8.2.v4_8_2_v20110321-1705@default:default,org.junit4@default:default,org.mortbay.jetty.server@default:default,org.mortbay.jetty.util@default:default,org.objectweb.asm@default:default,org.sat4j.core@default:default,org.sat4j.pb@default:default"/>
44
<stringAttribute key="selected_workspace_plugins" value="org.eclipse.compare.tests@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.tests.harness@default:default,org.eclipse.core.tests.resources@default:default,org.eclipse.jface@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.team.tests.core@default:default,org.eclipse.team.tests.cvs.core@default:default,org.eclipse.test.performance@default:default,workspace_loc@default:default"/>
42
<booleanAttribute key="show_selected_only" value="false"/>
45
<booleanAttribute key="show_selected_only" value="false"/>
43
<booleanAttribute key="tracing" value="true"/>
46
<booleanAttribute key="tracing" value="true"/>
44
<mapAttribute key="tracingOptions">
47
<mapAttribute key="tracingOptions">
45
<mapEntry key="org.eclipse.core.runtime/debug/context" value="false"/>
48
<mapEntry key="org.eclipse.ant.core/buildfile/timing" value="false"/>
46
<mapEntry key="org.eclipse.jdt.core/debug/completion" value="false"/>
47
<mapEntry key="org.eclipse.jdt.core/debug/indexmanager" value="false"/>
48
<mapEntry key="org.eclipse.team.ftp/requests" value="true"/>
49
<mapEntry key="org.eclipse.core.resources/restore" value="false"/>
50
<mapEntry key="org.eclipse.ui/trace/workbench.restore" value="false"/>
51
<mapEntry key="org.eclipse.core.boot/trace/pluginActivation" value="false"/>
52
<mapEntry key="org.eclipse.jdt.core/debug" value="true"/>
53
<mapEntry key="org.eclipse.core.resources/save/markers" value="false"/>
54
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/native" value="*"/>
55
<mapEntry key="org.eclipse.team.cvs.core/dirtycaching" value="false"/>
56
<mapEntry key="org.eclipse.jdt.core/debug/javamodel" value="false"/>
57
<mapEntry key="org.eclipse.ui/trace/part.listeners" value="false"/>
58
<mapEntry key="org.eclipse.help.ui/debug/ieadapter/inprocess" value="false"/>
59
<mapEntry key="org.eclipse.ui/trace/workbench.start" value="false"/>
60
<mapEntry key="org.eclipse.update.core/debug/install" value="false"/>
61
<mapEntry key="org.eclipse.help.ui/debug/ieadapter" value="false"/>
62
<mapEntry key="org.eclipse.ant.core/debug" value="true"/>
49
<mapEntry key="org.eclipse.ant.core/debug" value="true"/>
63
<mapEntry key="org.eclipse.team.core/refreshjob" value="false"/>
50
<mapEntry key="org.eclipse.core.boot/monitor/bundles" value="false"/>
64
<mapEntry key="org.eclipse.update.core/debug/installhandler" value="false"/>
51
<mapEntry key="org.eclipse.core.boot/monitor/classes" value="false"/>
65
<mapEntry key="org.eclipse.ui/debug" value="true"/>
52
<mapEntry key="org.eclipse.core.boot/monitor/plugins" value="false"/>
66
<mapEntry key="org.eclipse.help.ui/debug/infopop" value="false"/>
53
<mapEntry key="org.eclipse.core.boot/trace/classLoading" value="false"/>
67
<mapEntry key="org.eclipse.help/debug/protocols" value="false"/>
54
<mapEntry key="org.eclipse.core.boot/trace/filename" value="runtime.traces"/>
68
<mapEntry key="org.eclipse.core.resources/save/metainfo" value="false"/>
55
<mapEntry key="org.eclipse.core.boot/trace/filters" value="trace.properties"/>
69
<mapEntry key="org.eclipse.jface/trace/actions" value="false"/>
56
<mapEntry key="org.eclipse.core.boot/trace/pluginActivation" value="false"/>
70
<mapEntry key="org.eclipse.team.cvs.core/threading" value="false"/>
57
<mapEntry key="org.eclipse.core.resources/build/delta" value="false"/>
58
<mapEntry key="org.eclipse.core.resources/build/failure" value="false"/>
59
<mapEntry key="org.eclipse.core.resources/build/invoking" value="false"/>
60
<mapEntry key="org.eclipse.core.resources/build/needbuild" value="false"/>
61
<mapEntry key="org.eclipse.core.resources/debug" value="false"/>
62
<mapEntry key="org.eclipse.core.resources/history" value="false"/>
63
<mapEntry key="org.eclipse.core.resources/monitor/builders" value="false"/>
71
<mapEntry key="org.eclipse.core.resources/monitor/listeners" value="false"/>
64
<mapEntry key="org.eclipse.core.resources/monitor/listeners" value="false"/>
72
<mapEntry key="org.eclipse.ui/trace/part.activate" value="false"/>
65
<mapEntry key="org.eclipse.core.resources/natures" value="false"/>
66
<mapEntry key="org.eclipse.core.resources/restore" value="false"/>
67
<mapEntry key="org.eclipse.core.resources/restore/markers" value="false"/>
68
<mapEntry key="org.eclipse.core.resources/restore/mastertable" value="false"/>
69
<mapEntry key="org.eclipse.core.resources/restore/metainfo" value="false"/>
70
<mapEntry key="org.eclipse.core.resources/restore/snapshots" value="false"/>
71
<mapEntry key="org.eclipse.core.resources/restore/syncinfo" value="false"/>
73
<mapEntry key="org.eclipse.core.resources/restore/tree" value="false"/>
72
<mapEntry key="org.eclipse.core.resources/restore/tree" value="false"/>
74
<mapEntry key="org.eclipse.update.core/debug/parsing" value="false"/>
73
<mapEntry key="org.eclipse.core.resources/save" value="false"/>
75
<mapEntry key="org.eclipse.jdt.core/debug/postaction" value="false"/>
74
<mapEntry key="org.eclipse.core.resources/save/markers" value="false"/>
76
<mapEntry key="org.eclipse.help/debug/context" value="false"/>
75
<mapEntry key="org.eclipse.core.resources/save/mastertable" value="false"/>
77
<mapEntry key="org.eclipse.core.resources/monitor/builders" value="false"/>
76
<mapEntry key="org.eclipse.core.resources/save/metainfo" value="false"/>
78
<mapEntry key="org.eclipse.ui/trace/graphics" value="false"/>
77
<mapEntry key="org.eclipse.core.resources/save/snapshots" value="false"/>
79
<mapEntry key="org.eclipse.core.runtime/registry/debug/events/plugin" value="false"/>
80
<mapEntry key="org.eclipse.core.runtime/loader/debug/success" value="false"/>
81
<mapEntry key="org.eclipse.core.runtime/registry/debug" value="false"/>
82
<mapEntry key="org.eclipse.core.resources/save/syncinfo" value="false"/>
78
<mapEntry key="org.eclipse.core.resources/save/syncinfo" value="false"/>
83
<mapEntry key="org.eclipse.team.cvs.ssh/debug" value="false"/>
79
<mapEntry key="org.eclipse.core.resources/save/tree" value="false"/>
80
<mapEntry key="org.eclipse.core.runtime/config/debug" value="false"/>
81
<mapEntry key="org.eclipse.core.runtime/debug" value="false"/>
82
<mapEntry key="org.eclipse.core.runtime/debug/context" value="false"/>
83
<mapEntry key="org.eclipse.core.runtime/jobs" value="false"/>
84
<mapEntry key="org.eclipse.core.runtime/jobs/beginend" value="false"/>
84
<mapEntry key="org.eclipse.core.runtime/jobs/timing" value="false"/>
85
<mapEntry key="org.eclipse.core.runtime/jobs/timing" value="false"/>
85
<mapEntry key="org.eclipse.core.resources/build/failure" value="false"/>
86
<mapEntry key="org.eclipse.core.runtime/loader/debug" value="false"/>
86
<mapEntry key="org.eclipse.team.cvs.ui/debug" value="false"/>
87
<mapEntry key="org.eclipse.core.runtime/loader/debug/actions" value="false"/>
87
<mapEntry key="org.eclipse.team.core/debug" value="false"/>
88
<mapEntry key="org.eclipse.core.runtime/loader/debug/activateplugin" value="false"/>
88
<mapEntry key="org.eclipse.jdt.core/debug/builder" value="false"/>
89
<mapEntry key="org.eclipse.core.runtime/loader/debug/create" value="false"/>
90
<mapEntry key="org.eclipse.core.runtime/loader/debug/failure" value="false"/>
89
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/class" value="*"/>
91
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/class" value="*"/>
92
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/loader" value="*"/>
93
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/native" value="*"/>
94
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/resource" value="*"/>
95
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes" value="false"/>
96
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/failure" value="false"/>
97
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/success" value="false"/>
98
<mapEntry key="org.eclipse.core.runtime/loader/debug/properties" value="false"/>
99
<mapEntry key="org.eclipse.core.runtime/loader/debug/success" value="false"/>
100
<mapEntry key="org.eclipse.core.runtime/preferences/debug" value="false"/>
101
<mapEntry key="org.eclipse.core.runtime/registry/debug" value="false"/>
102
<mapEntry key="org.eclipse.core.runtime/registry/debug/dump" value=""/>
103
<mapEntry key="org.eclipse.core.runtime/registry/debug/events/extension" value="false"/>
104
<mapEntry key="org.eclipse.core.runtime/registry/debug/events/plugin" value="false"/>
105
<mapEntry key="org.eclipse.core.runtime/registry/debug/resolve" value="false"/>
106
<mapEntry key="org.eclipse.core.runtime/timing/shutdown" value="false"/>
107
<mapEntry key="org.eclipse.core.runtime/timing/startup" value="false"/>
108
<mapEntry key="org.eclipse.core.runtime/url/debug" value="false"/>
109
<mapEntry key="org.eclipse.core.runtime/url/debug/cachecopy" value="false"/>
110
<mapEntry key="org.eclipse.core.runtime/url/debug/cachelookup" value="false"/>
111
<mapEntry key="org.eclipse.core.runtime/url/debug/connect" value="false"/>
112
<mapEntry key="org.eclipse.debug.core/debug" value="true"/>
90
<mapEntry key="org.eclipse.debug.ui/debug" value="true"/>
113
<mapEntry key="org.eclipse.debug.ui/debug" value="true"/>
91
<mapEntry key="org.eclipse.core.resources/save" value="false"/>
114
<mapEntry key="org.eclipse.help.ui/debug" value="true"/>
92
<mapEntry key="org.eclipse.jdt.debug/debug" value="true"/>
115
<mapEntry key="org.eclipse.help.ui/debug/ieadapter" value="false"/>
116
<mapEntry key="org.eclipse.help.ui/debug/ieadapter/inprocess" value="false"/>
117
<mapEntry key="org.eclipse.help.ui/debug/infopop" value="false"/>
118
<mapEntry key="org.eclipse.help.webapp/debug" value="true"/>
119
<mapEntry key="org.eclipse.help.webapp/debug/workingsets" value="false"/>
120
<mapEntry key="org.eclipse.help/debug" value="true"/>
121
<mapEntry key="org.eclipse.help/debug/context" value="false"/>
122
<mapEntry key="org.eclipse.help/debug/protocols" value="false"/>
123
<mapEntry key="org.eclipse.help/debug/search" value="false"/>
124
<mapEntry key="org.eclipse.jdt.core/debug" value="true"/>
93
<mapEntry key="org.eclipse.jdt.core/debug/buffermanager" value="false"/>
125
<mapEntry key="org.eclipse.jdt.core/debug/buffermanager" value="false"/>
126
<mapEntry key="org.eclipse.jdt.core/debug/builder" value="false"/>
94
<mapEntry key="org.eclipse.jdt.core/debug/compiler" value="false"/>
127
<mapEntry key="org.eclipse.jdt.core/debug/compiler" value="false"/>
95
<mapEntry key="org.eclipse.core.runtime/timing/shutdown" value="false"/>
128
<mapEntry key="org.eclipse.jdt.core/debug/completion" value="false"/>
96
<mapEntry key="org.eclipse.core.runtime/loader/debug/activateplugin" value="false"/>
97
<mapEntry key="org.eclipse.update.core/debug/type" value="false"/>
98
<mapEntry key="org.eclipse.core.runtime/registry/debug/events/extension" value="false"/>
99
<mapEntry key="org.eclipse.help.webapp/debug" value="true"/>
100
<mapEntry key="org.eclipse.team.cvs.core/metafiles" value="false"/>
101
<mapEntry key="org.eclipse.team.ftp/responses" value="true"/>
102
<mapEntry key="org.eclipse.team.ftp/debug" value="false"/>
103
<mapEntry key="org.eclipse.core.boot/trace/filename" value="runtime.traces"/>
104
<mapEntry key="org.eclipse.ui/trace/part.create" value="false"/>
105
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/loader" value="*"/>
106
<mapEntry key="org.eclipse.ui/debug/internalerror/openDialog" value="false"/>
107
<mapEntry key="org.eclipse.core.resources/build/invoking" value="false"/>
108
<mapEntry key="org.eclipse.core.resources/save/tree" value="false"/>
109
<mapEntry key="org.eclipse.update.core/debug/warning" value="false"/>
110
<mapEntry key="org.eclipse.core.resources/natures" value="false"/>
111
<mapEntry key="org.eclipse.core.runtime/timing/startup" value="false"/>
112
<mapEntry key="org.eclipse.update.core/debug/configuration" value="false"/>
113
<mapEntry key="org.eclipse.jdt.core/debug/cpresolution" value="false"/>
129
<mapEntry key="org.eclipse.jdt.core/debug/cpresolution" value="false"/>
114
<mapEntry key="org.eclipse.core.boot/trace/filters" value="trace.properties"/>
115
<mapEntry key="org.eclipse.help/debug/search" value="false"/>
116
<mapEntry key="org.eclipse.team.cvs.ssh/ssh_protocol" value="false"/>
117
<mapEntry key="org.eclipse.core.runtime/url/debug/connect" value="false"/>
118
<mapEntry key="org.eclipse.team.core/streams" value="false"/>
119
<mapEntry key="org.eclipse.core.runtime/loader/debug/failure" value="false"/>
120
<mapEntry key="org.eclipse.core.runtime/loader/debug/create" value="false"/>
121
<mapEntry key="org.eclipse.jdt.core/debug/hierarchy" value="false"/>
130
<mapEntry key="org.eclipse.jdt.core/debug/hierarchy" value="false"/>
122
<mapEntry key="org.eclipse.update.core/debug/reconciler" value="false"/>
131
<mapEntry key="org.eclipse.jdt.core/debug/indexmanager" value="false"/>
123
<mapEntry key="org.eclipse.core.resources/save/mastertable" value="false"/>
124
<mapEntry key="org.eclipse.core.resources/save/snapshots" value="false"/>
125
<mapEntry key="org.eclipse.jdt.core/debug/javadelta" value="false"/>
132
<mapEntry key="org.eclipse.jdt.core/debug/javadelta" value="false"/>
126
<mapEntry key="org.eclipse.core.runtime/loader/debug/filter/resource" value="*"/>
133
<mapEntry key="org.eclipse.jdt.core/debug/javamodel" value="false"/>
134
<mapEntry key="org.eclipse.jdt.core/debug/postaction" value="false"/>
135
<mapEntry key="org.eclipse.jdt.core/debug/search" value="false"/>
127
<mapEntry key="org.eclipse.jdt.core/debug/selection" value="false"/>
136
<mapEntry key="org.eclipse.jdt.core/debug/selection" value="false"/>
128
<mapEntry key="org.eclipse.ant.core/buildfile/timing" value="false"/>
129
<mapEntry key="org.eclipse.core.runtime/jobs/beginend" value="false"/>
130
<mapEntry key="org.eclipse.core.boot/monitor/bundles" value="false"/>
131
<mapEntry key="org.eclipse.core.runtime/loader/debug" value="false"/>
132
<mapEntry key="org.eclipse.debug.core/debug" value="true"/>
133
<mapEntry key="org.eclipse.core.resources/debug" value="false"/>
134
<mapEntry key="org.eclipse.jdt.core/debug/zipaccess" value="false"/>
137
<mapEntry key="org.eclipse.jdt.core/debug/zipaccess" value="false"/>
135
<mapEntry key="org.eclipse.core.runtime/loader/debug/properties" value="false"/>
138
<mapEntry key="org.eclipse.jdt.debug.ui/debug" value="true"/>
136
<mapEntry key="org.eclipse.update.core/debug/web" value="false"/>
139
<mapEntry key="org.eclipse.jdt.debug/debug" value="true"/>
140
<mapEntry key="org.eclipse.jface/trace/actions" value="false"/>
141
<mapEntry key="org.eclipse.team.core/debug" value="false"/>
142
<mapEntry key="org.eclipse.team.core/refreshjob" value="false"/>
143
<mapEntry key="org.eclipse.team.core/streams" value="false"/>
144
<mapEntry key="org.eclipse.team.cvs.core/cvsprotocol" value="true"/>
137
<mapEntry key="org.eclipse.team.cvs.core/debug" value="true"/>
145
<mapEntry key="org.eclipse.team.cvs.core/debug" value="true"/>
138
<mapEntry key="org.eclipse.help/debug" value="true"/>
146
<mapEntry key="org.eclipse.team.cvs.core/dirtycaching" value="false"/>
139
<mapEntry key="org.eclipse.team.ftp/list" value="true"/>
147
<mapEntry key="org.eclipse.team.cvs.core/metafiles" value="false"/>
140
<mapEntry key="org.eclipse.core.runtime/registry/debug/resolve" value="false"/>
141
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/success" value="false"/>
142
<mapEntry key="org.eclipse.team.cvs.ui/consolebuffering" value="false"/>
143
<mapEntry key="org.eclipse.core.boot/monitor/plugins" value="false"/>
144
<mapEntry key="org.eclipse.core.runtime/preferences/debug" value="false"/>
145
<mapEntry key="org.eclipse.update.core/debug" value="true"/>
146
<mapEntry key="org.eclipse.core.resources/restore/metainfo" value="false"/>
147
<mapEntry key="org.eclipse.core.resources/build/needbuild" value="false"/>
148
<mapEntry key="org.eclipse.core.resources/restore/syncinfo" value="false"/>
149
<mapEntry key="org.eclipse.team.cvs.core/syncchangeevents" value="false"/>
148
<mapEntry key="org.eclipse.team.cvs.core/syncchangeevents" value="false"/>
150
<mapEntry key="org.eclipse.core.runtime/loader/debug/actions" value="false"/>
149
<mapEntry key="org.eclipse.team.cvs.core/threading" value="false"/>
151
<mapEntry key="org.eclipse.core.runtime/registry/debug/dump" value=""/>
150
<mapEntry key="org.eclipse.team.cvs.ssh/debug" value="false"/>
152
<mapEntry key="org.eclipse.core.resources/history" value="false"/>
151
<mapEntry key="org.eclipse.team.cvs.ssh/ssh_protocol" value="false"/>
153
<mapEntry key="org.eclipse.jdt.core/debug/search" value="false"/>
152
<mapEntry key="org.eclipse.team.cvs.ui/consolebuffering" value="false"/>
154
<mapEntry key="org.eclipse.core.runtime/config/debug" value="false"/>
153
<mapEntry key="org.eclipse.team.cvs.ui/debug" value="false"/>
155
<mapEntry key="org.eclipse.team.cvs.core/cvsprotocol" value="true"/>
154
<mapEntry key="org.eclipse.team.ftp/debug" value="false"/>
156
<mapEntry key="org.eclipse.core.resources/restore/mastertable" value="false"/>
155
<mapEntry key="org.eclipse.team.ftp/list" value="true"/>
157
<mapEntry key="org.eclipse.core.runtime/debug" value="false"/>
156
<mapEntry key="org.eclipse.team.ftp/requests" value="true"/>
158
<mapEntry key="org.eclipse.core.resources/restore/snapshots" value="false"/>
157
<mapEntry key="org.eclipse.team.ftp/responses" value="true"/>
159
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/failure" value="false"/>
158
<mapEntry key="org.eclipse.ui/debug" value="true"/>
160
<mapEntry key="org.eclipse.core.boot/trace/classLoading" value="false"/>
159
<mapEntry key="org.eclipse.ui/debug/internalerror/openDialog" value="false"/>
161
<mapEntry key="org.eclipse.core.runtime/url/debug/cachelookup" value="false"/>
160
<mapEntry key="org.eclipse.ui/trace/graphics" value="false"/>
162
<mapEntry key="org.eclipse.help.webapp/debug/workingsets" value="false"/>
161
<mapEntry key="org.eclipse.ui/trace/part.activate" value="false"/>
163
<mapEntry key="org.eclipse.core.resources/build/delta" value="false"/>
162
<mapEntry key="org.eclipse.ui/trace/part.create" value="false"/>
164
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes" value="false"/>
163
<mapEntry key="org.eclipse.ui/trace/part.listeners" value="false"/>
165
<mapEntry key="org.eclipse.core.resources/restore/markers" value="false"/>
166
<mapEntry key="org.eclipse.core.boot/monitor/classes" value="false"/>
167
<mapEntry key="org.eclipse.core.runtime/url/debug" value="false"/>
168
<mapEntry key="org.eclipse.help.ui/debug" value="true"/>
169
<mapEntry key="org.eclipse.core.runtime/url/debug/cachecopy" value="false"/>
170
<mapEntry key="org.eclipse.core.runtime/jobs" value="false"/>
171
<mapEntry key="org.eclipse.jdt.debug.ui/debug" value="true"/>
172
<mapEntry key="org.eclipse.ui/trace/perspective" value="false"/>
164
<mapEntry key="org.eclipse.ui/trace/perspective" value="false"/>
165
<mapEntry key="org.eclipse.ui/trace/workbench.restore" value="false"/>
166
<mapEntry key="org.eclipse.ui/trace/workbench.start" value="false"/>
167
<mapEntry key="org.eclipse.update.core/debug" value="true"/>
168
<mapEntry key="org.eclipse.update.core/debug/configuration" value="false"/>
169
<mapEntry key="org.eclipse.update.core/debug/install" value="false"/>
170
<mapEntry key="org.eclipse.update.core/debug/installhandler" value="false"/>
171
<mapEntry key="org.eclipse.update.core/debug/parsing" value="false"/>
172
<mapEntry key="org.eclipse.update.core/debug/reconciler" value="false"/>
173
<mapEntry key="org.eclipse.update.core/debug/type" value="false"/>
174
<mapEntry key="org.eclipse.update.core/debug/warning" value="false"/>
175
<mapEntry key="org.eclipse.update.core/debug/web" value="false"/>
173
</mapAttribute>
176
</mapAttribute>
174
<booleanAttribute key="useCustomFeatures" value="false"/>
177
<booleanAttribute key="useCustomFeatures" value="false"/>
175
<booleanAttribute key="useDefaultConfig" value="true"/>
178
<booleanAttribute key="useDefaultConfig" value="true"/>
(-)src/org/eclipse/team/tests/ccvs/core/EclipseTest.java (+31 lines)
Lines 19-24 Link Here
19
import java.io.PrintStream;
19
import java.io.PrintStream;
20
import java.io.Reader;
20
import java.io.Reader;
21
import java.lang.reflect.InvocationTargetException;
21
import java.lang.reflect.InvocationTargetException;
22
import java.net.URI;
23
import java.net.URISyntaxException;
22
import java.util.ArrayList;
24
import java.util.ArrayList;
23
import java.util.Arrays;
25
import java.util.Arrays;
24
import java.util.HashMap;
26
import java.util.HashMap;
Lines 32-37 Link Here
32
34
33
import org.eclipse.core.resources.IContainer;
35
import org.eclipse.core.resources.IContainer;
34
import org.eclipse.core.resources.IFile;
36
import org.eclipse.core.resources.IFile;
37
import org.eclipse.core.resources.IFolder;
35
import org.eclipse.core.resources.IProject;
38
import org.eclipse.core.resources.IProject;
36
import org.eclipse.core.resources.IResource;
39
import org.eclipse.core.resources.IResource;
37
import org.eclipse.core.resources.IResourceVisitor;
40
import org.eclipse.core.resources.IResourceVisitor;
Lines 807-812 Link Here
807
						ignoredState, getCVSResource(resource).isIgnored());
810
						ignoredState, getCVSResource(resource).isIgnored());
808
	}
811
	}
809
	
812
	
813
	protected void assertIsNotIgnored(IResource resource, boolean ignoredState) throws TeamException {
814
		assertEquals("Resource " + resource.getFullPath() + " should be ignored but isn't.", 
815
						ignoredState, !getCVSResource(resource).isIgnored());
816
	}
817
810
	protected void assertValidCheckout(IProject project) {
818
	protected void assertValidCheckout(IProject project) {
811
		// NOTE: Add code to ensure that the project was checkout out properly
819
		// NOTE: Add code to ensure that the project was checkout out properly
812
		CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project);
820
		CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project);
Lines 1468-1471 Link Here
1468
		//don't leak builder jobs, since they may affect subsequent tests
1476
		//don't leak builder jobs, since they may affect subsequent tests
1469
		waitForBuild();
1477
		waitForBuild();
1470
    }
1478
    }
1479
    
1480
    protected void createLink(IProject project, String name, IPath target) {
1481
		IPath relativeTarget = null;
1482
        try {
1483
			relativeTarget = new Path(project.getPathVariableManager().convertToRelative(new URI(target.toString()), true, null).getPath());
1484
		} catch (CoreException e) {
1485
			fail("failure with convertToRelative(" + target + ")", e);
1486
		} catch (URISyntaxException e) {
1487
			fail("failure with convertToRelative(" + target + ")", e);			
1488
		}
1489
		try {
1490
			if (name.endsWith("/")) {
1491
				name = name.substring(0, name.lastIndexOf('/'));
1492
				IFolder folder = project.getFolder(new Path(name));
1493
				folder.createLink(relativeTarget, 0, getMonitor());
1494
			} else {
1495
				IFile file = project.getFile(new Path(name));
1496
				file.createLink(relativeTarget, 0, getMonitor());
1497
			}
1498
		} catch (CoreException e) {
1499
			fail("failure with createLink(" + relativeTarget + ")", e);
1500
		}
1501
	}
1471
}
1502
}
(-)src/org/eclipse/team/tests/ccvs/core/provider/LinkResourcesTest.java (-2 / +141 lines)
Lines 15-20 Link Here
15
import junit.framework.Test;
15
import junit.framework.Test;
16
import junit.framework.TestSuite;
16
import junit.framework.TestSuite;
17
17
18
import org.eclipse.core.resources.IFile;
18
import org.eclipse.core.resources.IFolder;
19
import org.eclipse.core.resources.IFolder;
19
import org.eclipse.core.resources.IProject;
20
import org.eclipse.core.resources.IProject;
20
import org.eclipse.core.resources.IResource;
21
import org.eclipse.core.resources.IResource;
Lines 22-28 Link Here
22
import org.eclipse.team.core.RepositoryProvider;
23
import org.eclipse.team.core.RepositoryProvider;
23
import org.eclipse.team.core.TeamException;
24
import org.eclipse.team.core.TeamException;
24
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
25
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
26
import org.eclipse.team.internal.ccvs.core.CVSTag;
25
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
27
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
28
import org.eclipse.team.internal.ccvs.core.ILogEntry;
26
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
29
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
27
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
30
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
28
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
31
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
Lines 71-80 Link Here
71
		IProject project = createProject("testLinkFailure", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" });
74
		IProject project = createProject("testLinkFailure", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" });
72
		IFolder folder = project.getFolder("link");
75
		IFolder folder = project.getFolder("link");
73
		folder.createLink(Platform.getLocation().append("temp"), IResource.ALLOW_MISSING_LOCAL, null);
76
		folder.createLink(Platform.getLocation().append("temp"), IResource.ALLOW_MISSING_LOCAL, null);
74
		assertIsIgnored(folder, true);
77
		assertIsNotIgnored(folder, true);
75
		folder = project.getFolder("folder1/folder2/");
78
		folder = project.getFolder("folder1/folder2/");
76
		folder.createLink(Platform.getLocation().append("temp"), IResource.ALLOW_MISSING_LOCAL, null);
79
		folder.createLink(Platform.getLocation().append("temp"), IResource.ALLOW_MISSING_LOCAL, null);
77
		assertIsIgnored(folder, true);
80
		assertIsNotIgnored(folder, true);
78
	}
81
	}
79
	
82
	
80
	public void testLinkCVSFolder() throws CoreException, TeamException, IOException {
83
	public void testLinkCVSFolder() throws CoreException, TeamException, IOException {
Lines 86-89 Link Here
86
		folder.createLink(source.getLocation(), 0, null);
89
		folder.createLink(source.getLocation(), 0, null);
87
		assertEquals(sourceCopy, source);
90
		assertEquals(sourceCopy, source);
88
	}
91
	}
92
    /**
93
     * Test a simple commit of a commit set with linked resource folder. The set being committed is not managed.
94
     * @throws CoreException
95
     * @throws IOException
96
     * @throws TeamException
97
     */
98
    public void testSimpleCommitLinkedResourceFolder() throws TeamException, CoreException, IOException {
99
        IProject projectA = createProject(getName() + "_A", new String[] { "folder1/", "folder1/added.txt", "folder1/changed.txt", 
100
        	"folder1/subfolder/", "folder1/subfolder/real_resource.txt",});
101
        IProject projectB = createProject(getName() + "_B", new String[] { "real_changed.txt", "real_deleted.txt"});
102
        
103
        IPath target = projectA.getLocation();
104
        projectA.close(getMonitor());
105
        
106
        createLink(projectB, "folder1/", target.append("folder1"));
107
        
108
        setContentsAndEnsureModified(projectB.getFile("real_changed.txt"));
109
        setContentsAndEnsureModified(projectB.getFile("folder1/changed.txt"));
110
        setContentsAndEnsureModified(projectB.getFile("folder1/subfolder/real_resource.txt"));
111
        addResources(projectB, new String[] { "folder1/added.txt" }, false /* don't commit */);
112
        
113
        commitProject(projectB);
114
        assertLocalStateEqualsRemote(projectB);
115
        
116
        projectA.open(getMonitor());
117
        projectA.refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
118
        assertLocalStateEqualsRemote(projectA);
119
    }
120
121
    /**
122
     * Test a simple commit of a commit set with linked resource file. The set being committed is not managed.
123
     * @throws CoreException
124
     * @throws IOException
125
     * @throws TeamException
126
     */
127
    public void testSimpleCommitLinkedResourceFile() throws TeamException, CoreException, IOException {
128
        IProject projectA = createProject(getName() + "_A", new String[] { "folder1/", "added.txt", "folder1/changed.txt"});
129
        IProject projectB = createProject(getName() + "_B", new String[] { "real_changed.txt", "real_deleted.txt", "folder2/"});
130
        
131
        IPath target = projectA.getLocation();
132
        projectA.close(getMonitor());
133
        
134
        createLink(projectB, "folder2/changed.txt", target.append("folder1/changed.txt"));
135
        createLink(projectB, "added.txt", target.append("added.txt"));
136
        
137
        setContentsAndEnsureModified(projectB.getFile("real_changed.txt"));
138
        setContentsAndEnsureModified(projectB.getFile("folder2/changed.txt"));
139
        addResources(projectB, new String[] { "added.txt" }, false /* don't commit */);
140
        
141
        commitProject(projectB);
142
        assertLocalStateEqualsRemote(projectB);
143
        
144
        projectA.open(getMonitor());
145
        projectA.refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
146
        assertLocalStateEqualsRemote(projectA);
147
    }
148
149
    public void testMakeBranchWithLinkedResources() throws TeamException, CoreException, IOException {
150
		// Create a test project
151
        IProject projectA = createProject(getName() + "_A", new String[] { "simple_link.txt", "folder1/", "folder1/added.txt", "folder1/changed.txt", 
152
        	"folder1/subfolder/", "folder1/subfolder/real_resource.txt",});
153
        IProject projectB = createProject(getName() + "_B", new String[] { "real_changed.txt", "real_deleted.txt"});
154
        
155
        IPath target = projectA.getLocation();
156
        projectA.close(getMonitor());
157
        
158
        createLink(projectB, "folder1/", target.append("folder1"));
159
        createLink(projectB, "folder1/subfolder/simple_link.txt", target.append("simple_link.txt"));
160
161
		// Make some local modifications including "cvs adds" and "cvs removes"
162
		addResources(projectB, new String[] {"folder1/added.txt"}, false);
163
		changeResources(projectB, new String[] {"folder1/changed.txt", "folder1/subfolder/simple_link.txt"}, false);
164
		
165
		// Make the branch including a pre-version
166
		CVSTag version = new CVSTag("v1", CVSTag.BRANCH);
167
		CVSTag branch = new CVSTag("branch1", CVSTag.BRANCH);
168
		makeBranch(new IResource[] {projectB}, version, branch, true);
169
170
		// Checkout a copy from the branch and version and compare
171
		IProject branchCopy = checkoutCopy(projectB, branch);
172
		IProject versionCopy = checkoutCopy(projectB, version);
173
		assertEquals(branchCopy, versionCopy, true, false);
174
		
175
		// Commit the project, update the branch and compare
176
		commitProject(projectB);
177
		updateProject(branchCopy, null, false);
178
		assertEquals(branchCopy, projectB, false, true);
179
	}
180
181
	public void testVersionTagWithLinkedResources() throws TeamException, CoreException, IOException {
182
		
183
		// Create a test project
184
        IProject projectA = createProject(getName() + "_A", new String[] { "simple_link.txt", "folder1/", "folder1/added.txt", "folder1/changed.txt", 
185
        	"folder1/subfolder/", "folder1/subfolder/real_resource.txt",});
186
        IProject projectB = createProject(getName() + "_B", new String[] { "real_changed.txt", "real_deleted.txt"});
187
        
188
        IPath target = projectA.getLocation();
189
        projectA.close(getMonitor());
190
        
191
        createLink(projectB, "folder1/", target.append("folder1"));
192
        createLink(projectB, "folder1/subfolder/simple_link.txt", target.append("simple_link.txt"));
193
		commitProject(projectB);
194
		
195
		// Perform some operations on the copy and commit
196
		IProject copy = checkoutCopy(projectB, "-copy");
197
		addResources(copy, new String[] { "folder1/added.txt" }, false);
198
		changeResources(copy, new String[] {"folder1/changed.txt", "folder1/subfolder/simple_link.txt"}, false);
199
		commitResources(copy, true);
200
		
201
		// Tag the original, checkout the tag and compare with original
202
		CVSTag v1Tag = new CVSTag("v1", CVSTag.VERSION);
203
		tagProject(projectB, v1Tag, false);
204
		
205
		projectA.open(getMonitor());
206
		projectA.refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
207
		assertFileContainsTag(projectA, "simple_link.txt", "v1");
208
		assertFileContainsTag(projectA, "folder1/added.txt", "v1");
209
		assertFileContainsTag(projectA, "folder1/changed.txt", "v1");
210
	}
211
212
	private void assertFileContainsTag(IProject projectA, String filePath,
213
			String version) throws TeamException {
214
		IFile file = projectA.getFile(Path.fromPortableString(filePath));
215
		ILogEntry[] entries = CVSWorkspaceRoot.getCVSFileFor(file).getLogEntries(getMonitor());
216
		assertTrue("tagged entry is not null", entries != null && (entries.length > 0));
217
		
218
		boolean found = false;
219
		for (int i = 0; i < entries.length; i++) {
220
			CVSTag[] tags = entries[0].getTags();
221
			for (int j = 0; j < tags.length; j++) {
222
				if (tags[j].getName().equals(version))
223
					found = true;
224
			}
225
		}
226
		assertTrue("file is tagged", found);
227
	}
89
}
228
}
(-)src/org/eclipse/team/tests/ccvs/ui/CommitSetTests.java (-2 / +7 lines)
Lines 16-29 Link Here
16
16
17
import junit.framework.Test;
17
import junit.framework.Test;
18
18
19
import org.eclipse.core.resources.*;
19
import org.eclipse.core.resources.IFile;
20
import org.eclipse.core.resources.IProject;
21
import org.eclipse.core.resources.IResource;
20
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.IPath;
23
import org.eclipse.core.runtime.IPath;
22
import org.eclipse.swt.widgets.Display;
24
import org.eclipse.swt.widgets.Display;
23
import org.eclipse.team.core.TeamException;
25
import org.eclipse.team.core.TeamException;
24
import org.eclipse.team.internal.ccvs.core.CVSException;
26
import org.eclipse.team.internal.ccvs.core.CVSException;
25
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
27
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
26
import org.eclipse.team.internal.core.subscribers.*;
28
import org.eclipse.team.internal.core.subscribers.ActiveChangeSet;
29
import org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager;
30
import org.eclipse.team.internal.core.subscribers.ChangeSet;
31
import org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener;
27
import org.eclipse.team.tests.ccvs.core.EclipseTest;
32
import org.eclipse.team.tests.ccvs.core.EclipseTest;
28
33
29
/**
34
/**

Return to bug 41929