diff --git a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProperties.java b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProperties.java index caf064c515da..07c7d0f74d23 100644 --- a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProperties.java +++ b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProperties.java @@ -28,6 +28,7 @@ public class VcsLogProperties { @NotNull public static final VcsLogProperty LIGHTWEIGHT_BRANCHES = new VcsLogProperty<>(false); @NotNull public static final VcsLogProperty SUPPORTS_INDEXING = new VcsLogProperty<>(false); + @NotNull public static final VcsLogProperty CASE_INSENSITIVE_REGEX = new VcsLogProperty<>(true); @NotNull public static T get(@NotNull VcsLogProvider provider, VcsLogProperty property) { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/EnableMatchCaseAction.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/EnableMatchCaseAction.java index 8d3a1d8e43bc..ab35a99a0a79 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/EnableMatchCaseAction.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/EnableMatchCaseAction.java @@ -18,11 +18,20 @@ package com.intellij.vcs.log.ui.actions; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.openapi.project.DumbAware; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.VcsLogDataKeys; +import com.intellij.vcs.log.VcsLogProperties; +import com.intellij.vcs.log.VcsLogProvider; import com.intellij.vcs.log.VcsLogUi; import org.jetbrains.annotations.NotNull; +import java.util.Collection; +import java.util.List; + public class EnableMatchCaseAction extends ToggleAction implements DumbAware { + @NotNull + private static final String MATCH_CASE = "Match Case"; @Override public boolean isSelected(AnActionEvent e) { @@ -41,7 +50,30 @@ public class EnableMatchCaseAction extends ToggleAction implements DumbAware { @Override public void update(@NotNull AnActionEvent e) { - e.getPresentation().setEnabledAndVisible(e.getData(VcsLogDataKeys.VCS_LOG_UI) != null); + VcsLogUi ui = e.getData(VcsLogDataKeys.VCS_LOG_UI); + if (ui == null) { + e.getPresentation().setEnabledAndVisible(false); + } + else { + boolean regexEnabled = ui.getTextFilterSettings().isFilterByRegexEnabled(); + if (!regexEnabled) { + e.getPresentation().setEnabledAndVisible(true); + e.getPresentation().setText(MATCH_CASE); + } + else { + Collection providers = ContainerUtil.newLinkedHashSet(ui.getDataPack().getLogProviders().values()); + List supported = + ContainerUtil.filter(providers, p -> VcsLogProperties.get(p, VcsLogProperties.CASE_INSENSITIVE_REGEX)); + e.getPresentation().setEnabledAndVisible(!supported.isEmpty()); + if (providers.size() == supported.size()) { + 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)"); + } + } + } super.update(e); } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java index 5cba891ac3cf..92a43bfcf23b 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java @@ -335,6 +335,9 @@ public class HgLogProvider implements VcsLogProvider { @Nullable @Override public T getPropertyValue(VcsLogProperties.VcsLogProperty property) { + if (property == VcsLogProperties.CASE_INSENSITIVE_REGEX) { + return (T)Boolean.FALSE; + } return null; } }