alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

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 java.beans.*;
import org.openide.filesystems.FileObject;
import org.netbeans.modules.javacvs.customizers.ImportParamInput;

import org.netbeans.modules.javacvs.*;
import org.netbeans.modules.javacvs.events.*;
import org.netbeans.modules.javacvs.commands.*;
import org.netbeans.lib.cvsclient.event.*;
import org.netbeans.lib.cvsclient.commandLine.GetOpt;
import org.netbeans.lib.cvsclient.command.history.*;
import org.netbeans.lib.cvsclient.command.DefaultFileInfoContainer;
import org.netbeans.lib.cvsclient.command.checkout.*;
import org.netbeans.lib.cvsclient.command.*;
import org.netbeans.modules.javacvs.caching.*;


/** this class implements the cvs history command.
 * @author mkleint
 */
public class CvsHistory extends FileSystemCommand {
    
    HistoryCommand command;
    /** Holds value of property forAllUsers. */
    private boolean forAllUsers;
    
    /** Holds value of property goBackToRecord. */
    private String showBackToRecordContaining;
    
    /** Holds value of property reportCommits. */
    private boolean reportCommits;
    
    /** Holds value of property sinceDate. */
    private String sinceDate;
    
    /** Holds value of property reportEverything. */
    private boolean reportEverything;
    
    /** Holds value of property lastEventOfProject. */
    private boolean lastEventOfProject;
    
    /** Holds value of property reportCheckout. */
    private boolean reportCheckouts;
    
    /** Holds value of property sinceRevision. */
    private String sinceRevision;
    
    /** Holds value of property reportTags. */
    private boolean reportTags;
    
    /** Holds value of property sinceTag. */
    private String sinceTag;
    
    /** Holds value of property forWorkingDirectory. */
    private boolean forWorkingDirectory;
    
    /** Holds value of property reportEventType. */
    private String reportEventType;
    
    /** Holds value of property timeZone. */
    private String timeZone;
    
    /** Holds value of property lastEventForFile. */
    private String[] lastEventForFile;
    
    /** Holds value of property reportOnModule. */
    private String[] reportOnModule;
    
    /** Holds value of property reportLastEventForModule. */
    private String[] reportLastEventForModule;
    
    /** Holds value of property forUsers. */
    private String[] forUsers;
    
    private HistoryImpl historyImpl;
    
    /** Creates new CvsHistory instance.
     */
    public CvsHistory() {
        super();
        historyImpl = new HistoryImpl();
    }
    
    /** Creates new CvsHistory instance.
     */
    public CvsHistory(ClientProvider fs) {
        super(fs);
        historyImpl = new HistoryImpl();
    }
    
    public CvsCommand getImpl() {
        return historyImpl;
    }
    
    public FsHistory getHistoryImpl() {
        return historyImpl;
    }
    
    public String getName() {
        return NbBundle.getBundle(CvsHistory.class).getString("CvsHistory.name"); // NOI18N
    }
    
    protected Class getMainCvsCommand() {
        return HistoryCommand.class;
    }
    
    /** if no param input was set before staring the command,
     * the default defined in this method is used
     */
    
    protected void initCommand(boolean commandIsRunning) {
        // here the the commands is initiated just right before running the command
        clearCommandList();
        command = new HistoryCommand();
        setCommandArguments(command);
        toDoCommands.addElement(command);
        super.initCommand(commandIsRunning);
    }
    
    
    protected void finishedCommand() {
        // called when the communication with server ends and the command thread is about to end..
        // used for calling visualizer stuff..
        super.finishedCommand();
    }
    
    protected void executeFailed(Exception exc) {
        // do refresh.. refresh or recursive refresh, depending on getRecursive()
        // TODO needs some optimizing..
        super.executeFailed(exc);
    }
    
    
    /**
     * Called when file status information has been received
     */
    public void fileInfoGenerated(FileInfoEvent e) {
        super.fileInfoGenerated(e);
    }
    
    
    /** Returns the command's cvs switches in the follwoing format: [command's name] [switches].
     * 
Can be used for writing the Command to .cvsrc file where the default switches are stored. * Subclasses can override this to handle special cases like comit -m "multi-line-message" * * @return String consisting of command's name and arguments. */ public String getCvsrcEntry() { Command comm = loadCommand(getMainCvsCommand()); boolean ok = setCommandArguments(comm); if (ok) { return "history " + comm.getCVSArguments(); // NOI18N } return ""; // NOI18N } /** Getter for property forAllUsers. (cvs switch -a) * @return Value of property forAllUsers. */ public boolean isForAllUsers() { return this.forAllUsers; } /** Setter for property forAllUsers. (cvs switch -a) * @param forAllUsers New value of property forAllUsers. */ public void setForAllUsers(boolean forAllUsers) { this.forAllUsers = forAllUsers; } /** Getter for property goBackToRecord. (cvs switch -b) * @return Value of property goBackToRecord. */ public String getShowBackToRecordContaining() { return this.showBackToRecordContaining; } /** Setter for property goBackToRecord. (cvs switch -b) * @param goBackToRecord New value of property goBackToRecord. */ public void setShowBackToRecordContaining(String goBackToRecord) { this.showBackToRecordContaining = goBackToRecord; } /** Getter for property reportCommits. (cvs switch -c) * @return Value of property reportCommits. */ public boolean isReportCommits() { return this.reportCommits; } /** Setter for property reportCommits. (cvs switch -b) * @param reportCommits New value of property reportCommits. */ public void setReportCommits(boolean reportCommits) { this.reportCommits = reportCommits; } /** Getter for property sinceDate. (cvs switch -D) * @return Value of property sinceDate. */ public String getSinceDate() { return this.sinceDate; } /** Setter for property sinceDate. (cvs switch -D) * @param sinceDate New value of property sinceDate. */ public void setSinceDate(String sinceDate) { this.sinceDate = sinceDate; } /** Getter for property reportEverything. (cvs switch -e) * @return Value of property reportEverything. */ public boolean isReportEverything() { return this.reportEverything; } /** Setter for property reportEverything. (cvs switch -e) * @param reportEverything New value of property reportEverything. */ public void setReportEverything(boolean reportEverything) { this.reportEverything = reportEverything; } /** Getter for property lastEventOfProject. (cvs switch -l) * @return Value of property lastEventOfProject. */ public boolean isLastEventOfProject() { return this.lastEventOfProject; } /** Setter for property lastEventOfProject. (cvs switch -l) * @param lastEventOfProject New value of property lastEventOfProject. */ public void setLastEventOfProject(boolean lastEventOfProject) { this.lastEventOfProject = lastEventOfProject; } /** Getter for property reportCheckout. (cvs switch -o) * @return Value of property reportCheckout. */ public boolean isReportCheckouts() { return this.reportCheckouts; } /** Setter for property reportCheckout. (cvs switch -o) * @param reportCheckout New value of property reportCheckout. */ public void setReportCheckouts(boolean reportCheckout) { this.reportCheckouts = reportCheckout; } /** Getter for property sinceRevision. (cvs switch -r) * @return Value of property sinceRevision. */ public String getSinceRevision() { return this.sinceRevision; } /** Setter for property sinceRevision. (cvs switch -r) * @param sinceRevision New value of property sinceRevision. */ public void setSinceRevision(String sinceRevision) { this.sinceRevision = sinceRevision; } /** Getter for property reportTags. (cvs switch -T) * @return Value of property reportTags. */ public boolean isReportTags() { return this.reportTags; } /** Setter for property reportTags. (cvs switch -T) * @param reportTags New value of property reportTags. */ public void setReportTags(boolean reportTags) { this.reportTags = reportTags; } /** Getter for property sinceTag. (cvs switch -t) * @return Value of property sinceTag. */ public String getSinceTag() { return this.sinceTag; } /** Setter for property sinceTag. (cvs switch -t) * @param sinceTag New value of property sinceTag. */ public void setSinceTag(String sinceTag) { this.sinceTag = sinceTag; } /** Getter for property forWorkingDirectory. (cvs switch -w) * @return Value of property forWorkingDirectory. */ public boolean isForWorkingDirectory() { return this.forWorkingDirectory; } /** Setter for property forWorkingDirectory. (cvs switch -w) * @param forWorkingDirectory New value of property forWorkingDirectory. */ public void setForWorkingDirectory(boolean forWorkingDirectory) { this.forWorkingDirectory = forWorkingDirectory; } /** Getter for property reportEventType. (cvs switch -x) * @return Value of property reportEventType. */ public String getReportEventType() { return this.reportEventType; } /** Setter for property reportEventType. (cvs switch -x) * @param reportEventType New value of property reportEventType. */ public void setReportEventType(String reportEventType) { this.reportEventType = reportEventType; } /** Getter for property timeZone. (cvs switch -z) * @return Value of property timeZone. */ public String getTimeZone() { return this.timeZone; } /** Setter for property timeZone. (cvs switch -z) * @param timeZone New value of property timeZone. */ public void setTimeZone(String timeZone) { this.timeZone = timeZone; } /** Getter for property lastEventForFile. (cvs switch -f) * @return Value of property lastEventForFile. */ public String[] getLastEventForFile() { return this.lastEventForFile; } /** Setter for property lastEventForFile. (cvs switch -f) * @param lastEventForFile New value of property lastEventForFile. */ public void setLastEventForFile(String[] lastEventForFile) { this.lastEventForFile = lastEventForFile; } /** Getter for property reportOnModule. (cvs switch -m) * @return Value of property reportOnModule. */ public String[] getReportOnModule() { return this.reportOnModule; } /** Setter for property reportOnModule. (cvs switch -m) * @param reportOnModule New value of property reportOnModule. */ public void setReportOnModule(String[] reportOnModule) { this.reportOnModule = reportOnModule; } /** Getter for property reportLastEventForModule. (cvs switch -n) * @return Value of property reportLastEventForModule. */ public String[] getReportLastEventForModule() { return this.reportLastEventForModule; } /** Setter for property reportLastEventForModule. (cvs switch -n) * @param reportLastEventForModule New value of property reportLastEventForModule. */ public void setReportLastEventForModule(String[] reportLastEventForModule) { this.reportLastEventForModule = reportLastEventForModule; } /** Getter for property forUsers. (cvs switch -u) * @return Value of property forUsers. */ public String[] getForUsers() { return this.forUsers; } /** Setter for property forUsers. (cvs switch -u) * @param forUsers New value of property forUsers. */ public void setForUsers(String[] forUsers) { this.forUsers = forUsers; } public class HistoryImpl extends FsHistory implements FileSystemCommandImpl { public HistoryImpl() { } public FileSystemCommand getOuterClassInstance() { return CvsHistory.this; } /** Add a CommandDisplayerListener to the FilesystemCommand. *
All UI communication and display of output should be handled via the CommandDisplayerListeners. * * @param listener The listener to add. * */ public void addDisplayerListener(CommandDisplayerListener listener) { CvsHistory.this.addDisplayerListener(listener); } /** Clones the instance of the command. * @return Returns the cloned object. * @throws CloneNotSupportedException if clone is not supported by subclasses, it throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { Object retValue; retValue = CvsHistory.super.clone(); return retValue; } /** Starts the thread with the command - executes the run() method. */ public void startCommand() { CvsHistory.this.startCommand(); } /** Removes a CommandDisplayerListener from the FilesystemCommand. * All the listeners are removed once the command ends. * * @param listener the listener to remove */ public void removeDisplayerListener(CommandDisplayerListener listener) { CvsHistory.this.removeDisplayerListener(listener); } public void setFileObjects(FileObject[] fileObjects) { CvsHistory.this.setFileObjects(fileObjects); } /** Add a CommandErrorListener to the CvsCommand. * * @param commErrListener The listener to add. * */ public void addCommandErrorListener(org.netbeans.modules.javacvs.events.CommandErrorListener commErrListener) { CvsHistory.this.addCommandErrorListener(commErrListener); } /** Remove a CommandErrorListener to the CvsCommand. * * @param commErrListener The listener to remove. * */ public void removeCommandErrorListener(org.netbeans.modules.javacvs.events.CommandErrorListener commErrListener) { CvsHistory.this.removeCommandErrorListener(commErrListener); } /** Getter for property forAllUsers. (cvs switch -a) * @return Value of property forAllUsers. */ public boolean isForAllUsers() { return CvsHistory.this.isForAllUsers(); } /** Setter for property forAllUsers. (cvs switch -a) * @param forAllUsers New value of property forAllUsers. */ public void setForAllUsers(boolean forAllUsers) { CvsHistory.this.setForAllUsers(forAllUsers); } /** Getter for property goBackToRecord. (cvs switch -b) * @return Value of property goBackToRecord. */ public String getShowBackToRecordContaining() { return CvsHistory.this.getShowBackToRecordContaining(); } /** Setter for property goBackToRecord. (cvs switch -b) * @param goBackToRecord New value of property goBackToRecord. */ public void setShowBackToRecordContaining(String goBackToRecord) { CvsHistory.this.setShowBackToRecordContaining(goBackToRecord); } /** Getter for property reportCommits. (cvs switch -c) * @return Value of property reportCommits. */ public boolean isReportCommits() { return CvsHistory.this.isReportCommits(); } /** Setter for property reportCommits. (cvs switch -b) * @param reportCommits New value of property reportCommits. */ public void setReportCommits(boolean reportCommits) { CvsHistory.this.setReportCommits(reportCommits); } /** Getter for property sinceDate. (cvs switch -D) * @return Value of property sinceDate. */ public String getSinceDate() { return CvsHistory.this.getSinceDate(); } /** Setter for property sinceDate. (cvs switch -D) * @param sinceDate New value of property sinceDate. */ public void setSinceDate(String sinceDate) { CvsHistory.this.setSinceDate(sinceDate); } /** Getter for property reportEverything. (cvs switch -e) * @return Value of property reportEverything. */ public boolean isReportEverything() { return CvsHistory.this.isReportEverything(); } /** Setter for property reportEverything. (cvs switch -e) * @param reportEverything New value of property reportEverything. */ public void setReportEverything(boolean reportEverything) { CvsHistory.this.setReportEverything(reportEverything); } /** Getter for property lastEventOfProject. (cvs switch -l) * @return Value of property lastEventOfProject. */ public boolean isLastEventOfProject() { return CvsHistory.this.isLastEventOfProject(); } /** Setter for property lastEventOfProject. (cvs switch -l) * @param lastEventOfProject New value of property lastEventOfProject. */ public void setLastEventOfProject(boolean lastEventOfProject) { CvsHistory.this.setLastEventOfProject(lastEventOfProject); } /** Getter for property reportCheckout. (cvs switch -o) * @return Value of property reportCheckout. */ public boolean isReportCheckouts() { return CvsHistory.this.isReportCheckouts(); } /** Setter for property reportCheckout. (cvs switch -o) * @param reportCheckout New value of property reportCheckout. */ public void setReportCheckouts(boolean reportCheckout) { CvsHistory.this.setReportCheckouts(reportCheckout); } /** Getter for property sinceRevision. (cvs switch -r) * @return Value of property sinceRevision. */ public String getSinceRevision() { return CvsHistory.this.getSinceRevision(); } /** Setter for property sinceRevision. (cvs switch -r) * @param sinceRevision New value of property sinceRevision. */ public void setSinceRevision(String sinceRevision) { CvsHistory.this.setSinceRevision(sinceRevision); } /** Getter for property reportTags. (cvs switch -T) * @return Value of property reportTags. */ public boolean isReportTags() { return CvsHistory.this.isReportTags(); } /** Setter for property reportTags. (cvs switch -T) * @param reportTags New value of property reportTags. */ public void setReportTags(boolean reportTags) { CvsHistory.this.setReportTags(reportTags); } /** Getter for property sinceTag. (cvs switch -t) * @return Value of property sinceTag. */ public String getSinceTag() { return CvsHistory.this.getSinceTag(); } /** Setter for property sinceTag. (cvs switch -t) * @param sinceTag New value of property sinceTag. */ public void setSinceTag(String sinceTag) { CvsHistory.this.setSinceTag(sinceTag); } /** Getter for property forWorkingDirectory. (cvs switch -w) * @return Value of property forWorkingDirectory. */ public boolean isForWorkingDirectory() { return CvsHistory.this.isForWorkingDirectory(); } /** Setter for property forWorkingDirectory. (cvs switch -w) * @param forWorkingDirectory New value of property forWorkingDirectory. */ public void setForWorkingDirectory(boolean forWorkingDirectory) { CvsHistory.this.setForWorkingDirectory(forWorkingDirectory); } /** Getter for property reportEventType. (cvs switch -x) * @return Value of property reportEventType. */ public String getReportEventType() { return CvsHistory.this.getReportEventType(); } /** Setter for property reportEventType. (cvs switch -x) * @param reportEventType New value of property reportEventType. */ public void setReportEventType(String reportEventType) { CvsHistory.this.setReportEventType(reportEventType); } /** Getter for property timeZone. (cvs switch -z) * @return Value of property timeZone. */ public String getTimeZone() { return CvsHistory.this.getTimeZone(); } /** Setter for property timeZone. (cvs switch -z) * @param timeZone New value of property timeZone. */ public void setTimeZone(String timeZone) { CvsHistory.this.setTimeZone(timeZone); } /** Getter for property lastEventForFile. (cvs switch -f) * @return Value of property lastEventForFile. */ public String[] getLastEventForFile() { return CvsHistory.this.getLastEventForFile(); } /** Setter for property lastEventForFile. (cvs switch -f) * @param lastEventForFile New value of property lastEventForFile. */ public void setLastEventForFile(String[] lastEventForFile) { CvsHistory.this.setLastEventForFile(lastEventForFile); } /** Getter for property reportOnModule. (cvs switch -m) * @return Value of property reportOnModule. */ public String[] getReportOnModule() { return CvsHistory.this.getReportOnModule(); } /** Setter for property reportOnModule. (cvs switch -m) * @param reportOnModule New value of property reportOnModule. */ public void setReportOnModule(String[] reportOnModule) { CvsHistory.this.setReportOnModule(reportOnModule); } /** Getter for property reportLastEventForModule. (cvs switch -n) * @return Value of property reportLastEventForModule. */ public String[] getReportLastEventForModule() { return CvsHistory.this.getReportLastEventForModule(); } /** Setter for property reportLastEventForModule. (cvs switch -n) * @param reportLastEventForModule New value of property reportLastEventForModule. */ public void setReportLastEventForModule(String[] reportLastEventForModule) { CvsHistory.this.setReportLastEventForModule(reportLastEventForModule); } /** Getter for property forUsers. (cvs switch -u) * @return Value of property forUsers. */ public String[] getForUsers() { return CvsHistory.this.getForUsers(); } /** Setter for property forUsers. (cvs switch -u) * @param forUsers New value of property forUsers. */ public void setForUsers(String[] forUsers) { CvsHistory.this.setForUsers(forUsers); } public FsGlobalOptions getGlobalOptions() { FsGlobalOptions retValue; retValue = new FsGlobalOptionsImpl(CvsHistory.this.getGlobalOptions()); return retValue; } } }
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.