1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.team.internal.ccvs.core.filesystem;
import java.net.URI;
import java.util.HashMap;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.provider.FileSystem;
import org.eclipse.core.runtime.*;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree;
public class CVSFileSystem extends FileSystem {
private CVSFileTree cvsTree;
public CVSFileSystem() {
super();
}
public IFileStore getStore(URI uri) {
return new CVSFileStore(CVSURI.fromUri(uri), null);
}
public boolean canReturnFullTree(){
return true;
}
public CVSFileTree getFullTree(URI uri, IProgressMonitor monitor){
try{
monitor.beginTask(CVSMessages.CVSFileSystem_FetchTree, 100);
//always return new tree
//monitor.subTask(NLS.bind(message, binding));
if (cvsTree != null)
return cvsTree;
return this.refreshTree(uri, monitor);
}
finally{
monitor.done();
}
}
public CVSFileTree refreshTree(URI uri, IProgressMonitor monitor){
CVSURI cvsURI = CVSURI.fromUri(uri);
//Make sure that we're building the tree from the topmost level - keep cycling until you hit null
ICVSRemoteFolder folder = cvsURI.getProjectURI().toFolder();
try {
RemoteLogger logger = new RemoteLogger(folder);
RemoteFolderTree remoteTree = logger.fetchTree(SubMonitor.convert(monitor,80));
HashMap folderMap = logger.getFolderMap();
HashMap logMap = logger.getLogMap();
folderMap.put(folder.getName(), remoteTree);
//Save tree
cvsTree = new CVSFileTree(new CVSFileStore(cvsURI, null), cvsURI, remoteTree, folderMap, logMap);
return cvsTree;
} catch (CoreException e) {
CVSProviderPlugin.log(e);
return null;
}
}
}
|