Search in sources :

Example 1 with IClientEnvironment

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

the class CvsCommandOperation method execute.

public void execute(final CvsRootProvider root, final CvsExecutionEnvironment executionEnvironment, IConnection connection, IProgressViewer progressViewer) throws CommandException {
    final Command command = createCommand(root, executionEnvironment);
    if (command == null)
        return;
    LOG.assertTrue(connection != null, root.getCvsRootAsString());
    final CvsMessagesListener cvsMessagesListener = executionEnvironment.getCvsMessagesListener();
    final long start = System.currentTimeMillis();
    try {
        final IClientEnvironment clientEnvironment = createEnvironment(connection, root, myUpdatedFilesManager, executionEnvironment);
        myUpdatedFilesManager.setCvsFileSystem(clientEnvironment.getCvsFileSystem());
        final EventManager eventManager = new EventManager(CvsApplicationLevelConfiguration.getCharset());
        final IGlobalOptions globalOptions = command.getGlobalOptions();
        final IRequestProcessor requestProcessor = new RequestProcessor(clientEnvironment, globalOptions, eventManager, new StreamLogger(), executionEnvironment.getCvsCommandStopper(), PServerCvsSettings.getTimeoutMillis());
        eventManager.addFileInfoListener(this);
        eventManager.addEntryListener(this);
        eventManager.addMessageListener(this);
        eventManager.addModuleExpansionListener(this);
        final CvsMessagesTranslator cvsMessagesTranslator = new CvsMessagesTranslator(cvsMessagesListener, clientEnvironment.getCvsFileSystem(), myUpdatedFilesManager, root.getCvsRootAsString());
        cvsMessagesTranslator.registerTo(eventManager);
        final CvsEntriesManager cvsEntriesManager = CvsEntriesManager.getInstance();
        if (shouldMakeChangesOnTheLocalFileSystem()) {
            eventManager.addEntryListener(new MergeSupportingEntryListener(clientEnvironment, cvsEntriesManager, myUpdatedFilesManager));
            eventManager.addMessageListener(myUpdatedFilesManager);
        }
        modifyOptions(command.getGlobalOptions());
        final String commandString = composeCommandString(root, command);
        cvsMessagesListener.commandStarted(commandString);
        setProgressText(CvsBundle.message("progress.text.command.running.for.file", getOperationName(), root.getCvsRootAsString()));
        try {
            command.execute(requestProcessor, eventManager, eventManager, clientEnvironment, progressViewer);
        } catch (AuthenticationException e) {
            throw root.processException(new CommandException(e, "Authentication problem"));
        }
        cvsMessagesTranslator.operationCompleted();
    } catch (CommandException t) {
        throw root.processException(t);
    } finally {
        cvsMessagesListener.commandFinished(composeCommandString(root, command), System.currentTimeMillis() - start);
        executeFinishActions();
    }
}
Also used : IRequestProcessor(org.netbeans.lib.cvsclient.IRequestProcessor) AuthenticationException(org.netbeans.lib.cvsclient.connection.AuthenticationException) IgnoreFileFilterBasedOnCvsEntriesManager(com.intellij.cvsSupport2.cvsIgnore.IgnoreFileFilterBasedOnCvsEntriesManager) CvsEntriesManager(com.intellij.cvsSupport2.application.CvsEntriesManager) CvsMessagesTranslator(com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsMessagesTranslator) IClientEnvironment(org.netbeans.lib.cvsclient.IClientEnvironment) CvsMessagesListener(com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsMessagesListener) RequestProcessor(org.netbeans.lib.cvsclient.RequestProcessor) IRequestProcessor(org.netbeans.lib.cvsclient.IRequestProcessor)

Example 2 with IClientEnvironment

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

the class CvsCommandOperation method createEnvironment.

private IClientEnvironment createEnvironment(IConnection connection, final CvsRootProvider root, UpdatedFilesManager mergedFilesCollector, CvsExecutionEnvironment cvsExecutionEnv) {
    final File localRoot = getLocalRootFor(root);
    final File adminRoot = getAdminRootFor(root);
    LOG.assertTrue(localRoot != null, getClass().getName());
    LOG.assertTrue(adminRoot != null, getClass().getName());
    return new ClientEnvironment(connection, localRoot, adminRoot, root.getCvsRoot(), createLocalFileReader(), createLocalFileWriter(root.getCvsRootAsString(), mergedFilesCollector, cvsExecutionEnv), myAdminReader, myAdminWriter, getIgnoreFileFilter(), new FileReadOnlyHandler(), CvsApplicationLevelConfiguration.getCharset());
}
Also used : FileReadOnlyHandler(com.intellij.cvsSupport2.javacvsImpl.FileReadOnlyHandler) ClientEnvironment(org.netbeans.lib.cvsclient.ClientEnvironment) IClientEnvironment(org.netbeans.lib.cvsclient.IClientEnvironment) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

IClientEnvironment (org.netbeans.lib.cvsclient.IClientEnvironment)2 CvsEntriesManager (com.intellij.cvsSupport2.application.CvsEntriesManager)1 IgnoreFileFilterBasedOnCvsEntriesManager (com.intellij.cvsSupport2.cvsIgnore.IgnoreFileFilterBasedOnCvsEntriesManager)1 CvsMessagesListener (com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsMessagesListener)1 CvsMessagesTranslator (com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsMessagesTranslator)1 FileReadOnlyHandler (com.intellij.cvsSupport2.javacvsImpl.FileReadOnlyHandler)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 ClientEnvironment (org.netbeans.lib.cvsclient.ClientEnvironment)1 IRequestProcessor (org.netbeans.lib.cvsclient.IRequestProcessor)1 RequestProcessor (org.netbeans.lib.cvsclient.RequestProcessor)1 AuthenticationException (org.netbeans.lib.cvsclient.connection.AuthenticationException)1