From 3a7cfac8f292b320899dd2f4d858fb77629e70e1 Mon Sep 17 00:00:00 2001 From: Nikolay Rykunov Date: Wed, 29 Jan 2025 06:22:45 +0100 Subject: [PATCH] [debugger-rd] IJPL-175934: Introduce frontend's navigate to type action GitOrigin-RevId: abd2a0f5651c534505cd9a0793bdc5a957ed503d --- ...tellij.platform.debugger.impl.frontend.xml | 5 +++ .../FrontendDebuggerImplBundle.properties | 4 ++- .../FrontendXJumpToTypeSourceAction.kt | 32 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 platform/xdebugger-impl/frontend/src/com/intellij/platform/debugger/impl/frontend/actions/FrontendXJumpToTypeSourceAction.kt diff --git a/platform/xdebugger-impl/frontend/resources/intellij.platform.debugger.impl.frontend.xml b/platform/xdebugger-impl/frontend/resources/intellij.platform.debugger.impl.frontend.xml index 4e11bdf72e7e..4ce68955704a 100644 --- a/platform/xdebugger-impl/frontend/resources/intellij.platform.debugger.impl.frontend.xml +++ b/platform/xdebugger-impl/frontend/resources/intellij.platform.debugger.impl.frontend.xml @@ -33,6 +33,11 @@ + + + + diff --git a/platform/xdebugger-impl/frontend/resources/messages/FrontendDebuggerImplBundle.properties b/platform/xdebugger-impl/frontend/resources/messages/FrontendDebuggerImplBundle.properties index 8649852f0de1..479fbb7bb3eb 100644 --- a/platform/xdebugger-impl/frontend/resources/messages/FrontendDebuggerImplBundle.properties +++ b/platform/xdebugger-impl/frontend/resources/messages/FrontendDebuggerImplBundle.properties @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/platform/xdebugger-impl/frontend/src/com/intellij/platform/debugger/impl/frontend/actions/FrontendXJumpToTypeSourceAction.kt b/platform/xdebugger-impl/frontend/src/com/intellij/platform/debugger/impl/frontend/actions/FrontendXJumpToTypeSourceAction.kt new file mode 100644 index 000000000000..8f28aac00835 --- /dev/null +++ b/platform/xdebugger-impl/frontend/src/com/intellij/platform/debugger/impl/frontend/actions/FrontendXJumpToTypeSourceAction.kt @@ -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 + } +} \ No newline at end of file