mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[rd debugger] XDebugProcess API to provide debug session events
(cherry picked from commit ea021a766d74f68ca6ca58f41159c4e826d0494f) (cherry picked from commit 256519c7ac630edcf19d5a02a03798b0da22e4dd) IJ-CR-182318 GitOrigin-RevId: 11dc0c87dc515e5ddce504aa98682a402a8a0f7c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
93b61ddfac
commit
442c513c97
@@ -78,6 +78,7 @@ public class JavaDebugProcess extends XDebugProcess {
|
||||
private final NodeManagerImpl myNodeManager;
|
||||
private final JvmSmartStepIntoActionHandler mySmartStepIntoActionHandler;
|
||||
private final JvmDropFrameActionHandler myDropFrameActionActionHandler;
|
||||
private final JavaDebugSessionEventsProvider myJavaDebugSessionEventsProvider;
|
||||
|
||||
private static final JavaBreakpointHandlerFactory[] ourDefaultBreakpointHandlerFactories = {
|
||||
process -> new JavaBreakpointHandler.JavaLineBreakpointHandler(process),
|
||||
@@ -226,6 +227,7 @@ public class JavaDebugProcess extends XDebugProcess {
|
||||
|
||||
mySmartStepIntoActionHandler = new JvmSmartStepIntoActionHandler(javaSession);
|
||||
myDropFrameActionActionHandler = new JvmDropFrameActionHandler(javaSession);
|
||||
myJavaDebugSessionEventsProvider = new JavaDebugSessionEventsProvider(this);
|
||||
}
|
||||
|
||||
private boolean shouldApplyContext(DebuggerContextImpl context) {
|
||||
@@ -257,6 +259,11 @@ public class JavaDebugProcess extends XDebugProcess {
|
||||
return myJavaSession;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XDebugSessionEventsProvider getSessionEventsProvider() {
|
||||
return myJavaDebugSessionEventsProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull XDebuggerEditorsProvider getEditorsProvider() {
|
||||
return myEditorsProvider;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.debugger.engine
|
||||
|
||||
import com.intellij.debugger.impl.DebuggerContextListener
|
||||
import com.intellij.debugger.impl.DebuggerSession
|
||||
import com.intellij.xdebugger.XDebugSessionEventsProvider
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.channels.awaitClose
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.buffer
|
||||
import kotlinx.coroutines.flow.channelFlow
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
class JavaDebugSessionEventsProvider(private val debugProcess: JavaDebugProcess) : XDebugSessionEventsProvider {
|
||||
override fun getUiUpdateEventsFlow(): Flow<Unit> {
|
||||
val stateManager = debugProcess.debuggerSession.contextManager
|
||||
return channelFlow {
|
||||
val listener = DebuggerContextListener { _, event ->
|
||||
if (event == DebuggerSession.Event.THREADS_REFRESH) {
|
||||
trySend(Unit)
|
||||
}
|
||||
}
|
||||
stateManager.addListener(listener)
|
||||
|
||||
awaitClose {
|
||||
stateManager.removeListener(listener)
|
||||
}
|
||||
}.buffer(Channel.CONFLATED)
|
||||
}
|
||||
}
|
||||
@@ -295,6 +295,11 @@ public abstract class XDebugProcess {
|
||||
return frame == null ? null : frame.getEvaluator();
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public XDebugSessionEventsProvider getSessionEventsProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the "isShowLibraryStackFrames" setting is respected.
|
||||
* If true, the ShowLibraryFramesAction will be shown, for example.
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xdebugger
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
/**
|
||||
* A provider of events from [XDebugSession] which could trigger UI updates.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
interface XDebugSessionEventsProvider {
|
||||
fun getUiUpdateEventsFlow(): Flow<Unit>
|
||||
}
|
||||
+5
@@ -240,6 +240,11 @@ internal class BackendXDebugSessionApi : XDebugSessionApi {
|
||||
session.setBreakpointMuted(muted)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getUiUpdateEventsFlow(sessionId: XDebugSessionId): Flow<Unit> {
|
||||
val session = sessionId.findValue() ?: return emptyFlow()
|
||||
return session.debugProcess.sessionEventsProvider.getUiUpdateEventsFlow()
|
||||
}
|
||||
}
|
||||
|
||||
internal suspend fun createBackendDocument(
|
||||
|
||||
+2
@@ -67,6 +67,8 @@ interface XDebugSessionApi : RemoteApi<Unit> {
|
||||
|
||||
suspend fun muteBreakpoints(sessionDataId: XDebugSessionDataId, muted: Boolean)
|
||||
|
||||
suspend fun getUiUpdateEventsFlow(sessionId: XDebugSessionId): Flow<Unit>
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
suspend fun getInstance(): XDebugSessionApi {
|
||||
|
||||
Reference in New Issue
Block a user