KickJava   Java API By Example, From Geeks To Geeks.

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


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.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.ICVSRemoteFolder;
18 import org.eclipse.ui.IWorkbenchPart;
19
20 /**
21  * This operation checks out a single remote folder into the workspace as
22  * a project.
23  */

24 public class CheckoutSingleProjectOperation extends CheckoutProjectOperation {
25
26     private boolean preconfigured;
27     private IProject targetProject;
28     private String JavaDoc workingSetName;
29     
30     public CheckoutSingleProjectOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IProject targetProject, String JavaDoc targetLocation, boolean preconfigured) {
31         this(part,remoteFolder,targetProject,targetLocation,preconfigured,null);
32     }
33     
34     public CheckoutSingleProjectOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IProject targetProject, String JavaDoc targetLocation, boolean preconfigured, String JavaDoc wsName) {
35         super(part, new ICVSRemoteFolder[] { remoteFolder }, targetLocation);
36         this.targetProject = targetProject;
37         this.preconfigured = preconfigured;
38         this.workingSetName = wsName;
39     }
40
41     private boolean isPreconfigured() {
42         return preconfigured;
43     }
44
45     /* (non-Javadoc)
46      * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#needsPromptForOverwrite(org.eclipse.core.resources.IProject)
47      */

48     public boolean needsPromptForOverwrite(IProject project) {
49         // No need to prompt if the project was preconfigured
50
if (isPreconfigured()) return false;
51         return super.needsPromptForOverwrite(project);
52     }
53
54     /* (non-Javadoc)
55      * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutProjectOperation#performScrubProjects()
56      */

57     protected boolean performScrubProjects() {
58         // Do not scrub the projects if they were preconfigured.
59
return !isPreconfigured();
60     }
61
62     /* (non-Javadoc)
63      * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
64      */

65     protected IStatus checkout(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
66         return checkout(folder, targetProject, monitor);
67     }
68     
69     protected String JavaDoc getWorkingSetName(){
70         return workingSetName;
71     }
72
73 }
74
Popular Tags