1 11 package org.eclipse.team.internal.ccvs.core.filesystem; 12 import java.net.URI ; 13 import java.util.HashMap ; 14 15 import org.eclipse.core.filesystem.IFileStore; 16 import org.eclipse.core.filesystem.provider.FileSystem; 17 import org.eclipse.core.runtime.*; 18 import org.eclipse.team.internal.ccvs.core.CVSMessages; 19 import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; 20 import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder; 21 import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree; 22 23 public class CVSFileSystem extends FileSystem { 24 25 26 private CVSFileTree cvsTree; 27 28 public CVSFileSystem() { 29 super(); 30 } 31 32 public IFileStore getStore(URI uri) { 33 return new CVSFileStore(CVSURI.fromUri(uri), null); 34 } 35 36 public boolean canReturnFullTree(){ 37 return true; 38 } 39 40 public CVSFileTree getFullTree(URI uri, IProgressMonitor monitor){ 41 try{ 42 monitor.beginTask(CVSMessages.CVSFileSystem_FetchTree, 100); 43 if (cvsTree != null) 46 return cvsTree; 47 48 return this.refreshTree(uri, monitor); 49 } 50 finally{ 51 monitor.done(); 52 } 53 } 54 55 56 public CVSFileTree refreshTree(URI uri, IProgressMonitor monitor){ 57 CVSURI cvsURI = CVSURI.fromUri(uri); 58 59 ICVSRemoteFolder folder = cvsURI.getProjectURI().toFolder(); 61 62 try { 63 RemoteLogger logger = new RemoteLogger(folder); 64 65 RemoteFolderTree remoteTree = logger.fetchTree(new SubProgressMonitor(monitor,80)); 66 HashMap folderMap = logger.getFolderMap(); 67 HashMap logMap = logger.getLogMap(); 68 folderMap.put(folder.getName(), remoteTree); 69 cvsTree = new CVSFileTree(new CVSFileStore(cvsURI, null), cvsURI, remoteTree, folderMap, logMap); 71 72 return cvsTree; 73 } catch (CoreException e) { 74 CVSProviderPlugin.log(e); 75 return null; 76 } 77 78 79 } 80 } 81 | Popular Tags |