KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.lang.reflect.InvocationTargetException JavaDoc;
14
15 import org.eclipse.jface.window.Window;
16 import org.eclipse.swt.widgets.Display;
17 import org.eclipse.team.internal.ccvs.ui.*;
18 import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
19 import org.eclipse.team.internal.ccvs.ui.operations.TagOperation;
20
21 /**
22  * Action that tags the local workspace with a version tag.
23  */

24 public class TagLocalAction extends TagAction {
25     
26     /* (non-Javadoc)
27      * @see org.eclipse.team.internal.ccvs.ui.actions.TagAction#performPrompting(org.eclipse.team.internal.ccvs.ui.operations.ITagOperation)
28      */

29     protected boolean performPrompting(ITagOperation operation) {
30         if (operation instanceof TagOperation) {
31             final TagOperation tagOperation = (TagOperation) operation;
32             try {
33                 if (hasOutgoingChanges(tagOperation)) {
34                     final boolean[] keepGoing = new boolean[] { true };
35                     Display.getDefault().syncExec(new Runnable JavaDoc() {
36                         public void run() {
37                             OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), tagOperation.getScopeManager(),
38                                     CVSUIMessages.TagLocalAction_2,
39                                     CVSUIMessages.TagLocalAction_0,
40                                     CVSUIMessages.TagLocalAction_1);
41                             dialog.setHelpContextId(IHelpContextIds.TAG_OUTGOING_CHANGES_DIALOG);
42                             int result = dialog.open();
43                             keepGoing[0] = result == Window.OK;
44                         }
45                     });
46                     return keepGoing[0];
47                 }
48                 return true;
49             } catch (InterruptedException JavaDoc e) {
50                 // Ignore
51
} catch (InvocationTargetException JavaDoc e) {
52                 handle(e);
53             }
54         }
55         return false;
56     }
57
58     /* (non-Javadoc)
59      * @see org.eclipse.team.internal.ccvs.ui.actions.TagAction#createTagOperation()
60      */

61     protected ITagOperation createTagOperation() {
62         return new TagOperation(getTargetPart(), getCVSResourceMappings());
63     }
64     
65         /* (non-Javadoc)
66      * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
67      */

68     public String JavaDoc getId() {
69         return ICVSUIConstants.CMD_TAGASVERSION;
70     }
71 }
72
Popular Tags