blob: 923721ca27f2c026c4b5856cd3e813c12e925612 (
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
|
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.actions;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
public class MoveRemoteTagAction extends TagInRepositoryAction {
/**
* @see TagRemoteAction#promptForTag(ICVSFolder[])
*/
protected ITagOperation configureOperation() {
// Allow the user to select a tag
ITagOperation operation = createTagOperation();
TagSelectionDialog dialog = new TagSelectionDialog(getShell(), operation.getTagSource(),
Policy.bind("MoveTagAction.title"), //$NON-NLS-1$
Policy.bind("MoveTagAction.message"), //$NON-NLS-1$
TagSelectionDialog.INCLUDE_BRANCHES | TagSelectionDialog.INCLUDE_VERSIONS,
isFolderSelected(), /* show recurse */
IHelpContextIds.TAG_REMOTE_WITH_EXISTING_DIALOG);
dialog.setBlockOnOpen(true);
if (dialog.open() == Dialog.CANCEL) {
return null;
}
CVSTag tag = dialog.getResult();
if (tag == null) return null;
operation.setTag(tag);
operation.moveTag();
boolean recursive = dialog.getRecursive();
if (!recursive) {
operation.recurse();
}
return operation;
}
private boolean isFolderSelected() {
ICVSResource[] resources = getSelectedCVSResources();
for (int i = 0; i < resources.length; i++) {
ICVSResource resource = resources[i];
if (resource.isFolder())
return true;
}
return false;
}
}
|