IJPL-204287 Fix the preview button after rebase

GitOrigin-RevId: d52b67f5de679ac6081282c809e74c07e8c0bfe5
This commit is contained in:
Aydar Mukhametzyanov
2025-10-01 22:53:48 +00:00
committed by intellij-monorepo-bot
parent 5a9d7e9598
commit 13232ee81d
4 changed files with 11 additions and 12 deletions
@@ -286,11 +286,13 @@ class SePopupContentPane(
}
launch {
vm.currentTabFlow.collectLatest {
val filterEditor = it.filterEditor.getValue()
vm.currentTabFlow.collectLatest { tabVm ->
val filterEditor = tabVm.filterEditor.getValue()
filterEditor?.let { filterEditor ->
val isPreviewEnabled = tabVm.isPreviewEnabled.getValue()
withContext(Dispatchers.EDT) {
headerPane.setFilterActions(filterEditor.getHeaderActions(), vm.ShowInFindToolWindowAction())
headerPane.setFilterActions(filterEditor.getHeaderActions(), vm.ShowInFindToolWindowAction(), isPreviewEnabled)
hintHelper.removeRightExtensions()
val rightActions = filterEditor.getSearchFieldActions()
if (rightActions.isNotEmpty()) {
@@ -69,7 +69,7 @@ class SePopupHeaderPane(
}
.component
setFilterActions(emptyList(), null)
setFilterActions(emptyList(), null, false)
cell(tabFilterContainer).align(AlignY.FILL + AlignX.RIGHT).resizableColumn()
}
@@ -135,17 +135,16 @@ class SePopupHeaderPane(
super.removeNotify()
}
fun setFilterActions(actions: List<AnAction>, showInFindToolWindowAction: AnAction? = null) {
fun setFilterActions(actions: List<AnAction>, showInFindToolWindowAction: AnAction?, isPreviewEnabled: Boolean) {
toolbarListenerDisposable?.let { Disposer.dispose(it) }
val toolbarListenerDisposable = Disposer.newDisposable()
this.toolbarListenerDisposable = toolbarListenerDisposable
val actionGroup = DefaultActionGroup(actions)
showInFindToolWindowAction?.let { actionGroup.add(it) }
if (isPreviewEnabled) {
actionGroup.add(PreviewAction())
}
actionGroup.add(showInFindToolWindowAction)
showInFindToolWindowAction?.let { actionGroup.add(it) }
toolbar = ActionManager.getInstance().createActionToolbar("search.everywhere.toolbar", actionGroup, true)
toolbar.setLayoutStrategy(ToolbarLayoutStrategy.NOWRAP_STRATEGY)
toolbar.targetComponent = this
@@ -158,7 +158,7 @@ class SePopupVm(
if (PreviewExperiment.isExperimentEnabled && previewFetcher != null) {
previewConfigurationFlow = combine(currentTabFlow, showPreviewSetting) { tabVm, previewSetting ->
tabVm.isPreviewEnabled() to previewSetting
tabVm.isPreviewEnabled.getValue() to previewSetting
}.mapLatest { (tabPreviewEnabled, previewSetting) ->
if (tabPreviewEnabled) {
if (previewSetting) SePreviewConfiguration(previewFetcher.project, this::fetchPreview)
@@ -26,6 +26,7 @@ import com.intellij.platform.searchEverywhere.providers.SeAdaptedItem
import com.intellij.platform.searchEverywhere.providers.SeLog
import com.intellij.platform.searchEverywhere.utils.SuspendLazyProperty
import com.intellij.platform.searchEverywhere.utils.initAsync
import com.intellij.platform.searchEverywhere.utils.suspendLazy
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import org.jetbrains.annotations.ApiStatus
@@ -51,6 +52,7 @@ class SeTabVm(
else SearchEverywhereUsageTriggerCollector.NOT_REPORTABLE_ID
val isIndexingDependent: Boolean get() = tab.isIndexingDependent
val isPreviewEnabled: SuspendLazyProperty<Boolean> get() = suspendLazy { tab.isPreviewEnabled() }
private val shouldLoadMoreFlow: MutableStateFlow<Boolean> = MutableStateFlow(false)
var shouldLoadMore: Boolean
@@ -236,10 +238,6 @@ class SeTabVm(
return tab.performExtendedAction(item)
}
suspend fun isPreviewEnabled(): Boolean {
return tab.isPreviewEnabled()
}
suspend fun getPreviewInfo(itemData: SeItemData): SePreviewInfo? = tab.getPreviewInfo(itemData)
}