mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[debugger-rd] IJPL-175934: Disable actions if navigation is not possible
GitOrigin-RevId: 799b7334893222a5c65a9658ede51012eedd0e7b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3a7cfac8f2
commit
2fe1f468d5
+5
@@ -10,6 +10,7 @@ import com.intellij.xdebugger.frame.XValue
|
||||
import com.intellij.xdebugger.impl.actions.areFrontendDebuggerActionsEnabled
|
||||
import com.intellij.xdebugger.impl.rpc.XDebuggerNavigationApi
|
||||
import com.intellij.xdebugger.impl.ui.tree.actions.XJumpToSourceActionBase
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl
|
||||
|
||||
private class FrontendXJumpToSourceAction : XJumpToSourceActionBase(), ActionRemoteBehaviorSpecification.Frontend {
|
||||
override fun update(e: AnActionEvent) {
|
||||
@@ -21,6 +22,10 @@ private class FrontendXJumpToSourceAction : XJumpToSourceActionBase(), ActionRem
|
||||
super.update(e)
|
||||
}
|
||||
|
||||
override fun isEnabled(node: XValueNodeImpl, e: AnActionEvent): Boolean {
|
||||
return super.isEnabled(node, e) && node.valueContainer.canNavigateToSource()
|
||||
}
|
||||
|
||||
override suspend fun navigateToSource(project: Project, value: XValue): Boolean {
|
||||
val frontendValue = value as? FrontendXValue ?: return false
|
||||
return XDebuggerNavigationApi.getInstance().navigateToXValue(frontendValue.xValueDto.id).await()
|
||||
|
||||
+5
@@ -10,6 +10,7 @@ import com.intellij.xdebugger.frame.XValue
|
||||
import com.intellij.xdebugger.impl.actions.areFrontendDebuggerActionsEnabled
|
||||
import com.intellij.xdebugger.impl.rpc.XDebuggerNavigationApi
|
||||
import com.intellij.xdebugger.impl.ui.tree.actions.XJumpToSourceActionBase
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl
|
||||
|
||||
private class FrontendXJumpToTypeSourceAction : XJumpToSourceActionBase(), ActionRemoteBehaviorSpecification.Frontend {
|
||||
override fun update(e: AnActionEvent) {
|
||||
@@ -21,6 +22,10 @@ private class FrontendXJumpToTypeSourceAction : XJumpToSourceActionBase(), Actio
|
||||
super.update(e)
|
||||
}
|
||||
|
||||
override fun isEnabled(node: XValueNodeImpl, e: AnActionEvent): Boolean {
|
||||
return super.isEnabled(node, e) && node.valueContainer.canNavigateToTypeSource()
|
||||
}
|
||||
|
||||
override suspend fun navigateToSource(project: Project, value: XValue): Boolean {
|
||||
val frontendValue = value as? FrontendXValue ?: return false
|
||||
return XDebuggerNavigationApi.getInstance().navigateToXValueType(frontendValue.xValueDto.id).await()
|
||||
|
||||
+22
-1
@@ -18,7 +18,6 @@ import com.intellij.xdebugger.frame.XValueModifier
|
||||
import com.intellij.xdebugger.frame.XValueNode
|
||||
import com.intellij.xdebugger.frame.XValuePlace
|
||||
import com.intellij.xdebugger.frame.presentation.XValuePresentation
|
||||
import com.intellij.xdebugger.impl.evaluate.quick.HintXValue
|
||||
import com.intellij.xdebugger.impl.rhizome.XValueMarkerDto
|
||||
import com.intellij.xdebugger.impl.rpc.XDebuggerEvaluatorApi
|
||||
import com.intellij.xdebugger.impl.rpc.XValueAdvancedPresentationPart
|
||||
@@ -28,6 +27,9 @@ import com.intellij.xdebugger.impl.rpc.XValuePresentationEvent
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeEx
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import org.jetbrains.concurrency.Promise
|
||||
import org.jetbrains.concurrency.asCompletableFuture
|
||||
import org.jetbrains.concurrency.asPromise
|
||||
|
||||
internal class FrontendXValue(
|
||||
private val project: Project,
|
||||
@@ -48,6 +50,9 @@ internal class FrontendXValue(
|
||||
|
||||
var markerDto: XValueMarkerDto? = null
|
||||
|
||||
@Volatile
|
||||
private var canNavigateToTypeSource = false
|
||||
|
||||
init {
|
||||
cs.launch {
|
||||
val canBeModified = xValueDto.canBeModified.await()
|
||||
@@ -75,6 +80,22 @@ internal class FrontendXValue(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cs.launch {
|
||||
canNavigateToTypeSource = xValueDto.canNavigateToTypeSource.await()
|
||||
}
|
||||
}
|
||||
|
||||
override fun canNavigateToSource(): Boolean {
|
||||
return xValueDto.canNavigateToSource
|
||||
}
|
||||
|
||||
override fun canNavigateToTypeSource(): Boolean {
|
||||
return canNavigateToTypeSource
|
||||
}
|
||||
|
||||
override fun canNavigateToTypeSourceAsync(): Promise<Boolean?>? {
|
||||
return canNavigateToTypeSourceAsync()?.asCompletableFuture()?.asPromise()
|
||||
}
|
||||
|
||||
override fun computePresentation(node: XValueNode, place: XValuePlace) {
|
||||
|
||||
Reference in New Issue
Block a user