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 4d2926c6cc Create new widget for tooltips as regular tooltip does not
work in dark mode, fixes #2665 (#6430)
4d2926c6cc is described below
commit 4d2926c6cc872526e312d462efca8baf29fd5c69
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Tue Jan 20 16:18:23 2026 +0100
Create new widget for tooltips as regular tooltip does not work in dark
mode, fixes #2665 (#6430)
---
.../org/apache/hop/ui/core/gui/HopToolTip.java | 158 +++++++++++++++++++++
.../hopgui/file/pipeline/HopGuiPipelineGraph.java | 4 +-
.../ui/hopgui/file/shared/HopGuiAbstractGraph.java | 4 +-
.../hopgui/file/workflow/HopGuiWorkflowGraph.java | 4 +-
4 files changed, 164 insertions(+), 6 deletions(-)
diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/HopToolTip.java
b/ui/src/main/java/org/apache/hop/ui/core/gui/HopToolTip.java
new file mode 100644
index 0000000000..2f60a1eeba
--- /dev/null
+++ b/ui/src/main/java/org/apache/hop/ui/core/gui/HopToolTip.java
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hop.ui.core.gui;
+
+import lombok.Setter;
+import org.apache.hop.ui.core.ConstUi;
+import org.apache.hop.ui.core.PropsUi;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A custom tooltip implementation using a Shell and Label that supports
proper dark mode styling.
+ * This replaces the SWT ToolTip widget which doesn't support
background/foreground color
+ * customization.
+ */
+public class HopToolTip {
+
+ private final Shell tipShell;
+ private final Label tipLabel;
+ @Setter private boolean autoHide = true;
+
+ /**
+ * Creates a new custom tooltip
+ *
+ * @param parent The parent shell
+ */
+ public HopToolTip(Shell parent) {
+ tipShell = new Shell(parent, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
+ FillLayout layout = new FillLayout();
+ layout.marginWidth = ConstUi.SMALL_MARGIN;
+ layout.marginHeight = ConstUi.SMALL_MARGIN;
+ tipShell.setLayout(layout);
+
+ tipLabel = new Label(tipShell, SWT.NONE);
+
+ // Apply dark mode styling
+ GuiResource gui = GuiResource.getInstance();
+ if (PropsUi.getInstance().isDarkMode()) {
+ tipShell.setBackground(gui.getColor(32, 31, 27)); // Dark background
+ tipLabel.setBackground(gui.getColor(32, 31, 27));
+ tipLabel.setForeground(gui.getColor(224, 224, 224)); // Light text
+ } else {
+ tipShell.setBackground(gui.getColorWhite()); // Light background
+ tipLabel.setBackground(gui.getColorWhite());
+ tipLabel.setForeground(gui.getColorBlack()); // Dark text
+ }
+
+ // Auto-hide when user clicks anywhere
+ Display.getCurrent()
+ .addFilter(
+ SWT.MouseDown,
+ event -> {
+ if (autoHide && !tipShell.isDisposed() && tipShell.isVisible()) {
+ setVisible(false);
+ }
+ });
+ }
+
+ /**
+ * Sets the tooltip text
+ *
+ * @param text The text to display
+ */
+ public void setText(String text) {
+ if (tipLabel != null && !tipLabel.isDisposed()) {
+ tipLabel.setText(text != null ? text : "");
+ tipShell.pack();
+ }
+ }
+
+ /**
+ * Gets the tooltip text
+ *
+ * @return The current text
+ */
+ public String getText() {
+ if (tipLabel != null && !tipLabel.isDisposed()) {
+ return tipLabel.getText();
+ }
+ return "";
+ }
+
+ /**
+ * Sets the tooltip location
+ *
+ * @param x The x coordinate
+ * @param y The y coordinate
+ */
+ public void setLocation(int x, int y) {
+ if (tipShell != null && !tipShell.isDisposed()) {
+ tipShell.setLocation(x, y);
+ }
+ }
+
+ /**
+ * Sets the tooltip location
+ *
+ * @param location The location point
+ */
+ public void setLocation(Point location) {
+ setLocation(location.x, location.y);
+ }
+
+ /**
+ * Shows or hides the tooltip
+ *
+ * @param visible true to show, false to hide
+ */
+ public void setVisible(boolean visible) {
+ if (tipShell != null && !tipShell.isDisposed()) {
+ tipShell.setVisible(visible);
+ }
+ }
+
+ /**
+ * Checks if the tooltip is visible
+ *
+ * @return true if visible
+ */
+ public boolean isVisible() {
+ return tipShell != null && !tipShell.isDisposed() && tipShell.isVisible();
+ }
+
+ /** Disposes the tooltip */
+ public void dispose() {
+ if (tipShell != null && !tipShell.isDisposed()) {
+ tipShell.dispose();
+ }
+ }
+
+ /**
+ * Checks if the tooltip is disposed
+ *
+ * @return true if disposed
+ */
+ public boolean isDisposed() {
+ return tipShell == null || tipShell.isDisposed();
+ }
+}
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
index 9e8e0be616..1ed0f0142f 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
@@ -145,6 +145,7 @@ import org.apache.hop.ui.core.dialog.TransformFieldsDialog;
import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.gui.GuiToolbarWidgets;
import org.apache.hop.ui.core.gui.HopNamespace;
+import org.apache.hop.ui.core.gui.HopToolTip;
import org.apache.hop.ui.hopgui.CanvasFacade;
import org.apache.hop.ui.hopgui.CanvasListener;
import org.apache.hop.ui.hopgui.HopGui;
@@ -209,7 +210,6 @@ import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.ToolTip;
/**
* This class handles the display of the pipelines in a graphical way using
icons, arrows, etc. One
@@ -509,7 +509,7 @@ public class HopGuiPipelineGraph extends HopGuiAbstractGraph
sashForm.setWeights(100);
- toolTip = new ToolTip(getShell(), SWT.BALLOON);
+ toolTip = new HopToolTip(getShell());
toolTip.setAutoHide(true);
iconSize = hopGui.getProps().getIconSize();
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/shared/HopGuiAbstractGraph.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/shared/HopGuiAbstractGraph.java
index 0fe2429255..3278901a6a 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/shared/HopGuiAbstractGraph.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/shared/HopGuiAbstractGraph.java
@@ -33,6 +33,7 @@ import org.apache.hop.core.variables.Variables;
import org.apache.hop.ui.core.ConstUi;
import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.core.gui.GuiMenuWidgets;
+import org.apache.hop.ui.core.gui.HopToolTip;
import org.apache.hop.ui.hopgui.HopGui;
import org.apache.hop.ui.hopgui.file.IGraphSnapAlignDistribute;
import org.apache.hop.ui.hopgui.file.IHopFileType;
@@ -41,7 +42,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolTip;
/**
* The beginnings of a common graph object, used by {@code
HopGuiWorkflowGraph} and {@code
@@ -62,7 +62,7 @@ public abstract class HopGuiAbstractGraph extends
DragViewZoomBase
protected Point noteOffset;
protected Rectangle resizeArea;
protected Resize resize;
- protected ToolTip toolTip;
+ protected HopToolTip toolTip;
protected String mouseOverName;
/**
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
index 4621258585..af11450392 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
@@ -105,6 +105,7 @@ import
org.apache.hop.ui.core.dialog.MessageDialogWithToggle;
import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.gui.GuiToolbarWidgets;
import org.apache.hop.ui.core.gui.HopNamespace;
+import org.apache.hop.ui.core.gui.HopToolTip;
import org.apache.hop.ui.hopgui.CanvasFacade;
import org.apache.hop.ui.hopgui.CanvasListener;
import org.apache.hop.ui.hopgui.HopGui;
@@ -173,7 +174,6 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.ToolTip;
/** Handles the display of Workflows in HopGui, in a graphical form. */
@GuiPlugin(name = "i18n::WorkflowGraph.Name", description = "Workflow Graph
GUI plugin")
@@ -421,7 +421,7 @@ public class HopGuiWorkflowGraph extends HopGuiAbstractGraph
sashForm.setWeights(100);
- toolTip = new ToolTip(getShell(), SWT.BALLOON);
+ toolTip = new HopToolTip(getShell());
toolTip.setAutoHide(true);
newProps();