IJPL-185131 Search Everywhere for RD: Open in Find tool window

- Code review fixes

GitOrigin-RevId: b716fb68004bef1d4c30fac65e2d35403e9d47bc
This commit is contained in:
Tatiana Elfimova
2025-06-17 22:51:32 +00:00
committed by intellij-monorepo-bot
parent c771e2a739
commit fde05bbb91
6 changed files with 22 additions and 34 deletions
@@ -18,10 +18,8 @@ import com.intellij.platform.searchEverywhere.providers.SeProvidersHolder
import com.intellij.platform.searchEverywhere.providers.target.SeTypeVisibilityStatePresentation
import com.jetbrains.rhizomedb.EID
import fleet.kernel.DurableRef
import fleet.kernel.change
import fleet.kernel.onDispose
import fleet.kernel.rete.Rete
import fleet.kernel.shared
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.channels.ReceiveChannel
@@ -183,22 +181,9 @@ class SeBackendService(val project: Project, private val coroutineScope: Corouti
val providersHolder = getProvidersHolder(sessionRef, dataContextId)
if (providersHolder == null) return false
coroutineScope.launch {
try {
SeFindToolWindowManager(project).openInFindToolWindow(
providerIds, params, isAllTab, providersHolder, projectId,
)
}
finally {
withContext(NonCancellable) {
change {
shared {
sessionRef.derefOrNull()?.delete()
}
}
}
}
}
SeFindToolWindowManager(project).openInFindToolWindow(
providerIds, params, isAllTab, providersHolder, projectId,
)
return true
}
@@ -50,7 +50,7 @@ class SeFindToolWindowManager(private val project: Project) {
projectId: ProjectId,
) {
val contributorsString = providerIds.mapNotNull { providerId ->
providersHolder.get(providerId, false)?.displayName
providersHolder.get(providerId, isAllTab)?.displayName
}.joinToString(separator = ", ")
val presentation = UsageViewPresentation()
val tabCaptionText = IdeBundle.message("searcheverywhere.found.matches.title", params.inputQuery, contributorsString)
File diff suppressed because one or more lines are too long
@@ -7,16 +7,16 @@ import com.intellij.find.impl.JComboboxAction
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.project.Project
import com.intellij.platform.searchEverywhere.SeSearchScopesInfo
import com.intellij.platform.searchEverywhere.frontend.SeFilterActionsPresentation
import com.intellij.platform.searchEverywhere.frontend.SeFilterPresentation
import com.intellij.platform.searchEverywhere.frontend.tabs.target.SeScopeChooserActionProvider
import com.intellij.platform.searchEverywhere.frontend.tabs.utils.SeFilterEditorBase
import com.intellij.platform.searchEverywhere.providers.SeTextFilter
import org.jetbrains.annotations.ApiStatus
@ApiStatus.Internal
class SeTextFilterEditor(private val project: Project?,
private val scopesInfo: SeSearchScopesInfo?) : SeFilterEditorBase<SeTextFilter>(
class SeTextFilterEditor(
private val project: Project?,
private val scopesInfo: SeSearchScopesInfo?,
) : SeFilterEditorBase<SeTextFilter>(
SeTextFilter(scopesInfo?.selectedScopeId, null)
) {
private val scopeFilterAction: AnAction? = scopesInfo?.let {
@@ -45,9 +45,5 @@ class SeTextFilterEditor(private val project: Project?,
return typesFilterAction
}
override fun getPresentation(): SeFilterPresentation {
return object : SeFilterActionsPresentation {
override fun getActions(): List<AnAction> = listOfNotNull(getScopeFilterAction(), getTypeFilterAction())
}
}
override fun getActions(): List<AnAction> = listOfNotNull(getScopeFilterAction(), getTypeFilterAction())
}
@@ -9,7 +9,6 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.util.text.StringUtil
import com.intellij.platform.searchEverywhere.frontend.SeEmptyResultInfo
import com.intellij.platform.searchEverywhere.frontend.SeEmptyResultInfoChunk
import com.intellij.platform.searchEverywhere.frontend.SeFilterActionsPresentation
import com.intellij.psi.search.EverythingGlobalScope
import com.intellij.ui.SimpleTextAttributes
import org.jetbrains.annotations.ApiStatus
@@ -46,7 +45,7 @@ class SeTextTabEmptyResultInfoProvider(
}
private val toggleScopeAction: SearchEverywhereToggleAction?
get() = (filterEditor?.getPresentation() as? SeFilterActionsPresentation)?.getActions()?.firstOrNull {
get() = filterEditor?.getActions()?.firstOrNull {
it is SearchEverywhereToggleAction
} as? SearchEverywhereToggleAction
@@ -45,6 +45,9 @@ class SePopupVm(
val currentTab: SeTabVm get() = tabVms[currentTabIndex.value.coerceIn(tabVms.indices)]
val currentTabFlow: Flow<SeTabVm>
private val canBeShownInFindResultsFlow = MutableStateFlow(false)
val canBeShownInFindResults: Boolean get() = canBeShownInFindResultsFlow.value
private var historyIterator: HistoryIterator = historyList.getIterator(currentTab.tabId)
get() {
val selectedContributorID = currentTab.tabId
@@ -82,6 +85,12 @@ class SePopupVm(
}
}
coroutineScope.launch {
currentTabFlow.collect { tabVm ->
canBeShownInFindResultsFlow.update { tabVm.canBeShownInFindResults() }
}
}
deferredTabs.forEach {
coroutineScope.launch {
it.getValue()?.let { tab ->
@@ -155,11 +164,10 @@ class SePopupVm(
override fun update(e: AnActionEvent) {
if (project == null) {
e.presentation.isEnabled = false
return
}
coroutineScope.launch {
e.presentation.isEnabled = canBeShownInFindResults()
}
e.presentation.isEnabled = canBeShownInFindResults
e.presentation.icon = getInstance(project).getShowInFindToolWindowIcon()
}