Search in sources :

Example 1 with CommandCvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler 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 2 with CommandCvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler 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 3 with CommandCvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler 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 4 with CommandCvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler 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)

Example 5 with CommandCvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler in project intellij-community by JetBrains.

the class CvsVcs2 method executeOperation.

public static void executeOperation(String title, CvsOperation operation, final Project project) throws VcsException {
    CvsOperationExecutor executor = new CvsOperationExecutor(project);
    executor.performActionSync(new CommandCvsHandler(title, operation), CvsOperationExecutorCallback.EMPTY);
    CvsResult result = executor.getResult();
    if (result.hasErrors()) {
        throw result.composeError();
    }
}
Also used : CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) CvsResult(com.intellij.openapi.cvsIntegration.CvsResult)

Aggregations

CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)12 CvsOperationExecutor (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 CvsResult (com.intellij.openapi.cvsIntegration.CvsResult)5 File (java.io.File)4 CvsLightweightFile (com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile)3 VcsException (com.intellij.openapi.vcs.VcsException)3 CheckoutProjectOperation (com.intellij.cvsSupport2.cvsoperations.cvsCheckOut.CheckoutProjectOperation)2 GetFileContentOperation (com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation)2 TagOperation (com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.TagOperation)2 UpdateOperation (com.intellij.cvsSupport2.cvsoperations.cvsUpdate.UpdateOperation)2 WatchOperation (com.intellij.cvsSupport2.cvsoperations.cvsWatch.WatchOperation)2 SimpleRevision (com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision)2 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)2 IOException (java.io.IOException)2 CvsEntriesManager (com.intellij.cvsSupport2.application.CvsEntriesManager)1 CvsChangeList (com.intellij.cvsSupport2.changeBrowser.CvsChangeList)1 CvsConfiguration (com.intellij.cvsSupport2.config.CvsConfiguration)1 DefaultCvsOperationExecutorCallback (com.intellij.cvsSupport2.cvsExecution.DefaultCvsOperationExecutorCallback)1 ModalityContextImpl (com.intellij.cvsSupport2.cvsExecution.ModalityContextImpl)1