KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Philippe Ombredanne - bug 84808
11  *******************************************************************************/

12 package org.eclipse.team.internal.ccvs.ui.actions;
13
14 import java.lang.reflect.InvocationTargetException JavaDoc;
15
16 import org.eclipse.jface.action.IAction;
17 import org.eclipse.jface.wizard.WizardDialog;
18 import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
19 import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
20 import org.eclipse.team.internal.ccvs.ui.operations.ProjectMetaFileOperation;
21 import org.eclipse.team.internal.ccvs.ui.wizards.CheckoutAsWizard;
22
23 public class CheckoutAsAction extends CVSAction {
24     
25     /* (non-Javadoc)
26      * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
27      */

28     public void execute(IAction action) throws InvocationTargetException JavaDoc, InterruptedException JavaDoc {
29         ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
30         boolean withName = CVSUIPlugin.getPlugin().isUseProjectNameOnCheckout();
31         ProjectMetaFileOperation op = new ProjectMetaFileOperation(getTargetPart(), folders, withName);
32         op.run();
33         
34         // project configuration allowed only if single folder without metafile
35
boolean allowProjectConfig = (folders.length == 1 && !op.metaFileExists());
36         
37         if (withName) {
38             folders = op.getUpdatedFolders();
39         }
40         
41         CheckoutAsWizard wizard = new CheckoutAsWizard(getTargetPart(), folders, allowProjectConfig);
42         WizardDialog dialog = new WizardDialog(getShell(), wizard);
43         dialog.open();
44     }
45     
46     /* (non-Javadoc)
47      * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
48      */

49     public boolean isEnabled() {
50         return getSelectedRemoteFolders().length > 0;
51     }
52 }
53
Popular Tags