Search in sources :

Example 6 with CvsConnectionSettings

use of com.intellij.cvsSupport2.connections.CvsConnectionSettings in project intellij-community by JetBrains.

the class CvsRootOnFileSystem method createMeOn.

public static CvsRootOnFileSystem createMeOn(File file) throws CannotFindCvsRootException {
    File nearestRoot = getRootFor(file);
    if (nearestRoot == null)
        throw new CannotFindCvsRootException(file);
    CvsConnectionSettings cvsRoot = getCvsRootFor(nearestRoot);
    if (cvsRoot == CvsInfo.getAbsentSettings())
        throw new CannotFindCvsRootException(file);
    File commonRoot = getCommonRoot(nearestRoot, cvsRoot);
    return new CvsRootOnFileSystem(getCvsEntriesManager().getCvsConnectionSettingsFor(commonRoot), commonRoot);
}
Also used : File(java.io.File) CannotFindCvsRootException(com.intellij.cvsSupport2.errorHandling.CannotFindCvsRootException)

Example 7 with CvsConnectionSettings

use of com.intellij.cvsSupport2.connections.CvsConnectionSettings 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)

Example 8 with CvsConnectionSettings

use of com.intellij.cvsSupport2.connections.CvsConnectionSettings in project intellij-community by JetBrains.

the class ToggleOfflineAction method setSelected.

public void setSelected(AnActionEvent e, boolean state) {
    CvsContext cvsContext = CvsContextWrapper.createInstance(e);
    final CvsEntriesManager entriesManager = CvsEntriesManager.getInstance();
    final VirtualFile file = cvsContext.getSelectedFile();
    if (file == null)
        return;
    final VirtualFile firstDirInChain = file.isDirectory() ? file : file.getParent();
    if (firstDirInChain == null)
        return;
    CvsConnectionSettings settings = entriesManager.getCvsConnectionSettingsFor(firstDirInChain);
    if (!settings.isValid()) {
        entriesManager.clearCachedEntriesFor(firstDirInChain);
        settings = entriesManager.getCvsConnectionSettingsFor(firstDirInChain);
    }
    if ((settings != null) && settings.isValid() && (state != settings.isOffline())) {
        VcsBalloonProblemNotifier.showOverChangesView(cvsContext.getProject(), state ? CvsBundle.message("set.offline.notification.text") : CvsBundle.message("set.online.notification.text"), state ? MessageType.WARNING : MessageType.INFO);
        settings.setOffline(state);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CvsContext(com.intellij.cvsSupport2.actions.cvsContext.CvsContext) CvsEntriesManager(com.intellij.cvsSupport2.application.CvsEntriesManager) CvsConnectionSettings(com.intellij.cvsSupport2.connections.CvsConnectionSettings)

Example 9 with CvsConnectionSettings

use of com.intellij.cvsSupport2.connections.CvsConnectionSettings in project intellij-community by JetBrains.

the class ToggleOfflineAction method isSelected.

public boolean isSelected(AnActionEvent e) {
    CvsContext cvsContext = CvsContextWrapper.createInstance(e);
    if (!cvsContext.cvsIsActive())
        return false;
    VirtualFile root = cvsContext.getSelectedFile();
    if (root == null)
        return false;
    final VirtualFile firstDirInChain = root.isDirectory() ? root : root.getParent();
    if (firstDirInChain == null)
        return false;
    CvsConnectionSettings settings = CvsEntriesManager.getInstance().getCvsConnectionSettingsFor(firstDirInChain);
    if (settings == null)
        return false;
    return settings.isOffline();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CvsContext(com.intellij.cvsSupport2.actions.cvsContext.CvsContext) CvsConnectionSettings(com.intellij.cvsSupport2.connections.CvsConnectionSettings)

Aggregations

CvsConnectionSettings (com.intellij.cvsSupport2.connections.CvsConnectionSettings)8 File (java.io.File)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 CvsContext (com.intellij.cvsSupport2.actions.cvsContext.CvsContext)2 CvsEntriesManager (com.intellij.cvsSupport2.application.CvsEntriesManager)2 CvsRootConfiguration (com.intellij.cvsSupport2.config.CvsRootConfiguration)2 IDEARootFormatter (com.intellij.cvsSupport2.connections.IDEARootFormatter)2 SimpleRevision (com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision)2 FilePath (com.intellij.openapi.vcs.FilePath)2 CvsBinaryContentRevision (com.intellij.cvsSupport2.changeBrowser.CvsBinaryContentRevision)1 CvsContentRevision (com.intellij.cvsSupport2.changeBrowser.CvsContentRevision)1 CvsEnvironment (com.intellij.cvsSupport2.connections.CvsEnvironment)1 AnnotateOperation (com.intellij.cvsSupport2.cvsoperations.cvsAnnotate.AnnotateOperation)1 Annotation (com.intellij.cvsSupport2.cvsoperations.cvsAnnotate.Annotation)1 GetFileContentOperation (com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation)1 RevisionOrDate (com.intellij.cvsSupport2.cvsoperations.dateOrRevision.RevisionOrDate)1 CannotFindCvsRootException (com.intellij.cvsSupport2.errorHandling.CannotFindCvsRootException)1 ComparableVcsRevisionOnOperation (com.intellij.cvsSupport2.history.ComparableVcsRevisionOnOperation)1 CvsRevisionNumber (com.intellij.cvsSupport2.history.CvsRevisionNumber)1 FileAnnotation (com.intellij.openapi.vcs.annotate.FileAnnotation)1