Search in sources :

Example 1 with DirectoryContentProvider

use of com.intellij.cvsSupport2.cvsoperations.cvsContent.DirectoryContentProvider 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 2 with DirectoryContentProvider

use of com.intellij.cvsSupport2.cvsoperations.cvsContent.DirectoryContentProvider in project intellij-community by JetBrains.

the class AbstractVcsDataProvider method fillContentFor.

@Override
public void fillContentFor(final GetContentCallback callback, Consumer<VcsException> errorCallback) {
    myErrorCallback = errorCallback;
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        executeCommand(createDirectoryContentProvider(callback.getElementPath()), callback);
    } else {
        final DirectoryContentProvider provider = createDirectoryContentProvider(callback.getElementPath());
        provider.setStreamingListener(directoryContent -> callback.appendDirectoryContent(directoryContent));
        executeCommand(provider, callback);
    }
}
Also used : DirectoryContentProvider(com.intellij.cvsSupport2.cvsoperations.cvsContent.DirectoryContentProvider)

Aggregations

CvsOperationExecutor (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)1 DefaultCvsOperationExecutorCallback (com.intellij.cvsSupport2.cvsExecution.DefaultCvsOperationExecutorCallback)1 DirectoryContentProvider (com.intellij.cvsSupport2.cvsoperations.cvsContent.DirectoryContentProvider)1 List (java.util.List)1