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 560b9f5456 toolbar container fix, fixes #7477 (#7478)
560b9f5456 is described below
commit 560b9f545637bb8ea2caab667da83f2312dde553
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Fri Jul 10 11:13:07 2026 +0200
toolbar container fix, fixes #7477 (#7478)
---
.../hop/ui/hopgui/ToolBarToolbarContainer.java | 35 ----------------------
.../apache/hop/ui/core/gui/IToolbarContainer.java | 11 -------
.../hopgui/file/pipeline/HopGuiPipelineGraph.java | 3 --
.../hopgui/file/workflow/HopGuiWorkflowGraph.java | 3 --
4 files changed, 52 deletions(-)
diff --git
a/rcp/src/main/java/org/apache/hop/ui/hopgui/ToolBarToolbarContainer.java
b/rcp/src/main/java/org/apache/hop/ui/hopgui/ToolBarToolbarContainer.java
index 0b8b5841a1..4d536af919 100644
--- a/rcp/src/main/java/org/apache/hop/ui/hopgui/ToolBarToolbarContainer.java
+++ b/rcp/src/main/java/org/apache/hop/ui/hopgui/ToolBarToolbarContainer.java
@@ -20,13 +20,8 @@ package org.apache.hop.ui.hopgui;
import org.apache.hop.core.gui.plugin.toolbar.GuiToolbarItem;
import org.apache.hop.ui.core.gui.IToolbarContainer;
import org.apache.hop.ui.core.gui.IToolbarWidgetRegistrar;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
/** Desktop (RCP) toolbar container: wraps an SWT ToolBar. */
public class ToolBarToolbarContainer implements IToolbarContainer {
@@ -46,34 +41,4 @@ public class ToolBarToolbarContainer implements
IToolbarContainer {
public void addItem(GuiToolbarItem item, IToolbarWidgetRegistrar registrar) {
registrar.addItem(item, toolBar);
}
-
- @Override
- public void enableWrapAutoHeight() {
- // A SWT.WRAP toolbar wraps its items to extra rows when it is too narrow,
but it does not
- // grow its own allocated height to match. On every resize we measure the
real extent of the
- // (wrapped) items and feed it back into the FormData height so the layout
gives the toolbar
- // enough room and pushes the content below it down.
- toolBar.addListener(SWT.Resize, event -> adjustWrappedHeight());
- }
-
- private void adjustWrappedHeight() {
- if (toolBar.isDisposed() || !(toolBar.getLayoutData() instanceof FormData
formData)) {
- return;
- }
- int contentHeight = 0;
- for (ToolItem item : toolBar.getItems()) {
- Rectangle bounds = item.getBounds();
- contentHeight = Math.max(contentHeight, bounds.y + bounds.height);
- }
- // Nothing to measure yet, or the height already matches: avoid a
redundant re-layout (which
- // would otherwise loop, since re-laying out fires another Resize event).
- if (contentHeight <= 0 || formData.height == contentHeight) {
- return;
- }
- formData.height = contentHeight;
- Composite parent = toolBar.getParent();
- if (parent != null && !parent.isDisposed()) {
- parent.layout(true);
- }
- }
}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/IToolbarContainer.java
b/ui/src/main/java/org/apache/hop/ui/core/gui/IToolbarContainer.java
index b95e761d3d..ca74718179 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/gui/IToolbarContainer.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/gui/IToolbarContainer.java
@@ -35,15 +35,4 @@ public interface IToolbarContainer {
* the appropriate widgets and registers them via the registrar.
*/
void addItem(GuiToolbarItem item, IToolbarWidgetRegistrar registrar);
-
- /**
- * Desktop only: make the toolbar report its true (possibly wrapped,
multi-row) height to its
- * parent layout. When items wrap to a second line the toolbar then grows
and the content below it
- * is pushed down, instead of the extra rows overlapping the canvas or being
hidden. This requires
- * the toolbar control to use a {@link org.eclipse.swt.layout.FormData}
layout. No-op for the web
- * (RAP) container, whose RowLayout already self-sizes when it wraps.
- */
- default void enableWrapAutoHeight() {
- // No-op by default; only the desktop SWT ToolBar needs explicit
wrap-aware height handling.
- }
}
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 23c167d451..3c3854df29 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
@@ -2435,9 +2435,6 @@ public class HopGuiPipelineGraph extends
HopGuiAbstractGraph
layoutData.right = new FormAttachment(100, 0);
toolBar.setLayoutData(layoutData);
toolBar.pack();
- // Let the toolbar grow its height when its items wrap to a second row
so they don't overlap
- // the canvas below it.
- toolBarContainer.enableWrapAutoHeight();
PropsUi.setLook(toolBar, Props.WIDGET_STYLE_TOOLBAR);
// enable / disable the icons in the toolbar too.
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 a239387894..1efd2fe44c 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
@@ -1941,9 +1941,6 @@ public class HopGuiWorkflowGraph extends
HopGuiAbstractGraph
layoutData.right = new FormAttachment(100, 0);
toolBar.setLayoutData(layoutData);
toolBar.pack();
- // Let the toolbar grow its height when its items wrap to a second row
so they don't overlap
- // the canvas below it.
- toolBarContainer.enableWrapAutoHeight();
PropsUi.setLook(toolBar, Props.WIDGET_STYLE_TOOLBAR);
// enable / disable the icons in the toolbar too.