Search in sources :

Example 1 with CvsOperationExecutor

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());
}
Also used : UpdateHandler(com.intellij.cvsSupport2.cvshandlers.UpdateHandler) UpdatedFilesProcessor(com.intellij.cvsSupport2.updateinfo.UpdatedFilesProcessor) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) UpdateSettings(com.intellij.cvsSupport2.actions.update.UpdateSettings) CvsResult(com.intellij.openapi.cvsIntegration.CvsResult) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with CvsOperationExecutor

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;
}
Also used : LocalPathIndifferentLogOperation(com.intellij.cvsSupport2.cvsoperations.cvsLog.LocalPathIndifferentLogOperation) Revision(org.netbeans.lib.cvsclient.command.log.Revision) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) LogInformation(org.netbeans.lib.cvsclient.command.log.LogInformation) DefaultCvsOperationExecutorCallback(com.intellij.cvsSupport2.cvsExecution.DefaultCvsOperationExecutorCallback) CvsChangeList(com.intellij.cvsSupport2.changeBrowser.CvsChangeList) List(java.util.List) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)

Example 3 with CvsOperationExecutor

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();
}
Also used : GetFileContentOperation(com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) IOException(java.io.IOException) File(java.io.File) VcsVirtualFile(com.intellij.openapi.vcs.vfs.VcsVirtualFile) SimpleRevision(com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision)

Example 4 with CvsOperationExecutor

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;
}
Also used : GetFileContentOperation(com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) VcsException(com.intellij.openapi.vcs.VcsException) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) CvsResult(com.intellij.openapi.cvsIntegration.CvsResult) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with CvsOperationExecutor

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();
}
Also used : CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)

Aggregations

CvsOperationExecutor (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)21 CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)17 CvsHandler (com.intellij.cvsSupport2.cvshandlers.CvsHandler)7 CvsResult (com.intellij.openapi.cvsIntegration.CvsResult)7 File (java.io.File)4 FilePath (com.intellij.openapi.vcs.FilePath)3 CvsConfiguration (com.intellij.cvsSupport2.config.CvsConfiguration)2 DefaultCvsOperationExecutorCallback (com.intellij.cvsSupport2.cvsExecution.DefaultCvsOperationExecutorCallback)2 UpdateHandler (com.intellij.cvsSupport2.cvshandlers.UpdateHandler)2 GetFileContentOperation (com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation)2 UpdatedFilesProcessor (com.intellij.cvsSupport2.updateinfo.UpdatedFilesProcessor)2 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)2 VcsException (com.intellij.openapi.vcs.VcsException)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 List (java.util.List)2 NotNull (org.jetbrains.annotations.NotNull)2 CvsMergeProvider (com.intellij.cvsSupport2.actions.merge.CvsMergeProvider)1 UpdateSettings (com.intellij.cvsSupport2.actions.update.UpdateSettings)1 UpdateSettingsOnCvsConfiguration (com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)1 CvsChangeList (com.intellij.cvsSupport2.changeBrowser.CvsChangeList)1