Search in sources :

Example 1 with VcsShortCommitDetails

use of com.intellij.vcs.log.VcsShortCommitDetails in project intellij-community by JetBrains.

the class GraphTableController method getArrowTooltipText.

@NotNull
private String getArrowTooltipText(int commit, @Nullable Integer row) {
    VcsShortCommitDetails details;
    if (row != null && row >= 0) {
        // preload rows around the commit
        details = myTable.getModel().getShortDetails(row);
    } else {
        // preload just the commit
        details = myLogData.getMiniDetailsGetter().getCommitData(commit, Collections.singleton(commit));
    }
    String balloonText = "";
    if (details instanceof LoadingDetails) {
        CommitId commitId = myLogData.getCommitId(commit);
        if (commitId != null) {
            balloonText = "Jump to commit" + " " + commitId.getHash().toShortString();
            if (myUi.isMultipleRoots()) {
                balloonText += " in " + commitId.getRoot().getName();
            }
        }
    } else {
        balloonText = "Jump to <b>\"" + StringUtil.shortenTextWithEllipsis(details.getSubject(), 50, 0, "...") + "\"</b> by " + VcsUserUtil.getShortPresentation(details.getAuthor()) + CommitPanel.formatDateTime(details.getAuthorTime());
    }
    return balloonText;
}
Also used : VcsShortCommitDetails(com.intellij.vcs.log.VcsShortCommitDetails) CommitId(com.intellij.vcs.log.CommitId) LoadingDetails(com.intellij.vcs.log.data.LoadingDetails) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with VcsShortCommitDetails

use of com.intellij.vcs.log.VcsShortCommitDetails in project intellij-community by JetBrains.

the class VcsLogGraphTable method getStyle.

private VcsLogHighlighter.VcsCommitStyle getStyle(int row, int column, boolean hasFocus, boolean selected) {
    VcsLogHighlighter.VcsCommitStyle baseStyle = getBaseStyle(row, column, hasFocus, selected);
    VisibleGraph<Integer> visibleGraph = getVisibleGraph();
    if (row < 0 || row >= visibleGraph.getVisibleCommitCount()) {
        LOG.error("Visible graph has " + visibleGraph.getVisibleCommitCount() + " commits, yet we want row " + row);
        return baseStyle;
    }
    RowInfo<Integer> rowInfo = visibleGraph.getRowInfo(row);
    VcsLogHighlighter.VcsCommitStyle defaultStyle = VcsCommitStyleFactory.createStyle(rowInfo.getRowType() == RowType.UNMATCHED ? JBColor.GRAY : baseStyle.getForeground(), baseStyle.getBackground(), VcsLogHighlighter.TextStyle.NORMAL);
    final VcsShortCommitDetails details = myLogData.getMiniDetailsGetter().getCommitDataIfAvailable(rowInfo.getCommit());
    if (details == null)
        return defaultStyle;
    List<VcsLogHighlighter.VcsCommitStyle> styles = ContainerUtil.map(myHighlighters, highlighter -> highlighter.getStyle(details, selected));
    return VcsCommitStyleFactory.combine(ContainerUtil.append(styles, defaultStyle));
}
Also used : VcsShortCommitDetails(com.intellij.vcs.log.VcsShortCommitDetails) VcsLogHighlighter(com.intellij.vcs.log.VcsLogHighlighter)

Aggregations

VcsShortCommitDetails (com.intellij.vcs.log.VcsShortCommitDetails)2 CommitId (com.intellij.vcs.log.CommitId)1 VcsLogHighlighter (com.intellij.vcs.log.VcsLogHighlighter)1 LoadingDetails (com.intellij.vcs.log.data.LoadingDetails)1 NotNull (org.jetbrains.annotations.NotNull)1