KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.team.internal.ccvs.core.*;
16 import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
17 import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
18
19 public class NewEntryHandler extends ResponseHandler {
20
21     /*
22      * @see ResponseHandler#getResponseID()
23      */

24     public String JavaDoc getResponseID() {
25         return "New-entry"; //$NON-NLS-1$
26
}
27
28     /*
29      * @see ResponseHandler#handle(Session, String, IProgressMonitor)
30      */

31     public void handle(Session session, String JavaDoc localDir, IProgressMonitor monitor)
32         throws CVSException {
33             
34         // read additional data for the response
35
String JavaDoc repositoryFile = session.readLine();
36         String JavaDoc entryLine = session.readLine();
37         
38         // Clear the recorded mod-time
39
session.setModTime(null);
40         
41         // Get the local file
42
String JavaDoc fileName = repositoryFile.substring(repositoryFile.lastIndexOf("/") + 1); //$NON-NLS-1$
43
ICVSFolder mParent = session.getLocalRoot().getFolder(localDir);
44         ICVSFile mFile = mParent.getFile(fileName);
45
46         ResourceSyncInfo fileInfo = mFile.getSyncInfo();
47         MutableResourceSyncInfo newInfo = fileInfo.cloneMutable();
48         newInfo.setEntryLine(entryLine);
49         // see bug 106876
50
if(newInfo.getTag() != null && newInfo.getTag().getName().equals(CVSTag.BASE.getName())) {
51             newInfo.setTag(fileInfo.getTag());
52         }
53         mFile.setSyncInfo(newInfo, ICVSFile.UNKNOWN);
54     }
55 }
56
Popular Tags