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 ef38aff  HOP-2769 Property Input and Property Output: changed by using 
file browser for files input/output. Minor corrections to italian translations
     new b43dd67  Merge pull request #806 from sramazzina/master
ef38aff is described below

commit ef38affdae24189834540ac9b9e6927657dd495b
Author: sergio.ramazzina <[email protected]>
AuthorDate: Mon May 17 10:32:01 2021 +0200

    HOP-2769 Property Input and Property Output: changed by using file browser 
for files input/output. Minor corrections to italian translations
---
 .../perspective/messages/messages_it_IT.properties |  2 +-
 .../propertyinput/PropertyInputDialog.java         | 51 +++++-----------------
 .../propertyoutput/PropertyOutputDialog.java       | 36 ++++-----------
 3 files changed, 19 insertions(+), 70 deletions(-)

diff --git 
a/plugins/tech/neo4j/src/main/resources/org/apache/hop/neo4j/perspective/messages/messages_it_IT.properties
 
b/plugins/tech/neo4j/src/main/resources/org/apache/hop/neo4j/perspective/messages/messages_it_IT.properties
index 3c3826d..dada537 100644
--- 
a/plugins/tech/neo4j/src/main/resources/org/apache/hop/neo4j/perspective/messages/messages_it_IT.properties
+++ 
b/plugins/tech/neo4j/src/main/resources/org/apache/hop/neo4j/perspective/messages/messages_it_IT.properties
@@ -16,7 +16,7 @@
 #
 #
 
-Neo4jPerspectiveDialog.Shell.Title=La storia dell'esecuzione delle query 
\u00E8 memorizzata in un Neo4j Audit Graph
+Neo4jPerspectiveDialog.Shell.Title=La storia dell''esecuzione delle query 
\u00E8 memorizzata in un Neo4j Audit Graph
 Neo4jPerspectiveDialog.Neo4J.Logging.Path.Label=NEO4J_LOGGING_CONNECTION punta 
a 
 Neo4jPerspectiveDialog.PipelineActionName.Label=Nome della pipeline o del 
workflow da visualizzare: 
 Neo4jPerspectiveDialog.ShowLast.Label=Mostra gli ultimi 
diff --git 
a/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputDialog.java
 
b/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputDialog.java
index ccc983e..23e7379 100644
--- 
a/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputDialog.java
+++ 
b/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputDialog.java
@@ -1029,47 +1029,16 @@ public class PropertyInputDialog extends 
BaseTransformDialog implements ITransfo
     wFilename.addModifyListener( e -> wFilename.setToolTipText( "" ) );
 
     // Listen to the Browse... button
-    wbbFilename.addSelectionListener( new SelectionAdapter() {
-      @Override
-      public void widgetSelected( SelectionEvent e ) {
-        if ( !Utils.isEmpty( wFilemask.getText() ) || !Utils.isEmpty( 
wExcludeFilemask.getText() ) ) { // A mask: a directory!
-          DirectoryDialog dialog = new DirectoryDialog( shell, SWT.OPEN );
-          if ( wFilename.getText() != null ) {
-            String fpath = "";
-            dialog.setFilterPath( fpath );
-          }
-
-          if ( dialog.open() != null ) {
-            String str = dialog.getFilterPath();
-            wFilename.setText( str );
-          }
-        } else {
-          FileDialog dialog = new FileDialog( shell, SWT.OPEN );
-
-          if ( PropertyInputMeta.getFileTypeByDesc( wFileType.getText() ) == 
PropertyInputMeta.FILE_TYPE_PROPERTY ) {
-            dialog.setFilterExtensions( new String[] { 
"*.properties;*.PROPERTIES", "*" } );
-            dialog.setFilterNames( new String[] {
-              BaseMessages.getString( PKG, 
"PropertyInputDialog.FileType.PropertiesFiles" ),
-              BaseMessages.getString( PKG, "System.FileType.AllFiles" ) } );
-          } else {
-            dialog.setFilterExtensions( new String[] { "*.ini;*.INI", "*" } );
-            dialog.setFilterNames( new String[] {
-              BaseMessages.getString( PKG, 
"PropertyInputDialog.FileType.INIFiles" ),
-              BaseMessages.getString( PKG, "System.FileType.AllFiles" ) } );
-          }
-
-          if ( wFilename.getText() != null ) {
-            String fname = "";
-            dialog.setFileName( fname );
-          }
-
-          if ( dialog.open() != null ) {
-            String str = dialog.getFilterPath() + System.getProperty( 
"file.separator" ) + dialog.getFileName();
-            wFilename.setText( str );
-          }
-        }
-      }
-    } );
+    wbbFilename.addListener( SWT.Selection, e-> BaseDialog.presentFileDialog( 
shell, wFilename, variables,
+              (PropertyInputMeta.getFileTypeByDesc( wFileType.getText() ) == 
PropertyInputMeta.FILE_TYPE_PROPERTY) ?
+                new String[] { "*.properties;*.PROPERTIES", "*" }  : new 
String[] { "*.ini;*.INI", "*" } ,
+              (PropertyInputMeta.getFileTypeByDesc( wFileType.getText() ) == 
PropertyInputMeta.FILE_TYPE_PROPERTY) ?
+                new String[] { BaseMessages.getString( PKG, 
"PropertyInputDialog.FileType.PropertiesFiles" ),
+                    BaseMessages.getString( PKG, "System.FileType.AllFiles" ) 
} :
+                new String[] { BaseMessages.getString( PKG, 
"PropertyInputDialog.FileType.INIFiles" ),
+                    BaseMessages.getString( PKG, "System.FileType.AllFiles" ) 
},
+            true )
+    );
 
     // Detect X or ALT-F4 or something that kills this window...
     shell.addShellListener( new ShellAdapter() {
diff --git 
a/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputDialog.java
 
b/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputDialog.java
index 0adce8c..df86ea3 100644
--- 
a/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputDialog.java
+++ 
b/plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputDialog.java
@@ -26,6 +26,7 @@ import org.apache.hop.i18n.BaseMessages;
 import org.apache.hop.pipeline.PipelineMeta;
 import org.apache.hop.pipeline.transform.BaseTransformMeta;
 import org.apache.hop.pipeline.transform.ITransformDialog;
+import org.apache.hop.ui.core.dialog.BaseDialog;
 import org.apache.hop.ui.core.dialog.EnterSelectionDialog;
 import org.apache.hop.ui.core.dialog.ErrorDialog;
 import org.apache.hop.ui.core.widget.ComboVar;
@@ -606,34 +607,13 @@ public class PropertyOutputDialog extends 
BaseTransformDialog implements ITransf
 
     wTransformName.addSelectionListener( lsDef );
 
-    wbFilename.addSelectionListener( new SelectionAdapter() {
-      public void widgetSelected( SelectionEvent e ) {
-        FileDialog dialog = new FileDialog( shell, SWT.SAVE );
-        dialog.setFilterExtensions( new String[] { "*.txt", "*.TXT", "*" } );
-        if ( wFilename.getText() != null ) {
-          dialog.setFileName( variables.resolve( wFilename.getText() ) );
-        }
-        dialog.setFilterNames( new String[] {
-          BaseMessages.getString( PKG, "System.FileType.TextFiles" ),
-          BaseMessages.getString( PKG, "System.FileType.CSVFiles" ),
-          BaseMessages.getString( PKG, "System.FileType.AllFiles" ) } );
-        if ( dialog.open() != null ) {
-          String extension = wExtension.getText();
-          if ( extension != null
-            && dialog.getFileName() != null && dialog.getFileName().endsWith( 
"." + extension ) ) {
-            // The extension is filled in and matches the end
-            // of the selected file => Strip off the extension.
-            String fileName = dialog.getFileName();
-            wFilename.setText( dialog.getFilterPath()
-              + System.getProperty( "file.separator" )
-              + fileName.substring( 0, fileName.length() - ( 
extension.length() + 1 ) ) );
-          } else {
-            wFilename.setText( dialog.getFilterPath()
-              + System.getProperty( "file.separator" ) + dialog.getFileName() 
);
-          }
-        }
-      }
-    } );
+    wbFilename.addListener( SWT.Selection, e-> BaseDialog.presentFileDialog( 
shell, wFilename, variables,
+            new String[] { "*.txt", "*.csv", "*" },
+            new String[] { BaseMessages.getString( PKG, 
"System.FileType.TextFiles" ),
+                    BaseMessages.getString( PKG, "System.FileType.CSVFiles" ),
+                    BaseMessages.getString( PKG, "System.FileType.AllFiles" ) 
},
+            true )
+    );
 
     // Detect X or ALT-F4 or something that kills this window...
     shell.addShellListener( new ShellAdapter() {

Reply via email to