This is an automated email from the ASF dual-hosted git repository.
bamaer 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 5f6f681715 Fixes #8874 : Reselect the execution results tab by title
on detach and dock (#8879)
5f6f681715 is described below
commit 5f6f681715d4bc4a105b1604d9a2272cb11f29fe
Author: Bart Maertens <[email protected]>
AuthorDate: Mon Oct 12 20:00:03 2026 +0200
Fixes #8874 : Reselect the execution results tab by title on detach and
dock (#8879)
---
.../hopgui/file/pipeline/HopGuiPipelineGraph.java | 33 ++++++++++++++++-----
.../hopgui/file/workflow/HopGuiWorkflowGraph.java | 34 +++++++++++++++++-----
2 files changed, 52 insertions(+), 15 deletions(-)
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 c0ad7b390b..8a01bf0ed9 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
@@ -6211,7 +6211,7 @@ public class HopGuiPipelineGraph extends
HopGuiAbstractGraph
if (extraViewShell != null || extraViewTabFolder == null ||
extraViewTabFolder.isDisposed()) {
return;
}
- int selection = extraViewTabFolder.getSelectionIndex();
+ String selection = selectedExtraViewTab();
// Tear down the docked folder without flipping the "show results" toolbar
state.
extraViewTabFolder.dispose();
@@ -6247,7 +6247,7 @@ public class HopGuiPipelineGraph extends
HopGuiAbstractGraph
if (extraViewShell == null) {
return;
}
- int selection = extraViewTabFolder == null ? 0 :
extraViewTabFolder.getSelectionIndex();
+ String selection = extraViewTabFolder == null ? null :
selectedExtraViewTab();
if (extraViewTabFolder != null && !extraViewTabFolder.isDisposed()) {
extraViewTabFolder.dispose();
@@ -6265,11 +6265,30 @@ public class HopGuiPipelineGraph extends
HopGuiAbstractGraph
selectExtraViewTab(selection);
}
- private void selectExtraViewTab(int index) {
- if (extraViewTabFolder != null
- && !extraViewTabFolder.isDisposed()
- && extraViewTabFolder.getItemCount() > 0) {
- extraViewTabFolder.setSelection(Math.clamp(index, 0,
extraViewTabFolder.getItemCount() - 1));
+ /** The title of the selected execution-results tab, or null when none is
selected. */
+ private String selectedExtraViewTab() {
+ CTabItem item = extraViewTabFolder.getSelection();
+ return item == null ? null : item.getText();
+ }
+
+ /**
+ * Select the tab with this title. Found by title, not by position:
detaching rebuilds every tab,
+ * so a panel which only showed Problems opened on Logging instead.
+ */
+ private void selectExtraViewTab(String title) {
+ if (extraViewTabFolder == null
+ || extraViewTabFolder.isDisposed()
+ || extraViewTabFolder.getItemCount() == 0) {
+ return;
+ }
+ for (CTabItem item : extraViewTabFolder.getItems()) {
+ if (item.getText().equals(title)) {
+ extraViewTabFolder.setSelection(item);
+ return;
+ }
+ }
+ if (extraViewTabFolder.getSelectionIndex() < 0) {
+ extraViewTabFolder.setSelection(0);
}
}
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 83ec0173da..d2b91bed12 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
@@ -5058,7 +5058,7 @@ public class HopGuiWorkflowGraph extends
HopGuiAbstractGraph
if (extraViewShell != null || extraViewTabFolder == null ||
extraViewTabFolder.isDisposed()) {
return;
}
- int selection = extraViewTabFolder.getSelectionIndex();
+ String selection = selectedExtraViewTab();
// Tear down the docked folder without flipping the "show results" toolbar
state.
extraViewTabFolder.dispose();
@@ -5094,7 +5094,7 @@ public class HopGuiWorkflowGraph extends
HopGuiAbstractGraph
if (extraViewShell == null) {
return;
}
- int selection = extraViewTabFolder == null ? 0 :
extraViewTabFolder.getSelectionIndex();
+ String selection = extraViewTabFolder == null ? null :
selectedExtraViewTab();
if (extraViewTabFolder != null && !extraViewTabFolder.isDisposed()) {
extraViewTabFolder.dispose();
@@ -5112,12 +5112,30 @@ public class HopGuiWorkflowGraph extends
HopGuiAbstractGraph
selectExtraViewTab(selection);
}
- private void selectExtraViewTab(int index) {
- if (extraViewTabFolder != null
- && !extraViewTabFolder.isDisposed()
- && extraViewTabFolder.getItemCount() > 0) {
- extraViewTabFolder.setSelection(
- Math.max(0, Math.min(index, extraViewTabFolder.getItemCount() - 1)));
+ /** The title of the selected execution-results tab, or null when none is
selected. */
+ private String selectedExtraViewTab() {
+ CTabItem item = extraViewTabFolder.getSelection();
+ return item == null ? null : item.getText();
+ }
+
+ /**
+ * Select the tab with this title. Found by title, not by position:
detaching rebuilds every tab,
+ * so a panel which only showed Problems opened on Logging instead.
+ */
+ private void selectExtraViewTab(String title) {
+ if (extraViewTabFolder == null
+ || extraViewTabFolder.isDisposed()
+ || extraViewTabFolder.getItemCount() == 0) {
+ return;
+ }
+ for (CTabItem item : extraViewTabFolder.getItems()) {
+ if (item.getText().equals(title)) {
+ extraViewTabFolder.setSelection(item);
+ return;
+ }
+ }
+ if (extraViewTabFolder.getSelectionIndex() < 0) {
+ extraViewTabFolder.setSelection(0);
}
}