Search in sources :

Example 1 with Requests

use of org.netbeans.lib.cvsclient.request.Requests in project intellij-community by JetBrains.

the class CheckoutCommand method expandModules.

// Utils ==================================================================
private boolean expandModules(ExpandedModules expandedModules, ICvsListenerRegistry listenerRegistry, IRequestProcessor requestProcessor, IClientEnvironment clientEnvironment) throws CommandException, AuthenticationException {
    final Requests requests = new Requests(new ExpandModulesRequest(), clientEnvironment);
    addModuleArguments(requests);
    requests.addLocalPathDirectoryRequest();
    expandedModules.registerListeners(listenerRegistry);
    try {
        return requestProcessor.processRequests(requests, new DummyRequestsProgressHandler());
    } finally {
        expandedModules.unregisterListeners(listenerRegistry);
    }
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) ExpandModulesRequest(org.netbeans.lib.cvsclient.request.ExpandModulesRequest) Requests(org.netbeans.lib.cvsclient.request.Requests)

Example 2 with Requests

use of org.netbeans.lib.cvsclient.request.Requests in project intellij-community by JetBrains.

the class ExportCommand method checkout.

private boolean checkout(ExpandedModules expandedModules, IRequestProcessor requestProcessor, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment) throws CommandException, AuthenticationException {
    // we first see whether the modules specified actually exist
    // checked out already. If so, we must work something like an update
    // command and send modified files to the server.
    processExistingModules(expandedModules, clientEnvironment);
    final Requests requests;
    requests = new Requests(CommandRequest.EXPORT, clientEnvironment);
    if (getAlternativeCheckoutDirectory() != null) {
        requests.addArgumentRequest("-d");
        requests.addArgumentRequest(getAlternativeCheckoutDirectory());
    }
    requests.addArgumentRequest(!isRecursive(), "-l");
    requests.addArgumentRequest(getUpdateByDate(), "-D");
    requests.addArgumentRequest(getUpdateByRevisionOrTag(), "-r");
    requests.addArgumentRequest(getKeywordSubstitution(), "-k");
    addModuleArguments(requests);
    requests.addLocalPathDirectoryRequest();
    try {
        return requestProcessor.processRequests(requests, new DummyRequestsProgressHandler());
    } finally {
    }
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) Requests(org.netbeans.lib.cvsclient.request.Requests)

Example 3 with Requests

use of org.netbeans.lib.cvsclient.request.Requests in project intellij-community by JetBrains.

the class ExportCommand method expandModules.

// Utils ==================================================================
private boolean expandModules(ExpandedModules expandedModules, ICvsListenerRegistry listenerRegistry, IRequestProcessor requestProcessor, IClientEnvironment clientEnvironment) throws CommandException, AuthenticationException {
    final Requests requests = new Requests(new ExpandModulesRequest(), clientEnvironment);
    addModuleArguments(requests);
    requests.addLocalPathDirectoryRequest();
    expandedModules.registerListeners(listenerRegistry);
    try {
        return requestProcessor.processRequests(requests, new DummyRequestsProgressHandler());
    } finally {
        expandedModules.unregisterListeners(listenerRegistry);
    }
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) ExpandModulesRequest(org.netbeans.lib.cvsclient.request.ExpandModulesRequest) Requests(org.netbeans.lib.cvsclient.request.Requests)

Example 4 with Requests

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

use of org.netbeans.lib.cvsclient.request.Requests in project intellij-community by JetBrains.

the class EditCommand 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);
    }
    if (isCheckThatUnedited()) {
        editors = true;
        final Requests requests = new Requests(CommandRequest.EDITORS, clientEnvironment);
        addFileRequests(cvsFiles, requests, clientEnvironment);
        requests.addLocalPathDirectoryRequest();
        addArgumentRequests(requests);
        final EditEditorsMessageParser parser = new EditEditorsMessageParser(clientEnvironment.getCvsRoot().getUser());
        parser.registerListeners(listenerRegistry);
        try {
            final RangeProgressViewer editorsProgressViewer = new RangeProgressViewer(progressViewer, 0.0, 0.5);
            requestProcessor.processRequests(requests, FileStateRequestsProgressHandler.create(editorsProgressViewer, cvsFiles));
        } finally {
            parser.unregisterListeners(listenerRegistry);
        }
        if (parser.isFilesEdited()) {
            final String message = JavaCvsSrcBundle.message("cannot.edit.files.they.are.edited.error.message");
            eventSender.notifyMessageListeners(message.getBytes(), true, false);
            return false;
        }
        progressViewer = new RangeProgressViewer(progressViewer, 0.5, 1.0);
    }
    editors = false;
    final Requests requests = new Requests(CommandRequest.NOOP, clientEnvironment);
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addArgumentRequest(isCheckThatUnedited(), "-c");
    requests.addArgumentRequest(isForceEvenIfEdited(), "-f");
    requests.addLocalPathDirectoryRequest();
    return requestProcessor.processRequests(requests, FileStateRequestsProgressHandler.create(progressViewer, cvsFiles));
}
Also used : RangeProgressViewer(org.netbeans.lib.cvsclient.progress.RangeProgressViewer) IOException(java.io.IOException) Requests(org.netbeans.lib.cvsclient.request.Requests)

Aggregations

Requests (org.netbeans.lib.cvsclient.request.Requests)24 IOException (java.io.IOException)18 ICvsListener (org.netbeans.lib.cvsclient.event.ICvsListener)11 IOCommandException (org.netbeans.lib.cvsclient.command.IOCommandException)10 DummyRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler)10 ICvsFiles (org.netbeans.lib.cvsclient.command.ICvsFiles)8 RangeProgressViewer (org.netbeans.lib.cvsclient.progress.RangeProgressViewer)6 IRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler)6 DualListener (org.netbeans.lib.cvsclient.event.DualListener)5 FileStateRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.FileStateRequestsProgressHandler)5 FileInfoAndMessageResponseProgressHandler (org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndMessageResponseProgressHandler)4 AbstractFileObject (org.netbeans.lib.cvsclient.file.AbstractFileObject)2 DirectoryRequest (org.netbeans.lib.cvsclient.request.DirectoryRequest)2 ExpandModulesRequest (org.netbeans.lib.cvsclient.request.ExpandModulesRequest)2 File (java.io.File)1 LogMessageParser (org.netbeans.lib.cvsclient.command.log.LogMessageParser)1 FileInfoAndDirectoryResponseProgressHandler (org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndDirectoryResponseProgressHandler)1