Search in sources :

Example 1 with CvsMergeProvider

use of com.intellij.cvsSupport2.actions.merge.CvsMergeProvider 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

CvsMergeProvider (com.intellij.cvsSupport2.actions.merge.CvsMergeProvider)1 CvsOperationExecutor (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)1 CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)1 CvsHandler (com.intellij.cvsSupport2.cvshandlers.CvsHandler)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1