use of com.intellij.openapi.vcs.vfs.ContentRevisionVirtualFile in project intellij-community by JetBrains.
the class AnnotateVcsVirtualFileAction method extractData.
@Nullable
private static AnnotationData extractData(@NotNull Project project, @NotNull VirtualFile file) {
FilePath filePath = null;
VcsRevisionNumber revisionNumber = null;
if (file instanceof VcsVirtualFile) {
filePath = VcsUtil.getFilePath(file.getPath());
VcsFileRevision revision = ((VcsVirtualFile) file).getFileRevision();
revisionNumber = revision != null ? revision.getRevisionNumber() : null;
} else if (file instanceof ContentRevisionVirtualFile) {
ContentRevision revision = ((ContentRevisionVirtualFile) file).getContentRevision();
filePath = revision.getFile();
revisionNumber = revision.getRevisionNumber();
}
if (filePath == null || revisionNumber == null)
return null;
AbstractVcs vcs = VcsUtil.getVcsFor(project, filePath);
return vcs != null ? new AnnotationData(vcs, filePath, revisionNumber) : null;
}
Aggregations