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();
}
}
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());
}
Aggregations