Search in sources :

Example 6 with VcsLogUiProperties

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

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

the class IntelliSortChooserPopupAction method update.

@Override
public void update(AnActionEvent e) {
    super.update(e);
    VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
    e.getPresentation().setEnabled(properties != null);
    if (properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE)) {
        String description = "IntelliSort: " + properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE).getName();
        e.getPresentation().setDescription(description);
        e.getPresentation().setText(description);
    }
}
Also used : MainVcsLogUiProperties(com.intellij.vcs.log.impl.MainVcsLogUiProperties) VcsLogUiProperties(com.intellij.vcs.log.impl.VcsLogUiProperties)

Example 8 with VcsLogUiProperties

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

the class IntelliSortChooserToggleAction method setSelected.

@Override
public void setSelected(AnActionEvent e, boolean state) {
    VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
    if (properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE)) {
        PermanentGraph.SortType bekSortType = state ? PermanentGraph.SortType.Bek : PermanentGraph.SortType.Normal;
        properties.set(MainVcsLogUiProperties.BEK_SORT_TYPE, bekSortType);
    }
}
Also used : VcsLogUiProperties(com.intellij.vcs.log.impl.VcsLogUiProperties) MainVcsLogUiProperties(com.intellij.vcs.log.impl.MainVcsLogUiProperties) PermanentGraph(com.intellij.vcs.log.graph.PermanentGraph)

Aggregations

VcsLogUiProperties (com.intellij.vcs.log.impl.VcsLogUiProperties)8 MainVcsLogUiProperties (com.intellij.vcs.log.impl.MainVcsLogUiProperties)7 VcsLogUi (com.intellij.vcs.log.VcsLogUi)4 PermanentGraph (com.intellij.vcs.log.graph.PermanentGraph)2 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 ListPopup (com.intellij.openapi.ui.popup.ListPopup)1 StringUtil (com.intellij.openapi.util.text.StringUtil)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 VcsLogInternalDataKeys (com.intellij.vcs.log.ui.VcsLogInternalDataKeys)1 Collection (java.util.Collection)1 List (java.util.List)1 NotNull (org.jetbrains.annotations.NotNull)1