Search in sources :

Example 1 with CvsLightweightFile

use of com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile in project intellij-community by JetBrains.

the class GetFileFromRepositoryAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    CvsLightweightFile[] cvsLightweightFiles = context.getSelectedLightweightFiles();
    Project project = context.getProject();
    if (cvsLightweightFiles != null) {
        boolean makeNewFilesReadOnly = project != null && CvsConfiguration.getInstance(project).MAKE_NEW_FILES_READONLY;
        return CommandCvsHandler.createGetFileFromRepositoryHandler(cvsLightweightFiles, makeNewFilesReadOnly);
    }
    final FilePath[] filePaths = context.getSelectedFilePaths();
    if (filePaths != null) {
        CvsConfiguration cvsConfiguration = CvsConfiguration.getInstance(project);
        // do not use -j's
        final UpdateSettingsOnCvsConfiguration updateSettings = new UpdateSettingsOnCvsConfiguration(cvsConfiguration, cvsConfiguration.CLEAN_COPY, cvsConfiguration.RESET_STICKY);
        return CommandCvsHandler.createUpdateHandler(filePaths, updateSettings, project, UpdatedFiles.create());
    }
    return CvsHandler.NULL;
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) Project(com.intellij.openapi.project.Project) CvsConfiguration(com.intellij.cvsSupport2.config.CvsConfiguration) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration) CvsLightweightFile(com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)

Example 2 with CvsLightweightFile

use of com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile in project intellij-community by JetBrains.

the class CommandCvsHandler method createGetFileFromRepositoryHandler.

public static CvsHandler createGetFileFromRepositoryHandler(CvsLightweightFile[] cvsLightweightFiles, boolean makeNewFilesReadOnly) {
    final CompositeOperation compositeOperation = new CompositeOperation();
    final CvsEntriesManager entriesManager = CvsEntriesManager.getInstance();
    for (CvsLightweightFile cvsLightweightFile : cvsLightweightFiles) {
        final File root = cvsLightweightFile.getRoot();
        File workingDirectory = root;
        if (workingDirectory == null)
            continue;
        if (cvsLightweightFile.getLocalFile().getParentFile().equals(workingDirectory)) {
            workingDirectory = workingDirectory.getParentFile();
        }
        final String alternativeCheckoutPath = getAlternativeCheckoutPath(cvsLightweightFile, workingDirectory);
        final CheckoutProjectOperation checkoutFileOperation = new CheckoutProjectOperation(new String[] { cvsLightweightFile.getModuleName() }, entriesManager.getCvsConnectionSettingsFor(root), makeNewFilesReadOnly, workingDirectory, alternativeCheckoutPath, true, null);
        compositeOperation.addOperation(checkoutFileOperation);
    }
    return new CommandCvsHandler(CvsBundle.message("action.name.get.file.from.repository"), compositeOperation, FileSetToBeUpdated.allFiles(), true);
}
Also used : CvsLightweightFile(com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile) CheckoutProjectOperation(com.intellij.cvsSupport2.cvsoperations.cvsCheckOut.CheckoutProjectOperation) CvsEntriesManager(com.intellij.cvsSupport2.application.CvsEntriesManager) VirtualFile(com.intellij.openapi.vfs.VirtualFile) CvsLightweightFile(com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile) File(java.io.File)

Example 3 with CvsLightweightFile

use of com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile in project intellij-community by JetBrains.

the class CvsAnnotationProvider method annotate.

public FileAnnotation annotate(VirtualFile virtualFile) throws VcsException {
    final File file = new File(virtualFile.getPath());
    final File cvsLightweightFile = CvsUtil.getCvsLightweightFileForFile(file);
    final String revision = CvsUtil.getRevisionFor(file);
    final CvsEntriesManager entriesManager = CvsEntriesManager.getInstance();
    final CvsConnectionSettings root = entriesManager.getCvsConnectionSettingsFor(file.getParentFile());
    final boolean binary = annotateBinary(virtualFile, root);
    final AnnotateOperation operation = executeOperation(cvsLightweightFile, revision, root, binary, true);
    final FilePath filePath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(virtualFile);
    final List<VcsFileRevision> revisions = myCvsHistoryProvider.createRevisions(filePath);
    final Annotation[] lineAnnotations = operation.getLineAnnotations();
    adjustAnnotation(revisions, lineAnnotations);
    return new CvsFileAnnotation(operation.getContent(), lineAnnotations, revisions, virtualFile, revision, myProject);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) CvsEntriesManager(com.intellij.cvsSupport2.application.CvsEntriesManager) CvsConnectionSettings(com.intellij.cvsSupport2.connections.CvsConnectionSettings) VcsFileRevision(com.intellij.openapi.vcs.history.VcsFileRevision) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) AnnotateOperation(com.intellij.cvsSupport2.cvsoperations.cvsAnnotate.AnnotateOperation) FileAnnotation(com.intellij.openapi.vcs.annotate.FileAnnotation) Annotation(com.intellij.cvsSupport2.cvsoperations.cvsAnnotate.Annotation)

Aggregations

CvsLightweightFile (com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile)2 CvsEntriesManager (com.intellij.cvsSupport2.application.CvsEntriesManager)2 FilePath (com.intellij.openapi.vcs.FilePath)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 File (java.io.File)2 UpdateSettingsOnCvsConfiguration (com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)1 CvsConfiguration (com.intellij.cvsSupport2.config.CvsConfiguration)1 CvsConnectionSettings (com.intellij.cvsSupport2.connections.CvsConnectionSettings)1 AnnotateOperation (com.intellij.cvsSupport2.cvsoperations.cvsAnnotate.AnnotateOperation)1 Annotation (com.intellij.cvsSupport2.cvsoperations.cvsAnnotate.Annotation)1 CheckoutProjectOperation (com.intellij.cvsSupport2.cvsoperations.cvsCheckOut.CheckoutProjectOperation)1 Project (com.intellij.openapi.project.Project)1 FileAnnotation (com.intellij.openapi.vcs.annotate.FileAnnotation)1 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)1