blob: c24887c2526af2ed9c73a4621b81c340227ac10a (
plain) (
blame)
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
|
/*******************************************************************************
* Copyright (c) 2000, 2006 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
* Philippe Ombredanne - bug 84808
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.jface.action.IAction;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.operations.CheckoutMultipleProjectsOperation;
import org.eclipse.team.internal.ccvs.ui.operations.ProjectMetaFileOperation;
/**
* Checkout a remote module into the workspace ensuring that the user is prompted for
* any overwrites that may occur.
*/
public class CheckoutAction extends CVSAction {
@Override
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
new CheckoutMultipleProjectsOperation(getTargetPart(), getSelectedRemoteFoldersWithProjectName(), null)
.run();
}
@Override
public boolean isEnabled() {
ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
if (folders.length == 0) return false;
// only enabled when all folders are in the same repository
ICVSRepositoryLocation location = folders[0].getRepository();
for (int i = 1; i < folders.length; i++) {
ICVSRemoteFolder folder = folders[i];
if (!folder.getRepository().equals(location)) {
return false;
}
}
return true;
}
/**
* Get selected CVS remote folders, and add Project Description
* from metafile if available based on preferences settings
* @throws InterruptedException
* @throws InvocationTargetException
*/
private ICVSRemoteFolder[] getSelectedRemoteFoldersWithProjectName() throws InvocationTargetException, InterruptedException {
ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
if (CVSUIPlugin.getPlugin().isUseProjectNameOnCheckout()){
folders = ProjectMetaFileOperation.updateFoldersWithProjectName(getTargetPart(), folders);
}
return folders;
}
}
|