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 c967acb518 Dialog close not registerd as cancel, fixes #6509 (#6519)
c967acb518 is described below

commit c967acb518ca5cae8bb08e61f5e98e3ccf917542
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Fri Feb 6 15:44:09 2026 +0100

    Dialog close not registerd as cancel, fixes #6509 (#6519)
---
 .../apache/hop/ui/core/dialog/MessageDialogWithToggle.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git 
a/ui/src/main/java/org/apache/hop/ui/core/dialog/MessageDialogWithToggle.java 
b/ui/src/main/java/org/apache/hop/ui/core/dialog/MessageDialogWithToggle.java
index 7bf05a8b72..e0f76b54cb 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/core/dialog/MessageDialogWithToggle.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/core/dialog/MessageDialogWithToggle.java
@@ -54,6 +54,7 @@ public class MessageDialogWithToggle {
   private Shell shell;
   private final PropsUi props;
   private int returnCode = OK;
+  private boolean buttonClicked = false;
 
   public MessageDialogWithToggle(
       Shell parent,
@@ -139,6 +140,7 @@ public class MessageDialogWithToggle {
       buttons[i].addListener(
           SWT.Selection,
           e -> {
+            buttonClicked = true;
             returnCode = index;
             dispose();
           });
@@ -149,6 +151,15 @@ public class MessageDialogWithToggle {
     BaseTransformDialog.setSize(shell);
     shell.pack();
 
+    // When user closes the dialog with X, treat it as cancel (do not exit / 
no)
+    shell.addListener(
+        SWT.Close,
+        e -> {
+          if (!buttonClicked) {
+            cancel();
+          }
+        });
+
     shell.open();
     while (!shell.isDisposed()) {
       if (!display.readAndDispatch()) {

Reply via email to