This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 45c1b780b9 Fix#6770 Toolbar tooltip is incorrect (#6774)
45c1b780b9 is described below

commit 45c1b780b968bfe4517e963186b9ebaacab20ee5
Author: lance <[email protected]>
AuthorDate: Mon Mar 16 22:55:00 2026 +0800

    Fix#6770 Toolbar tooltip is incorrect (#6774)
    
    * Fix Toolbar tooltip is incorrect when toggling Hide/Show the execution 
results pane
    
    Signed-off-by: lance <[email protected]>
    
    * fixing the rootcause on WIndows
    
    ---------
    
    Signed-off-by: lance <[email protected]>
    Co-authored-by: Hans Van Akelyen <[email protected]>
---
 .../apache/hop/ui/core/gui/GuiToolbarWidgets.java  | 35 ++++++++++++++++++----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java 
b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java
index d035e001dc..1a0b99e960 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java
@@ -887,18 +887,43 @@ public class GuiToolbarWidgets extends BaseGuiWidgets 
implements IToolbarWidgetR
    * Set the tooltip on a toolbar item. Works for both ToolBar (desktop) and 
web Composite (Hop
    * Web).
    *
+   * <p>On desktop, for plain toolbar buttons the stored control is the 
ToolBar (parent of the
+   * ToolItem). Setting the toolbar's tooltip would overwrite a shared control 
and on Windows can
+   * break all other toolbar item tooltips when one is updated. We only set 
the ToolItem's tooltip
+   * in that case. On Windows we also defer the update via asyncExec to avoid 
native tooltip state
+   * corruption when tooltips are changed in response to a button press.
+   *
    * @param id the toolbar item id (from @GuiToolbarElement)
    * @param tooltip the tooltip text
    */
   public void setToolbarItemToolTip(String id, String tooltip) {
     Control control = widgetsMap.get(id);
     ToolItem toolItem = toolItemMap.get(id);
-    if (control != null && !control.isDisposed()) {
-      control.setToolTipText(Const.NVL(tooltip, ""));
-    }
-    if (toolItem != null && !toolItem.isDisposed()) {
-      toolItem.setToolTipText(Const.NVL(tooltip, ""));
+    String safeTip = Const.NVL(tooltip, "");
+
+    Runnable update =
+        () -> {
+          if (control != null && !control.isDisposed()) {
+            // Do not set tooltip on the ToolBar when control is the 
ToolItem's parent (desktop
+            // toolbar buttons store item.getParent()). Setting the bar's 
tooltip overwrites a
+            // shared control and breaks other items' tooltips on Windows.
+            if (toolItem == null || control != toolItem.getParent()) {
+              control.setToolTipText(safeTip);
+            }
+          }
+          if (toolItem != null && !toolItem.isDisposed()) {
+            toolItem.setToolTipText(safeTip);
+          }
+        };
+
+    if (Const.isWindows()) {
+      Display display = Display.getCurrent();
+      if (display != null && !display.isDisposed()) {
+        display.asyncExec(update);
+        return;
+      }
     }
+    update.run();
   }
 
   /**

Reply via email to