[debugger] IJPL-158332 Add tooltip

GitOrigin-RevId: b75d373bad82665fabfb2bbe352e67d72140566c
This commit is contained in:
Maksim Zuev
2024-07-30 20:57:59 +00:00
committed by intellij-monorepo-bot
parent 4abd1d5bdc
commit a6d0e3bffe
2 changed files with 12 additions and 1 deletions
@@ -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.
@@ -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