Search in sources :

Example 1 with LoadingDetails

use of com.intellij.vcs.log.data.LoadingDetails 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 LoadingDetails

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

the class CommitPanel method setCommit.

public void setCommit(@NotNull VcsFullCommitDetails commitData) {
    if (!Comparing.equal(myCommit, commitData)) {
        if (commitData instanceof LoadingDetails) {
            myDataPanel.setData(null);
            myRootPanel.setRoot("", null);
        } else {
            myDataPanel.setData(commitData);
            VirtualFile root = commitData.getRoot();
            if (myColorManager.isMultipleRoots()) {
                myRootPanel.setRoot(root.getName(), VcsLogGraphTable.getRootBackgroundColor(root, myColorManager));
            } else {
                myRootPanel.setRoot("", null);
            }
        }
        myCommit = commitData;
    }
    List<String> branches = null;
    if (!(commitData instanceof LoadingDetails)) {
        branches = myLogData.getContainingBranchesGetter().requestContainingBranches(commitData.getRoot(), commitData.getId());
    }
    myContainingBranchesPanel.setBranches(branches);
    myDataPanel.update();
    myContainingBranchesPanel.update();
    revalidate();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LoadingDetails(com.intellij.vcs.log.data.LoadingDetails)

Example 3 with LoadingDetails

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

the class FileHistorySingleCommitAction 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<VcsFullCommitDetails> details = ui.getVcsLog().getSelectedDetails();
    if (details.isEmpty()) {
        e.getPresentation().setEnabled(false);
        return;
    }
    VcsFullCommitDetails detail = getFirstItem(details);
    if (detail instanceof LoadingDetails)
        detail = null;
    e.getPresentation().setEnabled(details.size() == 1 && isEnabled(ui, detail, e));
}
Also used : Project(com.intellij.openapi.project.Project) LoadingDetails(com.intellij.vcs.log.data.LoadingDetails) FileHistoryUi(com.intellij.vcs.log.history.FileHistoryUi) VcsFullCommitDetails(com.intellij.vcs.log.VcsFullCommitDetails)

Example 4 with LoadingDetails

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

the class CompareRevisionsFromHistoryAction method update.

public void update(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    FileHistoryUi ui = e.getData(VcsLogInternalDataKeys.FILE_HISTORY_UI);
    FilePath filePath = e.getData(VcsDataKeys.FILE_PATH);
    if (project == null || ui == null || filePath == null) {
        e.getPresentation().setEnabledAndVisible(false);
        return;
    }
    e.getPresentation().setVisible(true);
    List<VcsFullCommitDetails> details = ui.getVcsLog().getSelectedDetails();
    if (e.getInputEvent() instanceof KeyEvent) {
        e.getPresentation().setEnabled(true);
    } else {
        if (details.size() == 2) {
            VcsFullCommitDetails detail0 = details.get(0);
            VcsFullCommitDetails detail1 = details.get(1);
            if (detail0 != null && !(detail0 instanceof LoadingDetails) && detail1 != null && !(detail1 instanceof LoadingDetails)) {
                VcsFileRevision newestRevision = ui.createRevision(detail0);
                VcsFileRevision olderRevision = ui.createRevision(detail1);
                e.getPresentation().setEnabled(newestRevision != null && olderRevision != null && !filePath.isDirectory());
            } else {
                e.getPresentation().setEnabled(!filePath.isDirectory());
            }
        } else {
            e.getPresentation().setEnabled(details.size() == 1);
        }
    }
    if (details.size() == 2) {
        e.getPresentation().setText(COMPARE_TEXT);
        e.getPresentation().setDescription(COMPARE_DESCRIPTION);
    } else {
        e.getPresentation().setText(DIFF_TEXT);
        e.getPresentation().setDescription(DIFF_DESCRIPTION);
    }
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) KeyEvent(java.awt.event.KeyEvent) Project(com.intellij.openapi.project.Project) LoadingDetails(com.intellij.vcs.log.data.LoadingDetails) FileHistoryUi(com.intellij.vcs.log.history.FileHistoryUi) VcsFileRevision(com.intellij.openapi.vcs.history.VcsFileRevision) VcsFullCommitDetails(com.intellij.vcs.log.VcsFullCommitDetails)

Aggregations

LoadingDetails (com.intellij.vcs.log.data.LoadingDetails)4 Project (com.intellij.openapi.project.Project)2 VcsFullCommitDetails (com.intellij.vcs.log.VcsFullCommitDetails)2 FileHistoryUi (com.intellij.vcs.log.history.FileHistoryUi)2 FilePath (com.intellij.openapi.vcs.FilePath)1 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 CommitId (com.intellij.vcs.log.CommitId)1 VcsShortCommitDetails (com.intellij.vcs.log.VcsShortCommitDetails)1 KeyEvent (java.awt.event.KeyEvent)1 NotNull (org.jetbrains.annotations.NotNull)1