KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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 org.eclipse.core.runtime.IProgressMonitor;
15 import org.eclipse.osgi.util.NLS;
16 import org.eclipse.team.internal.ccvs.core.*;
17 import org.eclipse.team.internal.ccvs.core.util.Util;
18
19 /**
20  * Handles a "Checked-in" response from the CVS server.
21  * <p>
22  * Suppose as a result of performing a command the CVS server responds
23  * as follows:<br>
24  * <pre>
25  * [...]
26  * Checked-in ??? \n
27  * [...]
28  * </pre>
29  * Then
30  * </p>
31  */

32 class CheckedInHandler extends ResponseHandler {
33     public String JavaDoc getResponseID() {
34         return "Checked-in"; //$NON-NLS-1$
35
}
36
37     public void handle(Session session, String JavaDoc localDir, IProgressMonitor monitor) throws CVSException {
38         // read additional data for the response
39
String JavaDoc repositoryFile = session.readLine();
40         String JavaDoc entryLine = session.readLine();
41         
42         // clear file update modifiers
43
session.setModTime(null);
44         
45         // Get the local file
46
String JavaDoc fileName = repositoryFile.substring(repositoryFile.lastIndexOf("/") + 1); //$NON-NLS-1$
47
ICVSFolder mParent = session.getLocalRoot().getFolder(localDir);
48         ICVSFile mFile = mParent.getFile(fileName);
49         
50         // Marked the local file as checked-in
51
monitor.subTask(NLS.bind(CVSMessages.CheckInHandler_checkedIn, new String JavaDoc[] { Util.toTruncatedPath((ICVSResource)mFile, session.getLocalRoot(), 3) }));
52         mFile.checkedIn(entryLine, session.getCurrentCommand() instanceof Commit);
53     }
54 }
55
56
Popular Tags