Search in sources :

Example 21 with Requests

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

the class UneditCommand 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.NOOP, clientEnvironment);
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addLocalPathDirectoryRequest();
    return requestProcessor.processRequests(requests, FileStateRequestsProgressHandler.create(progressViewer, cvsFiles));
}
Also used : IOException(java.io.IOException) Requests(org.netbeans.lib.cvsclient.request.Requests)

Example 22 with Requests

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

Example 23 with Requests

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

the class AdminCommand method execute.

public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    BugLog.getInstance().assertTrue(isSetLock() || isResetLock(), "Nothing specified");
    final ICvsFiles cvsFiles;
    try {
        cvsFiles = scanFileSystem(clientEnvironment);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    final Requests requests = new Requests(CommandRequest.ADMIN, clientEnvironment);
    requests.addArgumentRequest(isSetLock(), "-l");
    requests.addArgumentRequest(isResetLock(), "-u");
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addLocalPathDirectoryRequest();
    addArgumentRequests(requests);
    final IRequestsProgressHandler requestsProgressHandler = FileStateRequestsProgressHandler.create(progressViewer, cvsFiles);
    return requestProcessor.processRequests(requests, requestsProgressHandler);
}
Also used : 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)

Example 24 with Requests

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

the class CreateModuleCommand method execute.

// Implemented ============================================================
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    // check necessary fields
    BugLog.getInstance().assertNotNull(module);
    final String repositoryRoot = FileUtils.removeTrailingSlash(clientEnvironment.getCvsRoot().getRepositoryPath()) + '/' + module;
    final Requests requests = new Requests(CommandRequest.IMPORT, clientEnvironment);
    requests.addArgumentRequest("-b");
    requests.addArgumentRequest("1.1.1");
    requests.addMessageRequests("Create module");
    requests.addArgumentRequest(module);
    requests.addArgumentRequest("vendor-tag");
    requests.addArgumentRequest("release-tag");
    requests.addRequest(new DirectoryRequest(".", repositoryRoot));
    if (!requestProcessor.processRequests(requests, new DummyRequestsProgressHandler())) {
        return false;
    }
    try {
        createCvsDirectory(clientEnvironment, repositoryRoot);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    return true;
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) IOException(java.io.IOException) DirectoryRequest(org.netbeans.lib.cvsclient.request.DirectoryRequest) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

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