Search in sources :

Example 1 with VcsLogUi

use of com.intellij.vcs.log.VcsLogUi 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 2 with VcsLogUi

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

the class IntelliSortChooserPopupAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    VcsLogUi logUI = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
    VcsLogUiProperties properties = e.getRequiredData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
    ActionGroup settingsGroup = new DefaultActionGroup(ContainerUtil.map(PermanentGraph.SortType.values(), (Function<PermanentGraph.SortType, AnAction>) sortType -> new SelectIntelliSortTypeAction(logUI, properties, sortType)));
    ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, settingsGroup, e.getDataContext(), JBPopupFactory.ActionSelectionAid.MNEMONICS, true, ToolWindowContentUi.POPUP_PLACE);
    Component component = e.getInputEvent().getComponent();
    if (component instanceof ActionButtonComponent) {
        popup.showUnderneathOf(component);
    } else {
        popup.showInCenterOf(component);
    }
}
Also used : Function(com.intellij.util.Function) MainVcsLogUiProperties(com.intellij.vcs.log.impl.MainVcsLogUiProperties) VcsLogUiProperties(com.intellij.vcs.log.impl.VcsLogUiProperties) ListPopup(com.intellij.openapi.ui.popup.ListPopup) VcsLogUi(com.intellij.vcs.log.VcsLogUi) PermanentGraph(com.intellij.vcs.log.graph.PermanentGraph)

Example 3 with VcsLogUi

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

the class IntelliSortChooserToggleAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    super.update(e);
    VcsLogUi logUI = e.getData(VcsLogDataKeys.VCS_LOG_UI);
    VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
    e.getPresentation().setVisible(BekUtil.isBekEnabled());
    e.getPresentation().setEnabled(BekUtil.isBekEnabled() && logUI != null);
    if (properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE)) {
        boolean off = properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE) == PermanentGraph.SortType.Normal;
        String description = "Turn IntelliSort " + (off ? "on" : "off") + ": " + (off ? PermanentGraph.SortType.Bek.getDescription().toLowerCase() : PermanentGraph.SortType.Normal.getDescription().toLowerCase()) + ".";
        e.getPresentation().setDescription(description);
        e.getPresentation().setText(description);
    } else {
        e.getPresentation().setText(DEFAULT_TEXT);
        e.getPresentation().setDescription(DEFAULT_DESCRIPTION);
    }
}
Also used : VcsLogUiProperties(com.intellij.vcs.log.impl.VcsLogUiProperties) MainVcsLogUiProperties(com.intellij.vcs.log.impl.MainVcsLogUiProperties) VcsLogUi(com.intellij.vcs.log.VcsLogUi)

Example 4 with VcsLogUi

use of com.intellij.vcs.log.VcsLogUi 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 5 with VcsLogUi

use of com.intellij.vcs.log.VcsLogUi 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)

Aggregations

VcsLogUi (com.intellij.vcs.log.VcsLogUi)14 Project (com.intellij.openapi.project.Project)4 MainVcsLogUiProperties (com.intellij.vcs.log.impl.MainVcsLogUiProperties)4 VcsLogUiProperties (com.intellij.vcs.log.impl.VcsLogUiProperties)4 AbstractVcsLogUi (com.intellij.vcs.log.ui.AbstractVcsLogUi)4 VcsLog (com.intellij.vcs.log.VcsLog)2 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 ListPopup (com.intellij.openapi.ui.popup.ListPopup)1 StringUtil (com.intellij.openapi.util.text.StringUtil)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Function (com.intellij.util.Function)1 ContainerUtil (com.intellij.util.containers.ContainerUtil)1 VcsLogDataKeys (com.intellij.vcs.log.VcsLogDataKeys)1 VcsLogProperties (com.intellij.vcs.log.VcsLogProperties)1 VcsLogProvider (com.intellij.vcs.log.VcsLogProvider)1 PermanentGraph (com.intellij.vcs.log.graph.PermanentGraph)1 FileHistoryUi (com.intellij.vcs.log.history.FileHistoryUi)1 VcsGoToRefComparator (com.intellij.vcs.log.impl.VcsGoToRefComparator)1 VcsLogManager (com.intellij.vcs.log.impl.VcsLogManager)1