Search in sources :

Example 1 with DualListener

use of org.netbeans.lib.cvsclient.event.DualListener in project intellij-community by JetBrains.

the class CommitCommand 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.COMMIT, clientEnvironment);
    requests.addArgumentRequest(isForceCommit(), "-f");
    requests.addArgumentRequest(isRecursive(), "-R");
    requests.addArgumentRequest(isNoModuleProgram(), "-n");
    requests.addArgumentRequest(getToRevisionOrBranch(), "-r");
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addMessageRequests(CommandUtils.getMessageNotNull(getMessage()));
    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 commitParser = new CommitParser(eventSender, clientEnvironment.getCvsFileSystem());
    final ICvsListener parser = new DualListener(commitParser, responseProgressHandler);
    parser.registerListeners(listenerRegistry);
    try {
        return requestProcessor.processRequests(requests, requestsProgressHandler);
    } finally {
        parser.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) 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 2 with DualListener

use of org.netbeans.lib.cvsclient.event.DualListener in project intellij-community by JetBrains.

the class TagCommand 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 eventManager, 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.TAG, clientEnvironment);
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addArgumentRequest(isDeleteTag(), "-d");
    requests.addArgumentRequest(isMakeBranchTag(), "-b");
    requests.addArgumentRequest(isCheckThatUnmodified(), "-c");
    requests.addArgumentRequest(isOverrideExistingTag(), "-F");
    requests.addArgumentRequest(isAllowMoveDeleteBranchTag(), "-B");
    requests.addArgumentRequest(true, getTag());
    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, isDeleteTag() ? EXAM_DIR_UNTAG : EXAM_DIR_TAG);
    final ICvsListener tagParser = new TagParser(eventManager, clientEnvironment.getCvsFileSystem());
    final ICvsListener listener = new DualListener(tagParser, 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)

Example 3 with DualListener

use of org.netbeans.lib.cvsclient.event.DualListener in project intellij-community by JetBrains.

the class LogCommand method execute.

// Implemented ============================================================
public final 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.LOG, clientEnvironment);
    requests.addArgumentRequest(isDefaultBranch(), "-b");
    requests.addArgumentRequest(isHeaderAndDescOnly(), "-t");
    requests.addArgumentRequest(isHeaderOnly(), "-h");
    requests.addArgumentRequest(isNoTags(), "-N");
    requests.addArgumentRequest(getUserFilter(), "-w");
    requests.addArgumentRequest(getRevisionFilter(), "-r");
    requests.addArgumentRequest(getStateFilter(), "-s");
    requests.addArgumentRequest(getDateFilter(), "-d");
    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 parser = createParser(eventSender, clientEnvironment.getCvsFileSystem());
    final ICvsListener listener = new DualListener(parser, 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)

Example 4 with DualListener

use of org.netbeans.lib.cvsclient.event.DualListener 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 5 with DualListener

use of org.netbeans.lib.cvsclient.event.DualListener 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

IOException (java.io.IOException)5 DualListener (org.netbeans.lib.cvsclient.event.DualListener)5 ICvsListener (org.netbeans.lib.cvsclient.event.ICvsListener)5 RangeProgressViewer (org.netbeans.lib.cvsclient.progress.RangeProgressViewer)5 FileStateRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.FileStateRequestsProgressHandler)5 IRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler)5 Requests (org.netbeans.lib.cvsclient.request.Requests)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 FileInfoAndDirectoryResponseProgressHandler (org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndDirectoryResponseProgressHandler)1