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 2021/09/09 11:30:50 UTC

[incubator-hop] branch master updated: HOP-3232 - TokenReplacement not using file explorer dialog

This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git


The following commit(s) were added to refs/heads/master by this push:
     new 0099820  HOP-3232 - TokenReplacement not using file explorer dialog
     new ca45dae  Merge pull request #1047 from sramazzina/HOP-3232
0099820 is described below

commit 00998201a2c6d4201080aa4585b0e0135f8e13f1
Author: sergio.ramazzina <se...@serasoft.it>
AuthorDate: Wed Sep 8 18:22:08 2021 +0200

    HOP-3232 - TokenReplacement not using file explorer dialog
---
 .../tokenreplacement/TokenReplacementDialog.java   | 60 ++++++++--------------
 1 file changed, 21 insertions(+), 39 deletions(-)

diff --git a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java
index ba1f03b..9b2a82d 100644
--- a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java
+++ b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java
@@ -1237,45 +1237,27 @@ public class TokenReplacementDialog extends BaseTransformDialog implements ITran
           }
         });
 
-    wbInputFilename.addSelectionListener(
-        new SelectionAdapter() {
-          @Override
-          public void widgetSelected(SelectionEvent e) {
-            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
-            dialog.setFilterExtensions(new String[] {"*"});
-            if (wInputFilename.getText() != null) {
-              dialog.setFileName(variables.resolve(wInputFilename.getText()));
-            }
-            dialog.setFilterNames(
-                new String[] {BaseMessages.getString(PKG, "System.FileType.AllFiles")});
-            if (dialog.open() != null) {
-              wInputFilename.setText(
-                  dialog.getFilterPath()
-                      + System.getProperty("file.separator")
-                      + dialog.getFileName());
-            }
-          }
-        });
-
-    wbOutputFilename.addSelectionListener(
-        new SelectionAdapter() {
-          @Override
-          public void widgetSelected(SelectionEvent e) {
-            FileDialog dialog = new FileDialog(shell, SWT.SAVE);
-            dialog.setFilterExtensions(new String[] {"*"});
-            if (wOutputFilename.getText() != null) {
-              dialog.setFileName(variables.resolve(wOutputFilename.getText()));
-            }
-            dialog.setFilterNames(
-                new String[] {BaseMessages.getString(PKG, "System.FileType.AllFiles")});
-            if (dialog.open() != null) {
-              wOutputFilename.setText(
-                  dialog.getFilterPath()
-                      + System.getProperty("file.separator")
-                      + dialog.getFileName());
-            }
-          }
-        });
+    wbInputFilename.addListener(
+        SWT.Selection,
+        e ->
+            BaseDialog.presentFileDialog(
+                shell,
+                wInputFilename,
+                variables,
+                new String[] {"*"},
+                new String[] {BaseMessages.getString(PKG, "System.FileType.AllFiles")},
+                true));
+
+    wbOutputFilename.addListener(
+        SWT.Selection,
+        e ->
+            BaseDialog.presentFileDialog(
+                shell,
+                wOutputFilename,
+                variables,
+                new String[] {"*"},
+                new String[] {BaseMessages.getString(PKG, "System.FileType.AllFiles")},
+                true));
 
     lsResize =
         new Listener() {