Search in sources :

Example 1 with CvsMessagesTranslator

use of com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsMessagesTranslator 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)

Aggregations

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 IClientEnvironment (org.netbeans.lib.cvsclient.IClientEnvironment)1 IRequestProcessor (org.netbeans.lib.cvsclient.IRequestProcessor)1 RequestProcessor (org.netbeans.lib.cvsclient.RequestProcessor)1 AuthenticationException (org.netbeans.lib.cvsclient.connection.AuthenticationException)1