KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > operations > CheckoutMultipleProjectsOperation


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.ui.operations;
12
13 import org.eclipse.core.resources.IProject;
14 import org.eclipse.core.runtime.*;
15 import org.eclipse.team.internal.ccvs.core.CVSException;
16 import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
17 import org.eclipse.ui.IWorkbenchPart;
18
19 /**
20  * This operation checks out a multiple remote folders into the workspace.
21  * Each one will become a new project (overwritting any exsiting projects
22  * with the same name).
23  */

24 public class CheckoutMultipleProjectsOperation extends CheckoutProjectOperation {
25
26     boolean hasTargetLocation;
27     //The name of the working set to add all of the projects to
28
String JavaDoc workingSetName;
29     
30     public CheckoutMultipleProjectsOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, String JavaDoc targetLocation) {
31         this(part,remoteFolders,targetLocation,null);
32     }
33     
34     public CheckoutMultipleProjectsOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, String JavaDoc targetLocation, String JavaDoc wsName) {
35         super(part, remoteFolders, targetLocation);
36         hasTargetLocation = targetLocation != null;
37         setInvolvesMultipleResources(remoteFolders.length > 1);
38         this.workingSetName=wsName;
39     }
40     
41     /**
42      * Return the target location where the given project should be located or
43      * null if the default location should be used.
44      *
45      * @param project
46      */

47     protected IPath getTargetLocationFor(IProject project) {
48         IPath targetLocation = super.getTargetLocationFor(project);
49         if (targetLocation == null) return null;
50         return targetLocation.append(project.getName());
51     }
52
53     /* (non-Javadoc)
54      * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
55      */

56     protected IStatus checkout(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
57         return checkout(folder, null, monitor);
58     }
59     
60     protected String JavaDoc getWorkingSetName(){
61         return workingSetName;
62     }
63     
64 }
65
Popular Tags