Search in sources :

Example 1 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException in project intellij-community by JetBrains.

the class EditorsCommand method execute.

// Implemented ============================================================
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.EDITORS, clientEnvironment);
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addLocalPathDirectoryRequest();
    addArgumentRequests(requests);
    final ICvsListener builder = new EditorsMessageParser(eventSender, clientEnvironment.getCvsFileSystem(), cvsFiles);
    builder.registerListeners(listenerRegistry);
    try {
        return requestProcessor.processRequests(requests, FileStateRequestsProgressHandler.create(progressViewer, cvsFiles));
    } finally {
        builder.unregisterListeners(listenerRegistry);
    }
}
Also used : ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) ICvsFiles(org.netbeans.lib.cvsclient.command.ICvsFiles) IOException(java.io.IOException) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 2 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException 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 IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException in project intellij-community by JetBrains.

the class AddCommand method execute.

// Implemented ============================================================
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    BugLog.getInstance().assertTrue(getFileObjects().size() > 0, "No file specified.");
    repositoryPathToDirectoryObject.clear();
    final Requests requests;
    try {
        requests = new Requests(CommandRequest.ADD, clientEnvironment);
        requests.addArgumentRequest(getKeywordSubst(), "-k");
        for (AbstractFileObject abstractFileObject : getFileObjects()) {
            addRequests(abstractFileObject, requests, requestProcessor, clientEnvironment);
        }
        requests.addLocalPathDirectoryRequest();
        addArgumentRequests(requests);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    final ICvsListener parser = new AddParser(eventManager, clientEnvironment.getCvsFileSystem());
    parser.registerListeners(listenerRegistry);
    try {
        final boolean result = requestProcessor.processRequests(requests, new DummyRequestsProgressHandler());
        createCvsDirectories(clientEnvironment);
        return result;
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    } finally {
        repositoryPathToDirectoryObject.clear();
        parser.unregisterListeners(listenerRegistry);
    }
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) IOException(java.io.IOException) AbstractFileObject(org.netbeans.lib.cvsclient.file.AbstractFileObject) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 4 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException in project intellij-community by JetBrains.

the class AnnotateCommand method execute.

// Implemented ============================================================
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.ANNOTATE, clientEnvironment);
    requests.addArgumentRequest(isUseHeadIfNotFound(), "-f");
    requests.addArgumentRequest(getDate(), "-D");
    requests.addArgumentRequest(getRevisionOrTag(), "-r");
    requests.addArgumentRequest(isAnnotateBinary(), "-F");
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addLocalPathDirectoryRequest();
    addArgumentRequests(requests);
    final ICvsListener parser = new AnnotateMessageParser(eventManager, clientEnvironment.getCvsFileSystem());
    parser.registerListeners(listenerRegistry);
    try {
        return requestProcessor.processRequests(requests, FileStateRequestsProgressHandler.create(progressViewer, cvsFiles));
    } finally {
        parser.unregisterListeners(listenerRegistry);
    }
}
Also used : ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) ICvsFiles(org.netbeans.lib.cvsclient.command.ICvsFiles) IOException(java.io.IOException) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 5 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException 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)

Aggregations

IOException (java.io.IOException)12 IOCommandException (org.netbeans.lib.cvsclient.command.IOCommandException)12 Requests (org.netbeans.lib.cvsclient.request.Requests)10 ICvsFiles (org.netbeans.lib.cvsclient.command.ICvsFiles)8 ICvsListener (org.netbeans.lib.cvsclient.event.ICvsListener)7 IRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler)4 DualListener (org.netbeans.lib.cvsclient.event.DualListener)3 RangeProgressViewer (org.netbeans.lib.cvsclient.progress.RangeProgressViewer)3 FileInfoAndMessageResponseProgressHandler (org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndMessageResponseProgressHandler)3 FileStateRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.FileStateRequestsProgressHandler)3 DummyRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler)2 CommandException (org.netbeans.lib.cvsclient.command.CommandException)1 AuthenticationException (org.netbeans.lib.cvsclient.connection.AuthenticationException)1 AbstractFileObject (org.netbeans.lib.cvsclient.file.AbstractFileObject)1 DirectoryRequest (org.netbeans.lib.cvsclient.request.DirectoryRequest)1