Search in sources :

Example 11 with CvsOperationExecutor

use of com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor in project intellij-community by JetBrains.

the class AbstractVcsDataProvider method executeCommand.

private void executeCommand(final DirectoryContentProvider command, final GetContentCallback callback) {
    final CvsOperationExecutor executor = new CvsOperationExecutor(false, callback.getProject(), callback.getModalityState());
    executor.setIsQuietOperation(true);
    final CancellableCvsHandler cvsHandler = new CancellableCvsHandler(CvsBundle.message("browse.repository.operation.name"), (CvsOperation) command);
    callback.useForCancel(cvsHandler.getProgressListener());
    executor.performActionSync(cvsHandler, new DefaultCvsOperationExecutorCallback() {

        @Override
        public void executionFinished(boolean successfully) {
            if (!successfully) {
                final List<VcsException> errors = cvsHandler.getErrorsExceptAborted();
                if (!errors.isEmpty()) {
                    myErrorCallback.consume(errors.get(0));
                }
            }
            callback.finished();
        }
    });
}
Also used : CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) DefaultCvsOperationExecutorCallback(com.intellij.cvsSupport2.cvsExecution.DefaultCvsOperationExecutorCallback) List(java.util.List)

Example 12 with CvsOperationExecutor

use of com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor in project intellij-community by JetBrains.

the class CvsServicesImpl method checkout.

public CvsResult checkout(String[] modules, File checkoutTo, String directory, boolean makeNewFilesReadOnly, boolean pruneEmptyDirectories, Object keywordSubstitution, Project project, CvsRepository repository) {
    LOG.assertTrue(modules.length > 0);
    CheckoutProjectOperation operation = new CheckoutProjectOperation(modules, CvsRootConfiguration.createOn(repository), makeNewFilesReadOnly, checkoutTo, directory, pruneEmptyDirectories, (KeywordSubstitution) keywordSubstitution);
    final CvsOperationExecutor executor = new CvsOperationExecutor(project);
    executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.checkout"), operation, true), CvsOperationExecutorCallback.EMPTY);
    return executor.getResult();
}
Also used : CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) CheckoutProjectOperation(com.intellij.cvsSupport2.cvsoperations.cvsCheckOut.CheckoutProjectOperation) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)

Example 13 with CvsOperationExecutor

use of com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor in project intellij-community by JetBrains.

the class ComparableVcsRevisionOnOperation method loadContent.

public byte[] loadContent() throws IOException, VcsException {
    if (!myOperation.isLoaded()) {
        CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
        executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.load.file"), myOperation), CvsOperationExecutorCallback.EMPTY);
        CvsResult result = executor.getResult();
        if (result.isCanceled()) {
            throw new ProcessCanceledException();
        }
        if (result.hasErrors()) {
            throw result.composeError();
        }
    }
    return getContent();
}
Also used : CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) CvsResult(com.intellij.openapi.cvsIntegration.CvsResult) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException)

Example 14 with CvsOperationExecutor

use of com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor in project intellij-community by JetBrains.

the class CvsUpdateEnvironment method updateDirectories.

@NotNull
public UpdateSession updateDirectories(@NotNull FilePath[] contentRoots, final UpdatedFiles updatedFiles, ProgressIndicator progressIndicator, @NotNull final Ref<SequentialUpdatesContext> contextRef) {
    CvsConfiguration cvsConfiguration = CvsConfiguration.getInstance(myProject);
    if (!myLastUpdateWasConfigured) {
        cvsConfiguration.CLEAN_COPY = false;
        cvsConfiguration.RESET_STICKY = false;
    }
    myLastUpdateWasConfigured = false;
    try {
        final UpdateSettingsOnCvsConfiguration updateSettings = createSettingsAndUpdateContext(cvsConfiguration, contextRef);
        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 createUpdateSessionAdapter(updatedFiles, result);
    } finally {
        cvsConfiguration.CLEAN_COPY = false;
        cvsConfiguration.RESET_STICKY = false;
    }
}
Also used : UpdateHandler(com.intellij.cvsSupport2.cvshandlers.UpdateHandler) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration) CvsConfiguration(com.intellij.cvsSupport2.config.CvsConfiguration) UpdatedFilesProcessor(com.intellij.cvsSupport2.updateinfo.UpdatedFilesProcessor) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration) CvsResult(com.intellij.openapi.cvsIntegration.CvsResult) NotNull(org.jetbrains.annotations.NotNull)

Example 15 with CvsOperationExecutor

use of com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor in project intellij-community by JetBrains.

the class CvsUpdateEnvironment method invokeManualMerging.

private static List<VirtualFile> invokeManualMerging(Collection<String> paths, Project project) {
    final List<VirtualFile> readOnlyFiles = new ArrayList<>();
    final List<VirtualFile> files = new ArrayList<>();
    for (final String path : paths) {
        final VirtualFile virtualFile = CvsVfsUtil.findFileByIoFile(new File(path));
        if (virtualFile != null) {
            files.add(virtualFile);
            if (!virtualFile.isWritable()) {
                readOnlyFiles.add(virtualFile);
            }
        }
    }
    if (readOnlyFiles.size() > 0) {
        final CvsHandler editHandler = CommandCvsHandler.createEditHandler(VfsUtil.toVirtualFileArray(readOnlyFiles), CvsConfiguration.getInstance(project).RESERVED_EDIT);
        new CvsOperationExecutor(true, project, ModalityState.current()).performActionSync(editHandler, CvsOperationExecutorCallback.EMPTY);
        ApplicationManager.getApplication().runWriteAction(() -> {
            for (VirtualFile file : readOnlyFiles) {
                file.refresh(false, false);
            }
        });
    }
    if (!files.isEmpty()) {
        return AbstractVcsHelper.getInstance(project).showMergeDialog(files, new CvsMergeProvider());
    }
    return Collections.emptyList();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) CvsHandler(com.intellij.cvsSupport2.cvshandlers.CvsHandler) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) ArrayList(java.util.ArrayList) CvsMergeProvider(com.intellij.cvsSupport2.actions.merge.CvsMergeProvider) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

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