Vcs related problem

Answered

I try to get VcsVirtuaFile like the AnnotateVcsVirtualFileAction.extractData does. But it shows me the file is not instance of VcsVirtualFile or ContentRevisionVirtualFile. Do I miss something? Thank you.

0
3 comments

Do you need to create a new file or get an existing one from context?
What should it do?

0

An existing one. The file passed to the extractData is not a VcsVirtualFile. I want to extend the Annotate view of the Git plugin. So I try to implement it as the original one does. But I get the VirtualFile from the event is not a VcsVirtualFile. Do I miss something? Thank you.

Project project = e.getData(CommonDataKeys.PROJECT);
if (project == null || project.isDisposed()) return false;

VirtualFile[] selectedFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
if (selectedFiles == null || selectedFiles.length != 1) return false;

VirtualFile file = selectedFiles[0];
if (file.isDirectory() || file.getFileType().isBinary()) return false;

if (getEditors(project, file, e.getDataContext()).isEmpty()) return false;

AnnotationData data = extractData(project, file);
0

Thank you. I see. What I'm looking for is the AnnotateLocalFileAction instead of AnnotateVcsVirtualFileAction.

0

Please sign in to leave a comment.