Search in sources :

Example 1 with AbstractVcsLogUi

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

the class VcsLogContentProvider method findAndSelectContent.

public static <U extends AbstractVcsLogUi> boolean findAndSelectContent(@NotNull Project project, @NotNull Class<U> clazz, @NotNull Condition<U> condition) {
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
    ContentManager manager = toolWindow.getContentManager();
    JComponent component = ContentUtilEx.findContentComponent(manager, c -> {
        if (c instanceof VcsLogPanel) {
            AbstractVcsLogUi ui = ((VcsLogPanel) c).getUi();
            return clazz.isInstance(ui) && condition.value((U) ui);
        }
        return false;
    });
    if (component == null)
        return false;
    if (!toolWindow.isVisible())
        toolWindow.activate(null);
    return ContentUtilEx.selectContent(manager, component, true);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) ContentManager(com.intellij.ui.content.ContentManager) VcsLogPanel(com.intellij.vcs.log.ui.VcsLogPanel)

Example 2 with AbstractVcsLogUi

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

the class GoToHashOrRefAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    VcsLogUtil.triggerUsage(e);
    Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    VcsLog log = e.getRequiredData(VcsLogDataKeys.VCS_LOG);
    VcsLogUi ui = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
    assert ui instanceof AbstractVcsLogUi;
    AbstractVcsLogUi logUi = (AbstractVcsLogUi) ui;
    Set<VirtualFile> visibleRoots = VcsLogUtil.getVisibleRoots(logUi);
    GoToHashOrRefPopup popup = new GoToHashOrRefPopup(project, logUi.getDataPack().getRefs(), visibleRoots, log::jumpToReference, vcsRef -> logUi.jumpToCommit(vcsRef.getCommitHash(), vcsRef.getRoot()), logUi.getColorManager(), new VcsGoToRefComparator(logUi.getDataPack().getLogProviders()));
    popup.show(logUi.getTable());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) VcsGoToRefComparator(com.intellij.vcs.log.impl.VcsGoToRefComparator) VcsLog(com.intellij.vcs.log.VcsLog) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) VcsLogUi(com.intellij.vcs.log.VcsLogUi)

Example 3 with AbstractVcsLogUi

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

the class RefreshLogAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    VcsLogUtil.triggerUsage(e);
    VcsLogManager logManager = e.getRequiredData(VcsLogInternalDataKeys.LOG_MANAGER);
    // diagnostic for possible refresh problems
    VcsLogUi ui = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
    if (ui instanceof AbstractVcsLogUi) {
        VisiblePackRefresher refresher = ((AbstractVcsLogUi) ui).getRefresher();
        if (!refresher.isValid()) {
            String message = "Trying to refresh invalid log tab.";
            if (!logManager.getDataManager().getProgress().isRunning()) {
                LOG.error(message);
            } else {
                LOG.warn(message);
            }
            refresher.setValid(true);
        }
    }
    logManager.getDataManager().refreshSoftly(VcsLogUtil.getVisibleRoots(ui));
}
Also used : VisiblePackRefresher(com.intellij.vcs.log.visible.VisiblePackRefresher) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) VcsLogManager(com.intellij.vcs.log.impl.VcsLogManager) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) VcsLogUi(com.intellij.vcs.log.VcsLogUi)

Example 4 with AbstractVcsLogUi

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

the class ShowCommitTooltipAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    VcsLogUi ui = e.getData(VcsLogDataKeys.VCS_LOG_UI);
    if (project == null || ui == null) {
        e.getPresentation().setEnabledAndVisible(false);
    } else {
        e.getPresentation().setEnabledAndVisible(ui instanceof AbstractVcsLogUi && ((AbstractVcsLogUi) ui).getTable().getSelectedRowCount() == 1);
    }
}
Also used : Project(com.intellij.openapi.project.Project) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) VcsLogUi(com.intellij.vcs.log.VcsLogUi)

Example 5 with AbstractVcsLogUi

use of com.intellij.vcs.log.ui.AbstractVcsLogUi 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);
}
Also used : VcsLog(com.intellij.vcs.log.VcsLog) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) AbstractVcsLogUi(com.intellij.vcs.log.ui.AbstractVcsLogUi) VcsLogUi(com.intellij.vcs.log.VcsLogUi)

Aggregations

AbstractVcsLogUi (com.intellij.vcs.log.ui.AbstractVcsLogUi)6 VcsLogUi (com.intellij.vcs.log.VcsLogUi)4 Project (com.intellij.openapi.project.Project)2 VcsLog (com.intellij.vcs.log.VcsLog)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ToolWindow (com.intellij.openapi.wm.ToolWindow)1 ContentManager (com.intellij.ui.content.ContentManager)1 VcsGoToRefComparator (com.intellij.vcs.log.impl.VcsGoToRefComparator)1 VcsLogManager (com.intellij.vcs.log.impl.VcsLogManager)1 VcsLogPanel (com.intellij.vcs.log.ui.VcsLogPanel)1 VcsLogGraphTable (com.intellij.vcs.log.ui.table.VcsLogGraphTable)1 VisiblePackRefresher (com.intellij.vcs.log.visible.VisiblePackRefresher)1