mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[debugger-rd] IJPL-160146: Register entities using EntityTypeProvider EP
GitOrigin-RevId: bf10e84a5d8a2eb155dbe41342d7a7d0a55a7a1f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3e5f254be6
commit
70bd6c8850
@@ -19,11 +19,6 @@ import kotlinx.coroutines.withContext
|
||||
internal fun subscribeForDebuggingStart(cs: CoroutineScope, project: Project, onStartListening: () -> Unit) {
|
||||
cs.launch(Dispatchers.Default) {
|
||||
withKernel {
|
||||
change {
|
||||
shared {
|
||||
register(XDebuggerValueLookupListeningStartedEntity)
|
||||
}
|
||||
}
|
||||
XDebuggerValueLookupListeningStartedEntity.each().filter { it.projectEntity.asProject() === project }.collect {
|
||||
withContext(Dispatchers.Main) {
|
||||
onStartListening()
|
||||
@@ -36,11 +31,6 @@ internal fun subscribeForDebuggingStart(cs: CoroutineScope, project: Project, on
|
||||
internal fun subscribeForValueHintHideRequest(cs: CoroutineScope, project: Project, onHintHidden: () -> Unit) {
|
||||
cs.launch(Dispatchers.Default) {
|
||||
withKernel {
|
||||
change {
|
||||
shared {
|
||||
register(XDebuggerValueLookupHideHintsRequestEntity)
|
||||
}
|
||||
}
|
||||
XDebuggerValueLookupHideHintsRequestEntity.each().filter { it.projectEntity.asProject() === project }.collect { entity ->
|
||||
withContext(Dispatchers.Main) {
|
||||
onHintHidden()
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
<runDashboardCustomizer implementation="com.intellij.xdebugger.impl.dashboard.XDebuggerRunDashboardCustomizer" order="first"/>
|
||||
<registryKey defaultValue="false" key="debugger.valueLookupFrontendBackend"
|
||||
description="Provides a way to use frontend-backend implementation of debugger's evaluation popup"/>
|
||||
<platform.entityTypes implementation="com.intellij.xdebugger.impl.evaluate.XDebuggerValueLookupEntityTypesProvider"/>
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
|
||||
@@ -5,11 +5,13 @@ import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.platform.kernel.EntityTypeProvider
|
||||
import com.intellij.platform.kernel.withKernel
|
||||
import com.intellij.platform.project.ProjectEntity
|
||||
import com.intellij.platform.project.asEntity
|
||||
import com.jetbrains.rhizomedb.EID
|
||||
import com.jetbrains.rhizomedb.Entity
|
||||
import com.jetbrains.rhizomedb.EntityType
|
||||
import fleet.kernel.DurableEntityType
|
||||
import fleet.kernel.change
|
||||
import fleet.kernel.shared
|
||||
@@ -19,6 +21,15 @@ import kotlinx.coroutines.launch
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
private class XDebuggerValueLookupEntityTypesProvider : EntityTypeProvider {
|
||||
override fun entityTypes(): List<EntityType<*>> {
|
||||
return listOf(
|
||||
XDebuggerValueLookupListeningStartedEntity,
|
||||
XDebuggerValueLookupHideHintsRequestEntity,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
class XDebuggerValueLookupListeningStartedEntity(override val eid: EID) : Entity {
|
||||
companion object : DurableEntityType<XDebuggerValueLookupListeningStartedEntity>(
|
||||
@@ -59,17 +70,13 @@ class ValueLookupManagerController(private val project: Project, private val cs:
|
||||
}
|
||||
cs.launch(Dispatchers.Main) {
|
||||
withKernel {
|
||||
change {
|
||||
shared {
|
||||
register(XDebuggerValueLookupListeningStartedEntity)
|
||||
}
|
||||
}
|
||||
val entities = XDebuggerValueLookupListeningStartedEntity.all()
|
||||
if (entities.isEmpty()) {
|
||||
change {
|
||||
val projectEntity = project.asEntity()
|
||||
shared {
|
||||
XDebuggerValueLookupListeningStartedEntity.new {
|
||||
it[XDebuggerValueLookupListeningStartedEntity.Project] = project.asEntity()
|
||||
it[XDebuggerValueLookupListeningStartedEntity.Project] = projectEntity
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,10 +93,10 @@ class ValueLookupManagerController(private val project: Project, private val cs:
|
||||
cs.launch(Dispatchers.Main) {
|
||||
withKernel {
|
||||
change {
|
||||
val projectEntity = project.asEntity()
|
||||
shared {
|
||||
register(XDebuggerValueLookupHideHintsRequestEntity)
|
||||
XDebuggerValueLookupHideHintsRequestEntity.new {
|
||||
it[XDebuggerValueLookupHideHintsRequestEntity.Project] = project.asEntity()
|
||||
it[XDebuggerValueLookupHideHintsRequestEntity.Project] = projectEntity
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user