1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.operations;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkingSet;
/**
* This operation checks out a single remote folder into the workspace as
* a project.
*/
public class CheckoutSingleProjectOperation extends CheckoutProjectOperation {
private boolean preconfigured;
private IProject targetProject;
private IWorkingSet[] workingSets;
public CheckoutSingleProjectOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IProject targetProject, String targetLocation, boolean preconfigured) {
this(part,remoteFolder,targetProject,targetLocation,preconfigured,null);
}
public CheckoutSingleProjectOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IProject targetProject, String targetLocation, boolean preconfigured, IWorkingSet[] workingSets) {
super(part, new ICVSRemoteFolder[] { remoteFolder }, targetLocation);
this.targetProject = targetProject;
this.preconfigured = preconfigured;
this.workingSets = workingSets;
}
private boolean isPreconfigured() {
return preconfigured;
}
@Override
public boolean needsPromptForOverwrite(IProject project) {
// No need to prompt if the project was preconfigured
if (isPreconfigured()) return false;
return super.needsPromptForOverwrite(project);
}
@Override
protected boolean performScrubProjects() {
// Do not scrub the projects if they were preconfigured.
return !isPreconfigured();
}
@Override
protected IStatus checkout(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
return checkout(folder, targetProject, monitor);
}
@Override
protected IWorkingSet[] getWorkingSets(){
return workingSets;
}
}
|