1 12 package org.eclipse.team.internal.ccvs.ui.actions; 13 14 import java.lang.reflect.InvocationTargetException ; 15 16 import org.eclipse.jface.action.IAction; 17 import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder; 18 import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; 19 import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; 20 import org.eclipse.team.internal.ccvs.ui.operations.CheckoutMultipleProjectsOperation; 21 import org.eclipse.team.internal.ccvs.ui.operations.ProjectMetaFileOperation; 22 23 27 public class CheckoutAction extends CVSAction { 28 29 32 protected void execute(IAction action) throws InvocationTargetException , InterruptedException { 33 new CheckoutMultipleProjectsOperation(getTargetPart(), getSelectedRemoteFoldersWithProjectName(), null) 34 .run(); 35 } 36 37 40 public boolean isEnabled() { 41 ICVSRemoteFolder[] folders = getSelectedRemoteFolders(); 42 if (folders.length == 0) return false; 43 ICVSRepositoryLocation location = folders[0].getRepository(); 45 for (int i = 1; i < folders.length; i++) { 46 ICVSRemoteFolder folder = folders[i]; 47 if (!folder.getRepository().equals(location)) { 48 return false; 49 } 50 } 51 return true; 52 } 53 54 60 private ICVSRemoteFolder[] getSelectedRemoteFoldersWithProjectName() throws InvocationTargetException , InterruptedException { 61 ICVSRemoteFolder[] folders = getSelectedRemoteFolders(); 62 if (CVSUIPlugin.getPlugin().isUseProjectNameOnCheckout()){ 63 folders = ProjectMetaFileOperation.updateFoldersWithProjectName(getTargetPart(), folders); 64 } 65 return folders; 66 } 67 } 68 | Popular Tags |