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();
}
});
}
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();
}
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();
}
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;
}
}
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();
}
Aggregations