KickJava   Java API By Example, From Geeks To Geeks.

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


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.core.runtime.IStatus;
16 import org.eclipse.osgi.util.NLS;
17 import org.eclipse.team.internal.ccvs.core.*;
18
19 /**
20  * Handles a "Remove-entry" 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  * Remove-entry ??? \n
27  * [...]
28  * </pre>
29  * Then
30  * </p>
31  */

32
33 /**
34  * It removes the file from both the entries of the parent-folder.
35  * This happen, when the folder has allready been removed locally
36  * what happens on a checkin that includes a removed file.
37  */

38 class RemoveEntryHandler extends ResponseHandler {
39     public String JavaDoc getResponseID() {
40         return "Remove-entry"; //$NON-NLS-1$
41
}
42
43     public void handle(Session session, String JavaDoc localDir,
44         IProgressMonitor monitor) throws CVSException {
45         // read additional data for the response
46
String JavaDoc repositoryFile = session.readLine();
47
48         // Get the local file
49
String JavaDoc fileName = repositoryFile.substring(repositoryFile.lastIndexOf("/") + 1); //$NON-NLS-1$
50
ICVSFolder mParent = session.getLocalRoot().getFolder(localDir);
51         ICVSFile mFile = mParent.getFile(fileName);
52         if (mFile.exists()) {
53             IStatus status = new CVSStatus(IStatus.ERROR,CVSStatus.ERROR, NLS.bind(CVSMessages.RemoveEntryHandler_2, new String JavaDoc[] { mFile.getRepositoryRelativePath() }),session.getLocalRoot());
54             CVSProviderPlugin.log(status);
55         } else {
56             mFile.unmanage(null);
57         }
58     }
59 }
60
61
Popular Tags