[debugger-rd] IJPL-175934: Introduce frontend's navigate to type action

GitOrigin-RevId: abd2a0f5651c534505cd9a0793bdc5a957ed503d
This commit is contained in:
Nikolay Rykunov
2025-01-29 12:36:07 +00:00
committed by intellij-monorepo-bot
parent 0913bae3c0
commit 3a7cfac8f2
3 changed files with 40 additions and 1 deletions
@@ -33,6 +33,11 @@
<add-to-group group-id="XDebugger.Inspect.Tree.Popup.Jump.To.Section.Frontend" anchor="first"/>
</action>
<action id="XDebugger.JumpToTypeSource.Frontend"
class="com.intellij.platform.debugger.impl.frontend.actions.FrontendXJumpToTypeSourceAction">
<add-to-group group-id="XDebugger.Inspect.Tree.Popup.Jump.To.Section.Frontend" anchor="after" relative-to-action="XDebugger.JumpToSource.Frontend"/>
</action>
<action id="XDebugger.Hotswap.Modified.Files" class="com.intellij.platform.debugger.impl.frontend.hotswap.HotSwapModifiedFilesAction">
<add-to-group group-id="DebugReloadGroup" anchor="first"/>
<add-to-group group-id="EditorPopupMenuDebugHotSwap" anchor="first"/>
@@ -15,4 +15,6 @@ action.XDebugger.CompareValueWithClipboard.Frontend.description=Compare value of
action.XDebugger.CopyName.Frontend.text=Copy Name
action.XDebugger.CopyName.Frontend.description=Copy name of selected node to clipboard
action.XDebugger.JumpToSource.Frontend.text=Jump To Source
action.XDebugger.JumpToSource.Frontend.description=Open source of the selected item
action.XDebugger.JumpToSource.Frontend.description=Open source of the selected item
action.XDebugger.JumpToTypeSource.Frontend.text=Jump To Type Source
action.XDebugger.JumpToTypeSource.Frontend.description=Open source of the selected value's type
@@ -0,0 +1,32 @@
// 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.platform.debugger.impl.frontend.actions
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.remoting.ActionRemoteBehaviorSpecification
import com.intellij.openapi.project.Project
import com.intellij.platform.debugger.impl.frontend.evaluate.quick.FrontendXValue
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
private class FrontendXJumpToTypeSourceAction : XJumpToSourceActionBase(), ActionRemoteBehaviorSpecification.Frontend {
override fun update(e: AnActionEvent) {
if (!areFrontendDebuggerActionsEnabled()) {
e.presentation.isEnabledAndVisible = false
return
}
super.update(e)
}
override suspend fun navigateToSource(project: Project, value: XValue): Boolean {
val frontendValue = value as? FrontendXValue ?: return false
return XDebuggerNavigationApi.getInstance().navigateToXValueType(frontendValue.xValueDto.id).await()
}
override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}
}