From bf8bfd59902c8b23da8ac01f94b9da614cdf6802 Mon Sep 17 00:00:00 2001 From: Dmitry Krasilschikov Date: Mon, 30 Oct 2023 16:59:47 +0200 Subject: [PATCH] UX-2470 [SE] hide action if the feature is disabled GitOrigin-RevId: 98fea3bb0da52e8c130afe2d894be4116bafced4 --- .../intellij/ide/actions/searcheverywhere/PreviewAction.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/PreviewAction.kt b/platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/PreviewAction.kt index 5a02128b11d7..887366895675 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/PreviewAction.kt +++ b/platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/PreviewAction.kt @@ -3,6 +3,7 @@ package com.intellij.ide.actions.searcheverywhere import com.intellij.icons.ExpUiIcons import com.intellij.ide.IdeBundle +import com.intellij.ide.actions.searcheverywhere.SearchEverywhereUI.isPreviewEnabled import com.intellij.ide.util.PropertiesComponent import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent @@ -15,6 +16,11 @@ class PreviewAction(val callback: () -> Unit) : ExpUiIcons.General.PreviewHorizontally) { override fun getActionUpdateThread() = ActionUpdateThread.BGT + override fun update(e: AnActionEvent) { + e.presentation.isEnabledAndVisible = isPreviewEnabled() + super.update(e) + } + override fun isSelected(e: AnActionEvent) = PropertiesComponent.getInstance(e.project!!).isTrueValue(SearchEverywhereUI.PREVIEW_PROPERTY_KEY)