use of com.intellij.vcs.log.CommitId in project intellij-community by JetBrains.
the class FileHistorySingleCommitAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
VcsLogUtil.triggerUsage(e);
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
FileHistoryUi ui = e.getRequiredData(VcsLogInternalDataKeys.FILE_HISTORY_UI);
List<CommitId> commits = ui.getVcsLog().getSelectedCommits();
if (commits.size() != 1)
return;
CommitId commit = notNull(getFirstItem(commits));
List<Integer> commitIndex = Ints.asList(ui.getLogData().getCommitIndex(commit.getHash(), commit.getRoot()));
ui.getLogData().getCommitDetailsGetter().loadCommitsData(commitIndex, details -> {
if (!details.isEmpty()) {
performAction(project, ui, notNull(getFirstItem(details)), e);
}
}, null);
}
use of com.intellij.vcs.log.CommitId in project intellij-community by JetBrains.
the class VcsLogSingleCommitAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
VcsLog log = e.getRequiredData(VcsLogDataKeys.VCS_LOG);
CommitId commit = ContainerUtil.getFirstItem(log.getSelectedCommits());
assert commit != null;
Repo repository = getRepositoryForRoot(project, commit.getRoot());
assert repository != null;
actionPerformed(repository, commit.getHash());
}
use of com.intellij.vcs.log.CommitId 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.CommitId in project intellij-community by JetBrains.
the class RefsModel method refsToCommit.
public Collection<VcsRef> refsToCommit(int index) {
CommitId id = myStorage.getCommitId(index);
if (id == null)
return Collections.emptyList();
VirtualFile root = id.getRoot();
return myRefs.get(root).refsToCommit(index);
}
use of com.intellij.vcs.log.CommitId in project intellij-community by JetBrains.
the class CreatePatchFromHistoryAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
Project project = e.getProject();
FileHistoryUi ui = e.getData(VcsLogInternalDataKeys.FILE_HISTORY_UI);
if (project == null || ui == null) {
e.getPresentation().setEnabledAndVisible(false);
return;
}
e.getPresentation().setVisible(true);
List<CommitId> selectedCommits = ui.getVcsLog().getSelectedCommits();
String commitMessage = e.getData(VcsDataKeys.PRESET_COMMIT_MESSAGE);
e.getPresentation().setEnabled(!selectedCommits.isEmpty() && commitMessage != null);
}
Aggregations