KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.eclipse.core.runtime.Assert;
15 import org.eclipse.team.internal.ccvs.core.*;
16 import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
17
18 /**
19  * This visitor is used by the Add command to ensure that the parent
20  * folder is sent along with the added resource.
21  */

22 class AddStructureVisitor extends AbstractStructureVisitor {
23     
24     public AddStructureVisitor(Session session, LocalOption[] localOptions) {
25         super(session, localOptions, false, true);
26     }
27
28     /**
29      * @see ICVSResourceVisitor#visitFile(IManagedFile)
30      */

31     public void visitFile(ICVSFile mFile) throws CVSException {
32         
33         // Send the parent folder
34
sendFolder(mFile.getParent());
35         
36         // Sends the Is-modified request if it is supported, otherwise
37
// the file contents are sent as binary. The server does not
38
// need the contents at this stage so this should not be a problem.
39
session.sendIsModified(mFile, true, monitor);
40         
41     }
42
43     /**
44      * @see ICVSResourceVisitor#visitFolder(ICVSFolder)
45      */

46     public void visitFolder(ICVSFolder mFolder) throws CVSException {
47         
48         Assert.isNotNull(mFolder);
49         
50         // Send the parent folder
51
sendFolder(mFolder.getParent());
52         
53         // Send the directory
54
String JavaDoc localPath = mFolder.getRelativePath(session.getLocalRoot());
55         String JavaDoc remotePath = mFolder.getRemoteLocation(session.getLocalRoot());
56         session.sendDirectory(localPath, remotePath);
57         
58         // Record that we sent this folder
59
recordLastSent(mFolder);
60     }
61
62 }
63
64
Popular Tags