use of com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor in project intellij-community by JetBrains.
the class CvsStatusEnvironment method updateDirectories.
@NotNull
public UpdateSession updateDirectories(@NotNull FilePath[] contentRoots, final UpdatedFiles updatedFiles, ProgressIndicator progressIndicator, @NotNull final Ref<SequentialUpdatesContext> context) {
final UpdateSettings updateSettings = UpdateSettings.DONT_MAKE_ANY_CHANGES;
final UpdateHandler handler = CommandCvsHandler.createUpdateHandler(contentRoots, updateSettings, myProject, updatedFiles);
handler.addCvsListener(new UpdatedFilesProcessor(updatedFiles));
CvsOperationExecutor cvsOperationExecutor = new CvsOperationExecutor(true, myProject, ModalityState.defaultModalityState());
cvsOperationExecutor.setShowErrors(false);
cvsOperationExecutor.performActionSync(handler, CvsOperationExecutorCallback.EMPTY);
final CvsResult result = cvsOperationExecutor.getResult();
return new UpdateSessionAdapter(result.getErrorsAndWarnings(), result.isCanceled());
}
use of com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor in project intellij-community by JetBrains.
the class CvsHistoryProvider method createRevisions.
private List<VcsFileRevision> createRevisions(final CvsEnvironment connectionSettings, final File lightweightFileForFile) {
final LocalPathIndifferentLogOperation logOperation = new LocalPathIndifferentLogOperation(connectionSettings);
logOperation.addFile(lightweightFileForFile);
final CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
final ArrayList<VcsFileRevision> result = new ArrayList<>();
executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.load.file.content"), logOperation), new DefaultCvsOperationExecutorCallback() {
@Override
public void executionFinishedSuccessfully() {
final LogInformation firstLogInformation = logOperation.getFirstLogInformation();
if (firstLogInformation != null) {
final List<Revision> revisionList = firstLogInformation.getRevisionList();
for (Revision revision : revisionList) {
result.add(new CvsFileRevisionImpl(revision, lightweightFileForFile, firstLogInformation, connectionSettings, myProject));
}
}
}
});
Collections.sort(result, Collections.reverseOrder(VcsFileRevisionComparator.INSTANCE));
return result;
}
use of com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor in project intellij-community by JetBrains.
the class CvsServicesImpl method getFileContent.
public byte[] getFileContent(Project project, CvsModule cvsFile) throws IOException {
final GetFileContentOperation operation = new GetFileContentOperation(new File(cvsFile.getPathInCvs()), CvsRootConfiguration.createOn(cvsFile.getRepository()), new SimpleRevision(cvsFile.getRevision()));
final CvsOperationExecutor executor = new CvsOperationExecutor(project);
executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.load.file.content"), operation, false), CvsOperationExecutorCallback.EMPTY);
if (!executor.hasNoErrors())
throw new RuntimeException(executor.getFirstError());
if (operation.isDeleted())
throw new IOException(CvsBundle.message("exception.text.revision.has.been.deleted"));
return operation.getFileBytes();
}
use of com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor in project intellij-community by JetBrains.
the class CvsContentRevision method getContentAsBytes.
@Nullable
@Override
public byte[] getContentAsBytes() throws VcsException {
if (myContent == null) {
final GetFileContentOperation operation = new GetFileContentOperation(myFile, myEnvironment, myRevision);
CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.load.file"), operation), CvsOperationExecutorCallback.EMPTY);
CvsResult result = executor.getResult();
if (result.isCanceled()) {
throw new ProcessCanceledException();
}
if (result.hasErrors()) {
throw result.composeError();
}
if (!operation.isLoaded()) {
throw new VcsException("Network problem");
}
myContent = operation.getFileBytes();
}
return myContent;
}
use of com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor in project intellij-community by JetBrains.
the class LoadHistoryOperation method internalRun.
private CvsResult internalRun(Project project) {
final CvsOperationExecutor executor = new CvsOperationExecutor(project);
executor.performActionSync(new CommandCvsHandler(CvsBundle.message("browse.changes.load.history.progress.title"), this), CvsOperationExecutorCallback.EMPTY);
return executor.getResult();
}
Aggregations