Search in sources :

Example 6 with VcsLogUi

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

the class CollapseOrExpandGraphAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    VcsLogUi ui = e.getData(VcsLogDataKeys.VCS_LOG_UI);
    VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
    if (ui != null && ui.areGraphActionsEnabled() && properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE)) {
        e.getPresentation().setEnabled(true);
        if (!ui.getFilterUi().getFilters().getDetailsFilters().isEmpty()) {
            e.getPresentation().setEnabled(false);
        }
        if (properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE) == PermanentGraph.SortType.LinearBek) {
            e.getPresentation().setText(getPrefix() + MERGES);
            e.getPresentation().setDescription(getPrefix() + MERGES_DESCRIPTION);
        } else {
            e.getPresentation().setText(getPrefix() + LINEAR_BRANCHES);
            e.getPresentation().setDescription(getPrefix() + LINEAR_BRANCHES_DESCRIPTION);
        }
    } else {
        e.getPresentation().setEnabled(false);
    }
    e.getPresentation().setText(getPrefix() + LINEAR_BRANCHES);
    e.getPresentation().setDescription(getPrefix() + LINEAR_BRANCHES_DESCRIPTION);
    if (isIconHidden(e)) {
        e.getPresentation().setIcon(null);
    } else {
        e.getPresentation().setIcon(properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE) && properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE) == PermanentGraph.SortType.LinearBek ? getMergesIcon() : getBranchesIcon());
    }
}
Also used : MainVcsLogUiProperties(com.intellij.vcs.log.impl.MainVcsLogUiProperties) VcsLogUiProperties(com.intellij.vcs.log.impl.VcsLogUiProperties) VcsLogUi(com.intellij.vcs.log.VcsLogUi)

Example 7 with VcsLogUi

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

the class FocusTextFilterAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    VcsLogUi ui = e.getData(VcsLogDataKeys.VCS_LOG_UI);
    e.getPresentation().setEnabledAndVisible(project != null && ui != null && ui instanceof VcsLogUiImpl);
}
Also used : Project(com.intellij.openapi.project.Project) VcsLogUiImpl(com.intellij.vcs.log.ui.VcsLogUiImpl) VcsLogUi(com.intellij.vcs.log.VcsLogUi)

Example 8 with VcsLogUi

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

the class CollapseOrExpandGraphAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    VcsLogUtil.triggerUsage(e);
    VcsLogUi ui = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
    executeAction((VcsLogUiImpl) ui);
}
Also used : VcsLogUi(com.intellij.vcs.log.VcsLogUi)

Example 9 with VcsLogUi

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

the class EnableMatchCaseAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    super.update(e);
    VcsLogUi ui = e.getData(VcsLogDataKeys.VCS_LOG_UI);
    VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
    if (ui != null && properties != null && properties.exists(MainVcsLogUiProperties.TEXT_FILTER_MATCH_CASE)) {
        boolean regexEnabled = properties.exists(MainVcsLogUiProperties.TEXT_FILTER_REGEX) && properties.get(MainVcsLogUiProperties.TEXT_FILTER_REGEX);
        if (!regexEnabled) {
            e.getPresentation().setText(MATCH_CASE);
        } else {
            Collection<VcsLogProvider> providers = ContainerUtil.newLinkedHashSet(ui.getDataPack().getLogProviders().values());
            List<VcsLogProvider> supported = ContainerUtil.filter(providers, p -> VcsLogProperties.get(p, VcsLogProperties.CASE_INSENSITIVE_REGEX));
            e.getPresentation().setVisible(true);
            e.getPresentation().setEnabled(!supported.isEmpty());
            if (providers.size() == supported.size() || supported.isEmpty()) {
                e.getPresentation().setText(MATCH_CASE);
            } else {
                String supportedText = StringUtil.join(ContainerUtil.map(supported, p -> p.getSupportedVcs().getName().toLowerCase()), ", ");
                e.getPresentation().setText(MATCH_CASE + " (" + supportedText + " only)");
            }
        }
    }
}
Also used : VcsLogDataKeys(com.intellij.vcs.log.VcsLogDataKeys) VcsLogProperties(com.intellij.vcs.log.VcsLogProperties) VcsLogInternalDataKeys(com.intellij.vcs.log.ui.VcsLogInternalDataKeys) StringUtil(com.intellij.openapi.util.text.StringUtil) Collection(java.util.Collection) VcsLogProvider(com.intellij.vcs.log.VcsLogProvider) MainVcsLogUiProperties(com.intellij.vcs.log.impl.MainVcsLogUiProperties) ContainerUtil(com.intellij.util.containers.ContainerUtil) List(java.util.List) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) VcsLogUiProperties(com.intellij.vcs.log.impl.VcsLogUiProperties) VcsLogUi(com.intellij.vcs.log.VcsLogUi) NotNull(org.jetbrains.annotations.NotNull) VcsLogProvider(com.intellij.vcs.log.VcsLogProvider) MainVcsLogUiProperties(com.intellij.vcs.log.impl.MainVcsLogUiProperties) VcsLogUiProperties(com.intellij.vcs.log.impl.VcsLogUiProperties) VcsLogUi(com.intellij.vcs.log.VcsLogUi)

Example 10 with VcsLogUi

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

the class VcsLogActionPromoter method promote.

@Override
public List<AnAction> promote(@NotNull List<AnAction> actions, @NotNull DataContext context) {
    List<AnAction> promoted = ContainerUtil.newArrayList();
    VcsLogUi ui = VcsLogDataKeys.VCS_LOG_UI.getData(context);
    if (ui != null && ui instanceof FileHistoryUi) {
        CompareRevisionsFromHistoryAction compareAction = ContainerUtil.findInstance(actions, CompareRevisionsFromHistoryAction.class);
        if (compareAction != null)
            promoted.add(compareAction);
    }
    return promoted;
}
Also used : VcsLogUi(com.intellij.vcs.log.VcsLogUi) FileHistoryUi(com.intellij.vcs.log.history.FileHistoryUi) CompareRevisionsFromHistoryAction(com.intellij.vcs.log.ui.actions.history.CompareRevisionsFromHistoryAction) AnAction(com.intellij.openapi.actionSystem.AnAction)

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