Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2006 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.ui.operations;
 
 import java.util.List;
Fetch the members of a remote folder in the background, passing incremental results through an IElementCollector.
 
 public class FetchMembersOperation extends RemoteOperation {
 
 	/* internal uzse only */ IElementCollector collector;
 	/* internal uzse only */ RemoteFolderFilter filter = new RemoteFolderFilter();
 	
 	public static class RemoteFolderFilter {
 		public ICVSRemoteResource[] filter(ICVSRemoteResource[] resource) {
 			return resource;
 		}
 	}
 	
 		long sendIncrement = 100;
 		List unsent = new ArrayList();
 		long intervalStart;
 		protected InternalRemoteFolderMemberFetcher(RemoteFolder parentFolderCVSTag tag) {
 			super(parentFoldertag);
 		}
 		protected void parentDoesNotExist() {
 			// Indicate that there are no children
 		}
 		protected RemoteFolder recordFolder(String name) {
 			RemoteFolder folder = super.recordFolder(name);
 			.add(folder);
 			if (isTimeToSend()) {
 			}
 			return folder;
 		}
 		private boolean isTimeToSend() {
 			long currentTime = System.currentTimeMillis();
 			return ((currentTime - ) >  ) || .size() > ;
 		}
 		protected IStatus performUpdate(IProgressMonitor progressCVSTag tagthrows CVSException {
 			IStatus status = super.performUpdate(progresstag);
 			return status;
 		}
 		protected void updateFileRevisions(ICVSFile[] filesIProgressMonitor monitorthrows CVSException {
 			super.updateFileRevisions(filesmonitor);
 		}
 		private void sendFolders() {
 		}
 		private void sendFiles() {
 		}
 			return null;
 		}
 	}
 
 	public FetchMembersOperation(IWorkbenchPart partICVSRemoteFolder folderIElementCollector collector) {
 		super(partnew ICVSRemoteResource[] { folder });
 		this. = collector;
 	}
 
 	/* (non-Javadoc)
 	 * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
 	 */
	protected void execute(IProgressMonitor monitorthrows CVSExceptionInterruptedException {
		if (remote.getClass().equals(RemoteFolder.class)) {
			monitor = Policy.monitorFor(monitor);
			monitor.beginTask(null, 100 + (isRoot ? 30 : 0));
			fetcher.fetchMembers(Policy.subMonitorFor(monitor, 100));
			if (isRoot) {
				ICVSRemoteResource[] modules = CVSUIPlugin.getPlugin()
					.getDefinedModules(remote.getTag(), Policy.subMonitorFor(monitor, 25));
				.add(.filter(modules), Policy.subMonitorFor(monitor, 5));
			}
else {
			monitor = Policy.monitorFor(monitor);
			try {
				monitor.beginTask(null, 100);
				ICVSRemoteResource[] children = remote.members(Policy.subMonitorFor(monitor, 95));
				.add(children, Policy.subMonitorFor(monitor, 5));
catch (TeamException e) {
				throw CVSException.wrapException(e);
finally {
				monitor.done();
			}
		}
	}
	/* (non-Javadoc)
	 * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
	 */
	protected String getTaskName() {
	}
	}
	public void setFilter(RemoteFolderFilter filter) {
		this. = filter;
	}
New to GrepCode? Check out our FAQ X