Search in sources :

Example 1 with RevisionSelector

use of com.intellij.openapi.vcs.diff.RevisionSelector in project intellij-community by JetBrains.

the class SelectAndCompareWithSelectedRevisionAction method actionPerformed.

@Override
protected void actionPerformed(@NotNull VcsContext vcsContext) {
    final VirtualFile file = vcsContext.getSelectedFiles()[0];
    final Project project = vcsContext.getProject();
    final AbstractVcs vcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(file);
    if (vcs == null) {
        return;
    }
    RevisionSelector selector = vcs.getRevisionSelector();
    final DiffProvider diffProvider = vcs.getDiffProvider();
    if (selector != null) {
        final VcsRevisionNumber vcsRevisionNumber = selector.selectNumber(file);
        if (vcsRevisionNumber != null) {
            DiffActionExecutor.showDiff(diffProvider, vcsRevisionNumber, file, project, VcsBackgroundableActions.COMPARE_WITH);
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) DiffProvider(com.intellij.openapi.vcs.diff.DiffProvider) RevisionSelector(com.intellij.openapi.vcs.diff.RevisionSelector) VcsRevisionNumber(com.intellij.openapi.vcs.history.VcsRevisionNumber) AbstractVcs(com.intellij.openapi.vcs.AbstractVcs)

Aggregations

Project (com.intellij.openapi.project.Project)1 AbstractVcs (com.intellij.openapi.vcs.AbstractVcs)1 DiffProvider (com.intellij.openapi.vcs.diff.DiffProvider)1 RevisionSelector (com.intellij.openapi.vcs.diff.RevisionSelector)1 VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1