You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2026/03/30 06:29:53 UTC

(hop) branch main updated: Fix Database lookup, Add new in Get Fields function do not work (#6897)

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 455f6dd7fc Fix Database lookup, Add new in Get Fields function do not work (#6897)
455f6dd7fc is described below

commit 455f6dd7fc5cbea9ffb2b51950ee1e7bc629433a
Author: Lance <le...@gmail.com>
AuthorDate: Mon Mar 30 14:29:46 2026 +0800

    Fix Database lookup, Add new in Get Fields function do not work (#6897)
    
    Signed-off-by: lance <le...@gmail.com>
---
 .../org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java | 13 ++++++++-----
 .../hop/ui/pipeline/transform/BaseTransformDialog.java      |  7 ++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java
index 1d553c97a4..675c7243a2 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java
@@ -50,7 +50,9 @@ public class DialogBoxWithButtons {
     this.message = message;
     this.buttonLabels = buttonLabels;
 
-    choice = new AtomicInteger();
+    // Default: -1. No button has been clicked; mainly used to distinguish from the index positions
+    // of other buttons, e.g., [0. Add new, 1. Add all, 2. Clear and add all, 3. Cancel].
+    choice = new AtomicInteger(-1);
   }
 
   public int open() {
@@ -110,11 +112,12 @@ public class DialogBoxWithButtons {
     return choice.get();
   }
 
-  private void close() {
-    choice.set(0xFF);
-  }
-
   private void dispose() {
+    // mark close,similar to choice = 3 (Cancel action)
+    if (choice.get() == -1) {
+      choice.set(0xFF);
+    }
+
     props.setScreen(new WindowProperty(shell));
     shell.dispose();
   }
diff --git a/ui/src/main/java/org/apache/hop/ui/pipeline/transform/BaseTransformDialog.java b/ui/src/main/java/org/apache/hop/ui/pipeline/transform/BaseTransformDialog.java
index 2f79ebefb3..b7b7a385f8 100644
--- a/ui/src/main/java/org/apache/hop/ui/pipeline/transform/BaseTransformDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/pipeline/transform/BaseTransformDialog.java
@@ -1141,7 +1141,6 @@ public abstract class BaseTransformDialog extends Dialog implements ITransformDi
     }
 
     int choice = 0;
-    boolean isOpenDialog = false;
 
     if (!keys.isEmpty()) {
       // Ask what we should do with the existing data in the transform.
@@ -1150,12 +1149,10 @@ public abstract class BaseTransformDialog extends Dialog implements ITransformDi
 
       int idx = getFieldsChoiceDialog.open();
       choice = idx & 0xFF;
-      // Mark that the dialog was actually opened.
-      isOpenDialog = true;
     }
 
-    // Cancel clicked, Close x
-    if ((choice == 0 && isOpenDialog) || choice == 3 || choice == 255) {
+    // Cancel (index 3), window closed without a button (0xFF), or undecided (-1 & 0xFF == 255)
+    if (choice == 3 || choice == 255) {
       return;
     }