UX-2470 [SE] hide action if the feature is disabled

GitOrigin-RevId: 98fea3bb0da52e8c130afe2d894be4116bafced4
This commit is contained in:
Dmitry Krasilschikov
2023-10-31 18:43:22 +00:00
committed by intellij-monorepo-bot
parent 4890593a89
commit bf8bfd5990
@@ -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)