use of com.intellij.openapi.vcs.history.VcsFileRevision in project intellij-community by JetBrains.
the class FileAnnotation method createDefaultCurrentFileRevisionProvider.
@Nullable
private static CurrentFileRevisionProvider createDefaultCurrentFileRevisionProvider(@NotNull FileAnnotation annotation) {
List<VcsFileRevision> revisions = annotation.getRevisions();
if (revisions == null)
return null;
Map<VcsRevisionNumber, VcsFileRevision> map = new HashMap<>();
for (VcsFileRevision revision : revisions) {
map.put(revision.getRevisionNumber(), revision);
}
List<VcsFileRevision> lineToRevision = new ArrayList<>(annotation.getLineCount());
for (int i = 0; i < annotation.getLineCount(); i++) {
lineToRevision.add(map.get(annotation.getLineRevisionNumber(i)));
}
return (lineNumber) -> {
LOG.assertTrue(lineNumber >= 0 && lineNumber < lineToRevision.size());
return lineToRevision.get(lineNumber);
};
}
use of com.intellij.openapi.vcs.history.VcsFileRevision in project intellij-community by JetBrains.
the class AnnotateRevisionAction method getFileRevision.
@Nullable
@Override
protected VcsFileRevision getFileRevision(@NotNull AnActionEvent e) {
VcsHistorySession historySession = e.getData(VcsDataKeys.HISTORY_SESSION);
if (historySession == null)
return null;
VcsFileRevision revision = e.getData(VcsDataKeys.VCS_FILE_REVISION);
if (!historySession.isContentAvailable(revision))
return null;
return revision;
}
use of com.intellij.openapi.vcs.history.VcsFileRevision in project intellij-community by JetBrains.
the class GetVersionAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
FilePath filePath = e.getData(VcsDataKeys.FILE_PATH);
VcsFileRevision revision = e.getData(VcsDataKeys.VCS_FILE_REVISION);
if (e.getProject() == null || filePath == null || revision == null) {
e.getPresentation().setEnabledAndVisible(false);
} else {
e.getPresentation().setEnabledAndVisible(isContentAvailable(filePath, revision, e));
}
}
use of com.intellij.openapi.vcs.history.VcsFileRevision in project intellij-community by JetBrains.
the class GetVersionAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
if (ChangeListManager.getInstance(project).isFreezedWithNotification(null))
return;
VcsFileRevision revision = e.getRequiredData(VcsDataKeys.VCS_FILE_REVISION);
FilePath filePath = e.getRequiredData(VcsDataKeys.FILE_PATH);
doGet(project, revision, filePath);
}
use of com.intellij.openapi.vcs.history.VcsFileRevision in project intellij-community by JetBrains.
the class ShowDiffWithLocalFromHistoryAction method performAction.
@Override
protected void performAction(@NotNull Project project, @NotNull FileHistoryUi ui, @NotNull VcsFullCommitDetails detail, @NotNull AnActionEvent e) {
if (ChangeListManager.getInstance(project).isFreezedWithNotification(null))
return;
FilePath path = e.getRequiredData(VcsDataKeys.FILE_PATH);
VcsFileRevision revision = ui.createRevision(detail);
if (revision != null) {
StandardDiffFromHistoryHandler handler = new StandardDiffFromHistoryHandler();
handler.showDiffForTwo(project, path, revision, new CurrentRevision(notNull(path.getVirtualFile()), VcsRevisionNumber.NULL));
}
}
Aggregations