|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.javacvs.commands; import org.openide.util.NbBundle; import java.io.*; import java.util.*; import org.netbeans.lib.cvsclient.event.*; import org.netbeans.lib.cvsclient.command.*; import org.netbeans.lib.cvsclient.command.watchers.*; import org.openide.filesystems.FileObject; import org.netbeans.modules.javacvs.*; import org.netbeans.modules.javacvs.commands.*; import org.netbeans.modules.javacvs.events.*; /** This class implements the cvs watchers command. * * @author mkleint */ public class CvsWatchers extends FileSystemCommand { /** * to be recursive is default behaviour of command. */ private boolean recursive = true; private FsWatchers watchersImpl; /** Creates cvs Watchers command. * @param filesToCheck Files/dirs that are used for the command. * * @deprecated Should be used as bean. * @param fs ClientProvider object that gives the command context. */ public CvsWatchers(File[] filesToCheck, ClientProvider fs) { super(fs); setFiles(filesToCheck); watchersImpl = new WatchersImpl(); } /** Creates cvs Watchers command. */ public CvsWatchers() { super(); watchersImpl = new WatchersImpl(); } public CvsCommand getImpl() { return watchersImpl; } public FsWatchers getWatchersImpl() { return watchersImpl; } public String getName() { return NbBundle.getBundle(CvsWatchers.class).getString("CvsWatchers.BeanName"); // NOI18N } protected Class getMainCvsCommand() { return WatchersCommand.class; } protected void initCommand(boolean commandIsRunning) { // here the the commands is initiated just right before running the command clearCommandList(); int dirNum = 0; WatchersCommand command; File[] files = new File[getFiles().length]; System.arraycopy(getFiles(),0,files,0, getFiles().length); for (int index = 0; index < files.length; index++) { if (files[index].isDirectory()) { // each directory Watchers command is sent separately.. //that way just one UI component is run after finish of the command command = new WatchersCommand(); // command.setDirectoryCheck(true); File[] fls = new File[1]; fls[0] = files[index]; command.setFiles(fls); setCommandArguments(command); toDoCommands.addElement(command); files[index] = null; dirNum = dirNum + 1; } } // now proceed all single files in one batch. if (dirNum == files.length) { super.initCommand(commandIsRunning); return; // no files to check Watchers on. } File[] singleFiles = new File[files.length - dirNum]; int singleIndex = 0; for (int ind = 0; ind < files.length; ind++) { if (files[ind] != null) { singleFiles[singleIndex] = files[ind]; singleIndex = singleIndex + 1; } } command = new WatchersCommand(); // command.setDirectoryCheck(false); command.setFiles(singleFiles); setCommandArguments(command); toDoCommands.addElement(command); // just add oen command to the queue super.initCommand(commandIsRunning); } protected void executeFailed(Exception exc) { stopCommand(); super.executeFailed(exc); } /** Setter for property recursive, equals the -l/-R switches in command-line cvs. * * @param recursive if true, equals -R |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.