Search in sources :

Example 1 with VcsFileRevisionEx

use of com.intellij.openapi.vcs.history.VcsFileRevisionEx in project intellij-community by JetBrains.

the class AnnotateRevisionAction method getFile.

@Nullable
@Override
protected VirtualFile getFile(@NotNull AnActionEvent e) {
    VcsFileRevision revision = getFileRevision(e);
    if (revision == null)
        return null;
    final FileType currentFileType = myAnnotation.getFile().getFileType();
    FilePath filePath = (revision instanceof VcsFileRevisionEx ? ((VcsFileRevisionEx) revision).getPath() : VcsUtil.getFilePath(myAnnotation.getFile()));
    return new VcsVirtualFile(filePath.getPath(), revision, VcsFileSystem.getInstance()) {

        @NotNull
        @Override
        public FileType getFileType() {
            FileType type = super.getFileType();
            if (!type.isBinary())
                return type;
            if (!currentFileType.isBinary())
                return currentFileType;
            return PlainTextFileType.INSTANCE;
        }
    };
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) VcsFileRevisionEx(com.intellij.openapi.vcs.history.VcsFileRevisionEx) VcsVirtualFile(com.intellij.openapi.vcs.vfs.VcsVirtualFile) PlainTextFileType(com.intellij.openapi.fileTypes.PlainTextFileType) FileType(com.intellij.openapi.fileTypes.FileType) VcsFileRevision(com.intellij.openapi.vcs.history.VcsFileRevision) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

FileType (com.intellij.openapi.fileTypes.FileType)1 PlainTextFileType (com.intellij.openapi.fileTypes.PlainTextFileType)1 FilePath (com.intellij.openapi.vcs.FilePath)1 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)1 VcsFileRevisionEx (com.intellij.openapi.vcs.history.VcsFileRevisionEx)1 VcsVirtualFile (com.intellij.openapi.vcs.vfs.VcsVirtualFile)1 Nullable (org.jetbrains.annotations.Nullable)1