1 19 20 package org.netbeans.modules.versioning.system.cvss.ui.actions.update; 21 22 import org.openide.util.NbBundle; 23 import org.openide.nodes.Node; 24 import org.netbeans.modules.versioning.system.cvss.CvsVersioningSystem; 25 import org.netbeans.modules.versioning.system.cvss.FileInformation; 26 import org.netbeans.modules.versioning.system.cvss.ExecutorGroup; 27 import org.netbeans.modules.versioning.system.cvss.util.Context; 28 import org.netbeans.modules.versioning.system.cvss.ui.actions.AbstractSystemAction; 29 import org.netbeans.modules.versioning.util.Utils; 30 import org.netbeans.lib.cvsclient.command.update.UpdateCommand; 31 import org.netbeans.lib.cvsclient.command.GlobalOptions; 32 33 import java.io.File ; 34 35 40 public class UpdateAction extends AbstractSystemAction { 41 42 protected String getBaseName(Node [] activatedNodes) { 43 return "CTL_MenuItem_Update"; } 45 46 protected int getFileEnabledStatus() { 47 return FileInformation.STATUS_IN_REPOSITORY; 48 } 49 50 protected int getDirectoryEnabledStatus() { 51 return FileInformation.STATUS_MANAGED & ~FileInformation.STATUS_NOTVERSIONED_EXCLUDED & ~FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY; 52 } 53 54 public void performCvsAction(Node[] nodes) { 55 56 ExecutorGroup group = new ExecutorGroup(getRunningName(nodes)); 57 group.progress(NbBundle.getMessage(UpdateAction.class, "BK1001")); 58 Context context = getContext(nodes); 59 GlobalOptions options = null; 60 if (context.getExclusions().size() > 0) { 61 options = CvsVersioningSystem.createGlobalOptions(); 62 options.setExclusions((File []) context.getExclusions().toArray(new File [context.getExclusions().size()])); 63 } 64 65 File [][] flatRecursive = Utils.splitFlatOthers(context.getRootFiles()); 66 67 if (flatRecursive[0].length > 0) { 68 UpdateCommand cmd = new UpdateCommand(); 69 cmd.setDisplayName(NbBundle.getMessage(UpdateAction.class, "BK0001")); 70 cmd.setBuildDirectories(false); 71 cmd.setPruneDirectories(false); 72 cmd.setRecursive(false); 73 cmd.setFiles(flatRecursive[0]); 74 group.addExecutors(UpdateExecutor.splitCommand(cmd, CvsVersioningSystem.getInstance(), options, getContextDisplayName(nodes))); 75 } 76 if (flatRecursive[1].length > 0) { 77 UpdateCommand cmd = new UpdateCommand(); 78 cmd.setDisplayName(NbBundle.getMessage(UpdateAction.class, "BK0001")); 79 cmd.setBuildDirectories(true); 80 cmd.setPruneDirectories(true); 81 cmd.setFiles(flatRecursive[1]); 82 group.addExecutors(UpdateExecutor.splitCommand(cmd, CvsVersioningSystem.getInstance(), options, getContextDisplayName(nodes))); 83 } 84 group.execute(); 85 } 86 87 protected boolean asynchronous() { 88 return false; 89 } 90 91 } 92 | Popular Tags |