use of com.intellij.openapi.vcs.history.VcsHistoryProviderBackgroundableProxy in project intellij-community by JetBrains.
the class SelectedBlockHistoryAction method actionPerformed.
public void actionPerformed(@NotNull final VcsContext context) {
try {
final Project project = context.getProject();
assert project != null;
final VcsSelection selection = VcsSelectionUtil.getSelection(context);
assert selection != null;
final VirtualFile file = FileDocumentManager.getInstance().getFile(selection.getDocument());
assert file != null;
final AbstractVcs activeVcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(file);
assert activeVcs != null;
final VcsHistoryProvider provider = activeVcs.getVcsBlockHistoryProvider();
assert provider != null;
final int selectionStart = selection.getSelectionStartLineNumber();
final int selectionEnd = selection.getSelectionEndLineNumber();
new VcsHistoryProviderBackgroundableProxy(activeVcs, provider, activeVcs.getDiffProvider()).createSessionFor(activeVcs.getKeyInstanceMethod(), VcsUtil.getFilePath(file), new Consumer<VcsHistorySession>() {
public void consume(VcsHistorySession session) {
if (session == null)
return;
final VcsSelectionHistoryDialog vcsHistoryDialog = new VcsSelectionHistoryDialog(project, file, selection.getDocument(), provider, session, activeVcs, Math.min(selectionStart, selectionEnd), Math.max(selectionStart, selectionEnd), selection.getDialogTitle());
vcsHistoryDialog.show();
}
}, VcsBackgroundableActions.HISTORY_FOR_SELECTION, false, null);
} catch (Exception exception) {
reportError(exception);
}
}
Aggregations