|
Lines 13-22
Link Here
|
| 13 |
import java.util.ArrayList; |
13 |
import java.util.ArrayList; |
| 14 |
import java.util.Date; |
14 |
import java.util.Date; |
| 15 |
|
15 |
|
|
|
16 |
import org.eclipse.core.resources.IProject; |
| 16 |
import org.eclipse.core.resources.IResource; |
17 |
import org.eclipse.core.resources.IResource; |
| 17 |
import org.eclipse.core.runtime.IProgressMonitor; |
18 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 18 |
import org.eclipse.core.runtime.IStatus; |
19 |
import org.eclipse.core.runtime.IStatus; |
| 19 |
import org.eclipse.osgi.util.NLS; |
20 |
import org.eclipse.osgi.util.NLS; |
|
|
21 |
import org.eclipse.team.core.RepositoryProvider; |
| 20 |
import org.eclipse.team.core.TeamException; |
22 |
import org.eclipse.team.core.TeamException; |
| 21 |
import org.eclipse.team.internal.ccvs.core.*; |
23 |
import org.eclipse.team.internal.ccvs.core.*; |
| 22 |
import org.eclipse.team.internal.ccvs.core.client.*; |
24 |
import org.eclipse.team.internal.ccvs.core.client.*; |
|
Lines 24-30
Link Here
|
| 24 |
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener; |
26 |
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener; |
| 25 |
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation; |
27 |
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation; |
| 26 |
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException; |
28 |
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException; |
| 27 |
import org.eclipse.team.internal.ccvs.core.syncinfo.*; |
29 |
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; |
|
|
30 |
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; |
| 28 |
|
31 |
|
| 29 |
/** |
32 |
/** |
| 30 |
* This class can be used to fetch and cache file contents for remote files. |
33 |
* This class can be used to fetch and cache file contents for remote files. |
|
Lines 35-42
Link Here
|
| 35 |
private ICVSFolder remoteRoot; |
38 |
private ICVSFolder remoteRoot; |
| 36 |
private final CVSTag tag; |
39 |
private final CVSTag tag; |
| 37 |
private final int depth; |
40 |
private final int depth; |
|
|
41 |
private boolean fetchAbsentDirectories = true; |
| 38 |
|
42 |
|
| 39 |
public class SandboxUpdate extends Update { |
43 |
public class SandboxUpdate extends Update { |
|
|
44 |
|
| 45 |
/* (non-Javadoc) |
| 46 |
* @see org.eclipse.team.internal.ccvs.core.client.Update#shouldRetrieveAbsentDirectories(org.eclipse.team.internal.ccvs.core.client.Session) |
| 47 |
*/ |
| 48 |
protected boolean shouldRetrieveAbsentDirectories(Session session) { |
| 49 |
return fetchAbsentDirectories; |
| 50 |
} |
| 51 |
|
| 40 |
/* (non-Javadoc) |
52 |
/* (non-Javadoc) |
| 41 |
* @see org.eclipse.team.internal.ccvs.core.client.Command#commandFinished(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption[], org.eclipse.team.internal.ccvs.core.client.Command.LocalOption[], org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IStatus) |
53 |
* @see org.eclipse.team.internal.ccvs.core.client.Command#commandFinished(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption[], org.eclipse.team.internal.ccvs.core.client.Command.LocalOption[], org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IStatus) |
| 42 |
*/ |
54 |
*/ |
|
Lines 59-65
Link Here
|
| 59 |
|
71 |
|
| 60 |
/** |
72 |
/** |
| 61 |
* This class overrides the "Created" handler in order to configure the remote file |
73 |
* This class overrides the "Created" handler in order to configure the remote file |
| 62 |
* to recieve and cache the contents |
74 |
* to receive and cache the contents |
| 63 |
*/ |
75 |
*/ |
| 64 |
public class SandboxUpdatedHandler extends UpdatedHandler { |
76 |
public class SandboxUpdatedHandler extends UpdatedHandler { |
| 65 |
public SandboxUpdatedHandler(int type) { |
77 |
public SandboxUpdatedHandler(int type) { |
|
Lines 102-107
Link Here
|
| 102 |
try { |
114 |
try { |
| 103 |
RemoteFolder tree = buildBaseTree(repository, root, tag, Policy.subMonitorFor(monitor, 50)); |
115 |
RemoteFolder tree = buildBaseTree(repository, root, tag, Policy.subMonitorFor(monitor, 50)); |
| 104 |
UpdateContentCachingService service = new UpdateContentCachingService(repository, tree, tag, depth); |
116 |
UpdateContentCachingService service = new UpdateContentCachingService(repository, tree, tag, depth); |
|
|
117 |
service.setFetchAbsentDirectories(getFetchAbsentDirectories(root)); |
| 105 |
if (!service.cacheFileContents(Policy.subMonitorFor(monitor, 50))) |
118 |
if (!service.cacheFileContents(Policy.subMonitorFor(monitor, 50))) |
| 106 |
return null; |
119 |
return null; |
| 107 |
return tree; |
120 |
return tree; |
|
Lines 110-115
Link Here
|
| 110 |
} |
123 |
} |
| 111 |
} |
124 |
} |
| 112 |
|
125 |
|
|
|
126 |
private void setFetchAbsentDirectories(boolean fetchAbsentDirectories) { |
| 127 |
this.fetchAbsentDirectories = fetchAbsentDirectories; |
| 128 |
} |
| 129 |
|
| 130 |
private static boolean getFetchAbsentDirectories(ICVSFolder root) { |
| 131 |
IResource resource = root.getIResource(); |
| 132 |
if (resource != null) { |
| 133 |
IProject project = resource.getProject(); |
| 134 |
RepositoryProvider provider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()); |
| 135 |
if (provider instanceof CVSTeamProvider) { |
| 136 |
CVSTeamProvider cp = (CVSTeamProvider) provider; |
| 137 |
try { |
| 138 |
return cp.getFetchAbsentDirectories(); |
| 139 |
} catch (CVSException e) { |
| 140 |
CVSProviderPlugin.log(e); |
| 141 |
} |
| 142 |
} |
| 143 |
} |
| 144 |
return CVSProviderPlugin.getPlugin().getFetchAbsentDirectories(); |
| 145 |
} |
| 146 |
|
| 113 |
private static RemoteFolder buildBaseTree(final CVSRepositoryLocation repository, ICVSFolder root, CVSTag tag, IProgressMonitor progress) throws CVSException { |
147 |
private static RemoteFolder buildBaseTree(final CVSRepositoryLocation repository, ICVSFolder root, CVSTag tag, IProgressMonitor progress) throws CVSException { |
| 114 |
try { |
148 |
try { |
| 115 |
RemoteFolderTreeBuilder builder = new RemoteFolderTreeBuilder(repository, root, tag) { |
149 |
RemoteFolderTreeBuilder builder = new RemoteFolderTreeBuilder(repository, root, tag) { |
|
Lines 228-233
Link Here
|
| 228 |
if (depth != IResource.DEPTH_INFINITE ) |
262 |
if (depth != IResource.DEPTH_INFINITE ) |
| 229 |
options.add(Command.DO_NOT_RECURSE); |
263 |
options.add(Command.DO_NOT_RECURSE); |
| 230 |
|
264 |
|
|
|
265 |
if (fetchAbsentDirectories) |
| 266 |
options.add(Update.RETRIEVE_ABSENT_DIRECTORIES); |
| 267 |
|
| 231 |
if (!options.isEmpty()) |
268 |
if (!options.isEmpty()) |
| 232 |
return (LocalOption[]) options.toArray(new LocalOption[options.size()]); |
269 |
return (LocalOption[]) options.toArray(new LocalOption[options.size()]); |
| 233 |
|
270 |
|