KickJava   Java API By Example, From Geeks To Geeks.

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


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.core.runtime.IStatus;
16 import org.eclipse.team.internal.ccvs.core.CVSException;
17 import org.eclipse.team.internal.ccvs.core.ICVSResource;
18 import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
19 import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
20
21
22 public class Import extends Command {
23     protected Import() { }
24     protected String JavaDoc getRequestId() {
25         return "import"; //$NON-NLS-1$
26
}
27
28     protected ICVSResource[] computeWorkResources(Session session, LocalOption[] localOptions,
29         String JavaDoc[] arguments) throws CVSException {
30         if (arguments.length < 3) throw new IllegalArgumentException JavaDoc();
31         return new ICVSResource[0];
32     }
33     
34     protected IStatus doExecute(Session session, GlobalOption[] globalOptions,
35         LocalOption[] localOptions, String JavaDoc[] arguments, ICommandOutputListener listener,
36         IProgressMonitor monitor) throws CVSException {
37             
38         // If the branch option is not provided, a default value of 1.1.1 is used.
39
// This is done to maintain reference client compatibility
40
if (findOption(localOptions, "-b") == null) { //$NON-NLS-1$
41
LocalOption[] newLocalOptions = new LocalOption[localOptions.length + 1];
42             newLocalOptions[0] = new LocalOption("-b", "1.1.1"); //$NON-NLS-1$ //$NON-NLS-2$
43
System.arraycopy(localOptions, 0, newLocalOptions, 1, localOptions.length);
44             localOptions = newLocalOptions;
45         }
46         return super.doExecute(session, globalOptions, localOptions, arguments, listener, monitor);
47     }
48     
49     protected ICVSResource[] sendLocalResourceState(Session session, GlobalOption[] globalOptions,
50         LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor)
51         throws CVSException {
52     
53         ICVSResourceVisitor visitor = new ImportStructureVisitor(session,
54             collectOptionArguments(localOptions, "-W"), monitor); //$NON-NLS-1$
55
session.getLocalRoot().accept(visitor);
56         return resources;
57     }
58
59     protected void sendLocalWorkingDirectory(Session session) throws CVSException {
60         session.sendConstructedRootDirectory();
61     }
62
63 }
64
65
Popular Tags