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 2fc8d02cbe fix fetch more rows, and unneeded selection dialog, fixes 
#6763 (#6917)
2fc8d02cbe is described below

commit 2fc8d02cbe13f186492e662eae4156ebc0d717b0
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Wed Apr 1 11:22:25 2026 +0200

    fix fetch more rows, and unneeded selection dialog, fixes #6763 (#6917)
---
 .../ui/hopgui/dialog/EnterPreviewRowsDialog.java   | 25 ++++++++----
 .../hopgui/file/pipeline/HopGuiPipelineGraph.java  |  7 ++--
 .../delegates/HopGuiPipelineRunDelegate.java       | 46 ++++++----------------
 3 files changed, 34 insertions(+), 44 deletions(-)

diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/dialog/EnterPreviewRowsDialog.java 
b/ui/src/main/java/org/apache/hop/ui/hopgui/dialog/EnterPreviewRowsDialog.java
index d65c12e744..c6c08301e9 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/dialog/EnterPreviewRowsDialog.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/dialog/EnterPreviewRowsDialog.java
@@ -155,10 +155,11 @@ public class EnterPreviewRowsDialog extends Dialog {
 
     BaseTransformDialog.setSize(shell);
 
-    // Immediately show the only preview entry
     if (transformNames.size() == 1) {
       wTransformList.select(0);
-      show();
+      showPreviewForIndex(parent, 0);
+      dispose();
+      return transformName;
     }
 
     shell.open();
@@ -190,18 +191,28 @@ public class EnterPreviewRowsDialog extends Dialog {
     }
 
     int nr = wTransformList.getSelectionIndex();
+    if (nr < 0) {
+      return;
+    }
+    showPreviewForIndex(shell, nr);
+  }
+
+  private void showPreviewForIndex(Shell parentShell, int index) {
+    if (rowDatas.isEmpty() || index < 0 || index >= rowDatas.size()) {
+      return;
+    }
 
-    java.util.List<Object[]> buffer = rowDatas.get(nr);
-    IRowMeta rowMeta = rowMetas.get(nr);
-    String name = transformNames.get(nr);
+    java.util.List<Object[]> buffer = rowDatas.get(index);
+    IRowMeta rowMeta = rowMetas.get(index);
+    String name = transformNames.get(index);
 
     if (rowMeta != null && !Utils.isEmpty(buffer)) {
       PreviewRowsDialog prd =
           new PreviewRowsDialog(
-              shell, Variables.getADefaultVariableSpace(), SWT.NONE, name, 
rowMeta, buffer);
+              parentShell, Variables.getADefaultVariableSpace(), SWT.NONE, 
name, rowMeta, buffer);
       prd.open();
     } else {
-      MessageBox mb = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
+      MessageBox mb = new MessageBox(parentShell, SWT.ICON_INFORMATION | 
SWT.OK);
       mb.setText(
           BaseMessages.getString(PKG, 
"EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Title"));
       mb.setMessage(
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 4a56346df9..99616f62c9 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
@@ -3937,8 +3937,8 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
           hopGui.getLog(),
           pipelineMeta,
           false,
-          debug,
-          
pipelineRunDelegate.getPipelinePreviewExecutionConfiguration().getLogLevel());
+          true,
+          
pipelineRunDelegate.getPipelineDebugExecutionConfiguration().getLogLevel());
     } catch (Exception e) {
       new ErrorDialog(hopShell(), CONST_ERROR, 
CONST_ERROR_PREVIEWING_PIPELINE, e);
     }
@@ -4733,7 +4733,8 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
                       transformDebugMeta.getTransformMeta().getName(),
                       rowBufferMeta,
                       rowBuffer);
-              previewRowsDialog.setProposingToGetMoreRows(true);
+              boolean pipelineStillRunning = pipeline != null && 
!pipeline.isFinished();
+              
previewRowsDialog.setProposingToGetMoreRows(pipelineStillRunning);
               previewRowsDialog.setProposingToStop(true);
               previewRowsDialog.open();
 
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/delegates/HopGuiPipelineRunDelegate.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/delegates/HopGuiPipelineRunDelegate.java
index 4e2b2d712d..e989d8e63f 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/delegates/HopGuiPipelineRunDelegate.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/delegates/HopGuiPipelineRunDelegate.java
@@ -109,49 +109,29 @@ public class HopGuiPipelineRunDelegate {
     //
     pipelineMeta.setMetadataProvider(hopGui.getMetadataProvider());
 
-    if (debug) {
-      // See if we have debugging information stored somewhere?
-      //
-      pipelineDebugMeta = pipelineDebugMetaMap.get(pipelineMeta);
-      if (pipelineDebugMeta == null) {
-        pipelineDebugMeta = new PipelineDebugMeta(pipelineMeta);
-        pipelineDebugMetaMap.put(pipelineMeta, pipelineDebugMeta);
-      }
-
-      // Set the default number of rows to retrieve on all selected 
transforms...
-      //
-      List<TransformMeta> selectedTransforms = 
pipelineMeta.getSelectedTransforms();
-      if (!Utils.isEmpty(selectedTransforms)) {
-        pipelineDebugMeta.getTransformDebugMetaMap().clear();
-        for (TransformMeta transformMeta : 
pipelineMeta.getSelectedTransforms()) {
-          TransformDebugMeta transformDebugMeta = new 
TransformDebugMeta(transformMeta);
-          
transformDebugMeta.setRowCount(PropsUi.getInstance().getDefaultPreviewSize());
-          transformDebugMeta.setPausingOnBreakPoint(true);
-          transformDebugMeta.setReadingFirstRows(false);
-          pipelineDebugMeta.getTransformDebugMetaMap().put(transformMeta, 
transformDebugMeta);
-        }
-      }
-
-    } else if (preview) {
-      // See if we have preview information stored somewhere?
-      //
-      pipelineDebugMeta = pipelinePreviewMetaMap.get(pipelineMeta);
+    if (debug || preview) {
+      // Both debug and preview collect the first N rows from the selected 
transform.
+      // Debug additionally activates the pause-on-break-point flag so the 
pipeline pauses
+      // after delivering the rows, giving Stop/Next control in the preview 
dialog.
+      Map<PipelineMeta, PipelineDebugMeta> metaMap =
+          debug ? pipelineDebugMetaMap : pipelinePreviewMetaMap;
+      pipelineDebugMeta = metaMap.get(pipelineMeta);
       if (pipelineDebugMeta == null) {
         pipelineDebugMeta = new PipelineDebugMeta(pipelineMeta);
-
-        pipelinePreviewMetaMap.put(pipelineMeta, pipelineDebugMeta);
+        metaMap.put(pipelineMeta, pipelineDebugMeta);
       }
+      // Reset execution-state flag from any previous run so the finished 
listener
+      // is not silently skipped when the same PipelineDebugMeta object is 
reused.
+      pipelineDebugMeta.setStopClosePressed(false);
 
-      // Set the default number of preview rows on all selected transforms...
-      //
       List<TransformMeta> selectedTransforms = 
pipelineMeta.getSelectedTransforms();
       if (!Utils.isEmpty(selectedTransforms)) {
         pipelineDebugMeta.getTransformDebugMetaMap().clear();
         for (TransformMeta transformMeta : 
pipelineMeta.getSelectedTransforms()) {
           TransformDebugMeta transformDebugMeta = new 
TransformDebugMeta(transformMeta);
           
transformDebugMeta.setRowCount(PropsUi.getInstance().getDefaultPreviewSize());
-          transformDebugMeta.setPausingOnBreakPoint(false);
           transformDebugMeta.setReadingFirstRows(true);
+          transformDebugMeta.setPausingOnBreakPoint(debug);
           pipelineDebugMeta.getTransformDebugMetaMap().put(transformMeta, 
transformDebugMeta);
         }
       }
@@ -165,8 +145,6 @@ public class HopGuiPipelineRunDelegate {
               hopGui.getShell(), pipelineGraph.getVariables(), 
pipelineDebugMeta);
       debugAnswer = pipelineDebugDialog.open();
       if (debugAnswer == PipelineDebugDialog.DEBUG_CANCEL) {
-        // If we cancel the debug dialog, we don't go further with the 
execution either.
-        //
         return null;
       }
     }

Reply via email to