KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > core > client > ModifiedFileSender


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ccvs.core.client;
12
13  
14 import java.util.HashSet JavaDoc;
15 import java.util.Set JavaDoc;
16
17 import org.eclipse.team.internal.ccvs.core.CVSException;
18 import org.eclipse.team.internal.ccvs.core.ICVSFile;
19 import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
20
21 /**
22  * Visit the CVS file structure, only sending files if they are modified.
23  */

24 class ModifiedFileSender extends FileStructureVisitor {
25
26     private final Set JavaDoc modifiedFiles;
27     
28     public ModifiedFileSender(Session session, LocalOption[] localOptions) {
29         super(session, localOptions, false, true);
30         modifiedFiles = new HashSet JavaDoc();
31     }
32     
33     /**
34      * Override sendFile to only send modified files
35      */

36     protected void sendFile(ICVSFile mFile) throws CVSException {
37         // Only send the file if its modified
38
if (mFile.isManaged() && mFile.isModified(null)) {
39             super.sendFile(mFile);
40             modifiedFiles.add(mFile);
41         }
42     }
43     
44     protected String JavaDoc getSendFileMessage() {
45         return null;
46     }
47     
48     /**
49      * Return all the files that have been send to the server
50      */

51     public ICVSFile[] getModifiedFiles() {
52         return (ICVSFile[]) modifiedFiles.toArray(new ICVSFile[modifiedFiles.size()]);
53     }
54 }
55
Popular Tags