KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > actions > MoveRemoteTagAction


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.actions;
12
13 import org.eclipse.jface.window.Window;
14 import org.eclipse.team.internal.ccvs.core.*;
15 import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
16 import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
17 import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
18 import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
19
20 public class MoveRemoteTagAction extends TagInRepositoryAction {
21
22     /**
23      * @see TagRemoteAction#promptForTag(ICVSFolder[])
24      */

25     protected ITagOperation configureOperation() {
26         // Allow the user to select a tag
27
ITagOperation operation = createTagOperation();
28         TagSelectionDialog dialog = new TagSelectionDialog(getShell(), operation.getTagSource(),
29             CVSUIMessages.MoveTagAction_title,
30             CVSUIMessages.MoveTagAction_message,
31             TagSelectionDialog.INCLUDE_BRANCHES | TagSelectionDialog.INCLUDE_VERSIONS,
32             isFolderSelected(), /* show recurse */
33             IHelpContextIds.TAG_REMOTE_WITH_EXISTING_DIALOG);
34         dialog.setBlockOnOpen(true);
35         if (dialog.open() == Window.CANCEL) {
36             return null;
37         }
38         CVSTag tag = dialog.getResult();
39         if (tag == null) return null;
40         operation.setTag(tag);
41         operation.moveTag();
42         boolean recursive = dialog.getRecursive();
43         if (!recursive) {
44             operation.doNotRecurse();
45         }
46         return operation;
47     }
48
49     private boolean isFolderSelected() {
50         ICVSResource[] resources = getSelectedCVSResources();
51         for (int i = 0; i < resources.length; i++) {
52             ICVSResource resource = resources[i];
53             if (resource.isFolder())
54                 return true;
55         }
56         return false;
57     }
58 }
59
Popular Tags