From a6d0e3bffed1db4d51ebfd6ca4f367a1d3fefe6d Mon Sep 17 00:00:00 2001 From: Maksim Zuev Date: Tue, 30 Jul 2024 18:33:15 +0200 Subject: [PATCH] [debugger] IJPL-158332 Add tooltip GitOrigin-RevId: b75d373bad82665fabfb2bbe352e67d72140566c --- .../resources/messages/XDebuggerBundle.properties | 2 ++ .../impl/hotswap/HotSwapFloatingToolbarProvider.kt | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/platform/xdebugger-api/resources/messages/XDebuggerBundle.properties b/platform/xdebugger-api/resources/messages/XDebuggerBundle.properties index a2196b4e9672..ba15215a0b59 100644 --- a/platform/xdebugger-api/resources/messages/XDebuggerBundle.properties +++ b/platform/xdebugger-api/resources/messages/XDebuggerBundle.properties @@ -336,3 +336,5 @@ xdebugger.visualized.text.name.url=URL (decoded) xdebugger.hotswap.code.changed=Code changed: notification.group.debugger.hotswap.messages=Hotswap failed xdebugger.hotswap.status.success=Code has been reloaded +xdebugger.hotswap.tooltip.apply=Apply hot swap +xdebugger.hotswap.tooltip.description=You changed code during a debug session. Code in runtime differs from code in editor. You can apply changes manually. diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/hotswap/HotSwapFloatingToolbarProvider.kt b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/hotswap/HotSwapFloatingToolbarProvider.kt index 090b0dd34cbc..ee2c66337301 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/hotswap/HotSwapFloatingToolbarProvider.kt +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/hotswap/HotSwapFloatingToolbarProvider.kt @@ -1,6 +1,7 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.xdebugger.impl.hotswap +import com.intellij.ide.HelpTooltip import com.intellij.openapi.Disposable import com.intellij.openapi.actionSystem.* import com.intellij.openapi.actionSystem.ex.CustomComponentAction @@ -50,14 +51,22 @@ private class HotSwapWithRebuildAction : AnAction(), CustomComponentAction { private class HotSwapToolbarComponent(action: AnAction, presentation: Presentation, place: String) : JPanel(FlowLayout(FlowLayout.LEFT, JBUI.scale(4), 0)) { - val button = ActionButton(action, presentation, place, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE) + private val tooltip = createHelpTooltip() + val button = ActionButton(action, presentation, place, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE).apply { + tooltip.installOn(this) + } init { isOpaque = false add(JBLabel(XDebuggerBundle.message("xdebugger.hotswap.code.changed"))) add(button) + tooltip.installOn(this) } + private fun createHelpTooltip() = HelpTooltip() + .setTitle(XDebuggerBundle.message("xdebugger.hotswap.tooltip.apply")) + .setDescription(XDebuggerBundle.message("xdebugger.hotswap.tooltip.description")) + fun update(inProgress: Boolean, presentation: Presentation) { presentation.isEnabled = !inProgress presentation.icon = if (inProgress) AnimatedIcon.Default.INSTANCE else PlatformDebuggerImplIcons.Actions.Hot_swap