use of com.intellij.vcs.log.VcsLog in project intellij-community by JetBrains.
the class VcsLogSingleCommitAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
Project project = e.getProject();
VcsLog log = e.getData(VcsLogDataKeys.VCS_LOG);
if (project == null || log == null) {
e.getPresentation().setEnabledAndVisible(false);
return;
}
List<CommitId> commits = log.getSelectedCommits();
if (commits.isEmpty()) {
e.getPresentation().setEnabledAndVisible(false);
return;
}
CommitId commit = ContainerUtil.getFirstItem(commits);
assert commit != null;
Repo repository = getRepositoryForRoot(project, commit.getRoot());
if (repository == null) {
e.getPresentation().setEnabledAndVisible(false);
return;
}
e.getPresentation().setVisible(isVisible(project, repository, commit.getHash()));
e.getPresentation().setEnabled(commits.size() == 1 && isEnabled(repository, commit.getHash()));
}
use of com.intellij.vcs.log.VcsLog in project intellij-community by JetBrains.
the class GoToHashOrRefAction method update.
@Override
public void update(AnActionEvent e) {
VcsLog log = e.getData(VcsLogDataKeys.VCS_LOG);
VcsLogUi logUi = e.getData(VcsLogDataKeys.VCS_LOG_UI);
e.getPresentation().setEnabledAndVisible(e.getProject() != null && log != null && logUi != null && logUi instanceof AbstractVcsLogUi);
}
use of com.intellij.vcs.log.VcsLog in project intellij-community by JetBrains.
the class HgQGotoFromLogAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
VcsLog log = e.getRequiredData(VcsLogDataKeys.VCS_LOG);
log.requestSelectedDetails(new Consumer<List<VcsFullCommitDetails>>() {
@Override
public void consume(List<VcsFullCommitDetails> selectedDetails) {
VcsFullCommitDetails fullCommitDetails = ContainerUtil.getFirstItem(selectedDetails);
assert fullCommitDetails != null;
final HgRepository repository = getRepositoryForRoot(project, fullCommitDetails.getRoot());
assert repository != null;
actionPerformed(repository, fullCommitDetails);
}
}, null);
}
use of com.intellij.vcs.log.VcsLog in project intellij-community by JetBrains.
the class GithubOpenInBrowserAction method getDataFromLog.
@Nullable
private static CommitData getDataFromLog(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
VcsLog log = e.getData(VcsLogDataKeys.VCS_LOG);
if (project == null || log == null)
return null;
List<CommitId> selectedCommits = log.getSelectedCommits();
if (selectedCommits.size() != 1)
return null;
CommitId commit = ContainerUtil.getFirstItem(selectedCommits);
if (commit == null)
return null;
GitRepository repository = GitUtil.getRepositoryManager(project).getRepositoryForRoot(commit.getRoot());
if (repository == null || !GithubUtil.isRepositoryOnGitHub(repository))
return null;
return new CommitData(project, repository, commit.getHash().asString());
}
Aggregations