Search in sources :

Example 6 with RangeProgressViewer

use of org.netbeans.lib.cvsclient.progress.RangeProgressViewer in project intellij-community by JetBrains.

the class UpdateCommand method execute.

// Implemented ============================================================
/**
	 * Execute the command.
	 * @param requestProcessor the client services object that provides any necessary
	 *               services to this command, including the ability to actually
	 *               process all the requests
	 */
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventSender, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    final ICvsFiles cvsFiles;
    try {
        cvsFiles = scanFileSystem(clientEnvironment);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    final Requests requests = new Requests(CommandRequest.UPDATE, clientEnvironment);
    requests.addArgumentRequest(isBuildDirectories(), "-d");
    requests.addArgumentRequest(isCleanCopy(), "-C");
    requests.addArgumentRequest(isResetStickyOnes(), "-A");
    requests.addArgumentRequest(isUseHeadIfNotFound(), "-f");
    requests.addArgumentRequest(getUpdateByDate(), "-D");
    requests.addArgumentRequest(getUpdateByRevision(), "-r");
    requests.addArgumentRequests(getMergeRevision1(), "-j");
    requests.addArgumentRequests(getMergeRevision2(), "-j");
    requests.addArgumentRequest(getKeywordSubst(), "-k");
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addLocalPathDirectoryRequest();
    addArgumentRequests(requests);
    DirectoryPruner directoryPruner = null;
    if (isPruneDirectories()) {
        directoryPruner = new DirectoryPruner(clientEnvironment);
        directoryPruner.registerListeners(listenerRegistry);
    }
    final IRequestsProgressHandler requestsProgressHandler = new FileStateRequestsProgressHandler(new RangeProgressViewer(progressViewer, 0.0, 0.5), cvsFiles);
    final ICvsListener responseProgressViewer = new FileInfoAndDirectoryResponseProgressHandler(new RangeProgressViewer(progressViewer, 0.5, 1.0), cvsFiles);
    final ICvsListener updateMessageParser = new UpdateMessageParser(eventSender, clientEnvironment.getCvsFileSystem());
    final ICvsListener listener = new DualListener(updateMessageParser, responseProgressViewer);
    listener.registerListeners(listenerRegistry);
    try {
        return requestProcessor.processRequests(requests, requestsProgressHandler);
    } finally {
        listener.unregisterListeners(listenerRegistry);
        if (directoryPruner != null) {
            directoryPruner.unregisterListeners(listenerRegistry);
            try {
                directoryPruner.pruneEmptyDirectories();
            } catch (IOException ex) {
                throw new IOCommandException(ex);
            }
        }
    }
}
Also used : FileInfoAndDirectoryResponseProgressHandler(org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndDirectoryResponseProgressHandler) RangeProgressViewer(org.netbeans.lib.cvsclient.progress.RangeProgressViewer) FileStateRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.FileStateRequestsProgressHandler) ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) IOException(java.io.IOException) IRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler) Requests(org.netbeans.lib.cvsclient.request.Requests) DualListener(org.netbeans.lib.cvsclient.event.DualListener)

Example 7 with RangeProgressViewer

use of org.netbeans.lib.cvsclient.progress.RangeProgressViewer in project intellij-community by JetBrains.

the class StatusCommand method execute.

/**
	 * Execute a command
	 * @param requestProcessor the client services object that provides any necessary
	 * services to this command, including the ability to actually process
	 * all the requests.
	 */
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventSender, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    final ICvsFiles cvsFiles;
    try {
        cvsFiles = scanFileSystem(clientEnvironment);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    final Requests requests = new Requests(CommandRequest.STATUS, clientEnvironment);
    requests.addArgumentRequest(includeTags, "-v");
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addLocalPathDirectoryRequest();
    addArgumentRequests(requests);
    final IRequestsProgressHandler requestsProgressHandler = new FileStateRequestsProgressHandler(new RangeProgressViewer(progressViewer, 0.0, 0.5), cvsFiles);
    final ICvsListener responseProgressHandler = new FileInfoAndMessageResponseProgressHandler(new RangeProgressViewer(progressViewer, 0.5, 1.0), cvsFiles, EXAM_DIR);
    final ICvsListener statusMessageParser = new StatusMessageParser(eventSender, getFileObjects(), clientEnvironment.getCvsFileSystem());
    final ICvsListener listener = new DualListener(statusMessageParser, responseProgressHandler);
    listener.registerListeners(listenerRegistry);
    try {
        return requestProcessor.processRequests(requests, requestsProgressHandler);
    } finally {
        listener.unregisterListeners(listenerRegistry);
    }
}
Also used : FileInfoAndMessageResponseProgressHandler(org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndMessageResponseProgressHandler) RangeProgressViewer(org.netbeans.lib.cvsclient.progress.RangeProgressViewer) FileStateRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.FileStateRequestsProgressHandler) ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) ICvsFiles(org.netbeans.lib.cvsclient.command.ICvsFiles) IOException(java.io.IOException) IRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException) DualListener(org.netbeans.lib.cvsclient.event.DualListener)

Aggregations

RangeProgressViewer (org.netbeans.lib.cvsclient.progress.RangeProgressViewer)7 IOException (java.io.IOException)6 Requests (org.netbeans.lib.cvsclient.request.Requests)6 DualListener (org.netbeans.lib.cvsclient.event.DualListener)5 ICvsListener (org.netbeans.lib.cvsclient.event.ICvsListener)5 FileStateRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.FileStateRequestsProgressHandler)5 IRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler)5 FileInfoAndMessageResponseProgressHandler (org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndMessageResponseProgressHandler)4 ICvsFiles (org.netbeans.lib.cvsclient.command.ICvsFiles)3 IOCommandException (org.netbeans.lib.cvsclient.command.IOCommandException)3 CvsRootProvider (com.intellij.cvsSupport2.connections.CvsRootProvider)1 CannotFindCvsRootException (com.intellij.cvsSupport2.errorHandling.CannotFindCvsRootException)1 CvsException (com.intellij.cvsSupport2.errorHandling.CvsException)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 VcsException (com.intellij.openapi.vcs.VcsException)1 Collection (java.util.Collection)1 AuthenticationException (org.netbeans.lib.cvsclient.connection.AuthenticationException)1 IProgressViewer (org.netbeans.lib.cvsclient.progress.IProgressViewer)1 FileInfoAndDirectoryResponseProgressHandler (org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndDirectoryResponseProgressHandler)1