source: java/SVNAccess/src/net/oni2/svnaccess/UpdateEventHandler.java@ 803

Last change on this file since 803 was 732, checked in by alloc, 12 years ago

SVN access library

File size: 1.6 KB
RevLine 
[732]1package net.oni2.svnaccess;
2
3import java.util.Vector;
4
5import org.tmatesoft.svn.core.SVNCancelException;
6import org.tmatesoft.svn.core.wc.ISVNEventHandler;
7import org.tmatesoft.svn.core.wc.SVNEvent;
8import org.tmatesoft.svn.core.wc.SVNEventAction;
9
10
11/**
12 * Handler to return checkout/update status
13 *
14 * @author Christian Illy
15 */
16public class UpdateEventHandler implements ISVNEventHandler {
17
18 Vector<String> list;
19 int objects;
20 SVNUpdateListener listener;
21
22
23 /**
24 * Create a new UpdateEventHandler with a file name list
25 *
26 * @param infoList
27 * List containing the file names of all files which will be
28 * checked out / updated
29 * @param listener
30 * Listener to send status events to
31 */
32 public UpdateEventHandler(Vector<String> infoList,
33 SVNUpdateListener listener) {
34 this.list = infoList;
35 this.listener = listener;
36 if (list != null)
37 objects = list.size();
38 else
39 objects = -1;
40 }
41
42 public void handleEvent(SVNEvent event, double progress) {
43 SVNEventAction action = event.getAction();
44 if ((action == SVNEventAction.UPDATE_ADD)
45 || (action == SVNEventAction.UPDATE_UPDATE)) {
46 if (list != null) {
47 list.remove(event.getURL().getPath());
48 if (listener != null) {
49 listener.statusUpdate(objects - list.size(), objects);
50 } else {
51 System.out.println((objects - list.size()) + " of "
52 + objects + " done");
53 }
54 }
55 }
56 }
57
58 /*
59 * Should be implemented to check if the current operation is cancelled. If
60 * it is, this method should throw an SVNCancelException.
61 */
62 public void checkCancelled() throws SVNCancelException {
63 }
64}
Note: See TracBrowser for help on using the repository browser.