public ICVSRemoteResource[] getFoldersForTag( ICVSRepositoryLocation location, CVSTag tag, IProgressMonitor monitor) throws CVSException { monitor = Policy.monitorFor(monitor); try { monitor.beginTask( NLS.bind( CVSUIMessages.RepositoryManager_fetchingRemoteFolders, new String[] {tag.getName()}), 100); if (tag.getType() == CVSTag.HEAD) { ICVSRemoteResource[] resources = location.members(tag, false, Policy.subMonitorFor(monitor, 60)); RepositoryRoot root = getRepositoryRootFor(location); ICVSRemoteResource[] modules = root.getDefinedModules(tag, Policy.subMonitorFor(monitor, 40)); ICVSRemoteResource[] result = new ICVSRemoteResource[resources.length + modules.length]; System.arraycopy(resources, 0, result, 0, resources.length); System.arraycopy(modules, 0, result, resources.length, modules.length); return result; } if (tag.getType() == CVSTag.DATE) { ICVSRemoteResource[] resources = location.members(tag, false, Policy.subMonitorFor(monitor, 60)); RepositoryRoot root = getRepositoryRootFor(location); ICVSRemoteResource[] modules = root.getDefinedModules(tag, Policy.subMonitorFor(monitor, 40)); ICVSRemoteResource[] result = new ICVSRemoteResource[resources.length + modules.length]; System.arraycopy(resources, 0, result, 0, resources.length); System.arraycopy(modules, 0, result, resources.length, modules.length); return result; } Set result = new HashSet(); // Get the tags for the location RepositoryRoot root = getRepositoryRootFor(location); String[] paths = root.getKnownRemotePaths(); for (int i = 0; i < paths.length; i++) { String path = paths[i]; List tags = Arrays.asList(root.getAllKnownTags(path)); if (tags.contains(tag)) { ICVSRemoteFolder remote = root.getRemoteFolder(path, tag, Policy.subMonitorFor(monitor, 100)); result.add(remote); } } return (ICVSRemoteResource[]) result.toArray(new ICVSRemoteResource[result.size()]); } finally { monitor.done(); } }
public RepositoryRoot getRepositoryRootFor(ICVSRepositoryLocation location) { RepositoryRoot root = (RepositoryRoot) repositoryRoots.get(location.getLocation(false)); if (root == null) { root = new RepositoryRoot(location); add(root); } return root; }
/* * @see IPropertySource#getPropertyValue(Object) */ public Object getPropertyValue(Object id) { if (id.equals(ICVSUIConstants.PROP_HOST)) { return location.getHost(); } if (id.equals(ICVSUIConstants.PROP_USER)) { return location.getUsername(); } if (id.equals(ICVSUIConstants.PROP_METHOD)) { return location.getMethod().getName(); } if (id.equals(ICVSUIConstants.PROP_ROOT)) { return location.getRootDirectory(); } if (id.equals(ICVSUIConstants.PROP_PORT)) { int port = location.getPort(); if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) { return CVSUIMessages.CVSRepositoryLocationPropertySource_default; } return "" + port; // $NON-NLS-1$ } return ""; //$NON-NLS-1$ }
/** Get the list of known version tags for a given project. */ public CVSTag[] getKnownTags(ICVSRepositoryLocation location, int tagType) { Set result = new HashSet(); RepositoryRoot root = (RepositoryRoot) repositoryRoots.get(location.getLocation(false)); if (root != null) { String[] paths = root.getKnownRemotePaths(); for (int i = 0; i < paths.length; i++) { String path = paths[i]; CVSTag[] tags = root.getAllKnownTags(path); for (int j = 0; j < tags.length; j++) { CVSTag tag = tags[j]; if (tag.getType() == tagType) result.add(tag); } } } return (CVSTag[]) result.toArray(new CVSTag[0]); }
/** * A repository root has been removed. Remove the tags defined for this root and notify any * listeners */ public void rootRemoved(ICVSRepositoryLocation root) { RepositoryRoot repoRoot = (RepositoryRoot) repositoryRoots.remove(root.getLocation(false)); if (repoRoot != null) broadcastRepositoryChange(repoRoot); }