You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hop.apache.org by GitBox <gi...@apache.org> on 2021/05/17 18:12:18 UTC

[GitHub] [incubator-hop] sramazzina opened a new pull request #806: HOP-2769

sramazzina opened a new pull request #806:
URL: https://github.com/apache/incubator-hop/pull/806


   HOP-2769 Property Input and Property Output: changed by using file browser for files input/output. Minor corrections to italian translations
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-hop] hansva commented on a change in pull request #806: HOP-2769

Posted by GitBox <gi...@apache.org>.
hansva commented on a change in pull request #806:
URL: https://github.com/apache/incubator-hop/pull/806#discussion_r633353485



##########
File path: plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputDialog.java
##########
@@ -606,34 +607,13 @@ public void widgetDefaultSelected( SelectionEvent e ) {
 
     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 )
+    );

Review comment:
       the property input type uses .properties/.ini
   but the output will uses .txt,.csv?
   
   Maybe we should align this, or create a ticket for follow up (I know you only changed the code as it was)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-hop] hansva commented on a change in pull request #806: HOP-2769

Posted by GitBox <gi...@apache.org>.
hansva commented on a change in pull request #806:
URL: https://github.com/apache/incubator-hop/pull/806#discussion_r633353485



##########
File path: plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputDialog.java
##########
@@ -606,34 +607,13 @@ public void widgetDefaultSelected( SelectionEvent e ) {
 
     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 )
+    );

Review comment:
       the property input type uses .properties/.ini
   but the output will uses .txt,.csv?
   
   Maybe we should align this, or create a ticket for follow up (I know you only changed the code as it was)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-hop] sramazzina commented on a change in pull request #806: HOP-2769

Posted by GitBox <gi...@apache.org>.
sramazzina commented on a change in pull request #806:
URL: https://github.com/apache/incubator-hop/pull/806#discussion_r633426243



##########
File path: plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputDialog.java
##########
@@ -606,34 +607,13 @@ public void widgetDefaultSelected( SelectionEvent e ) {
 
     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 )
+    );

Review comment:
       I know and you are right. But, as you said, that was the original setting used int the system dialog. If you want I can open a ticket and take care about that.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-hop] hansva merged pull request #806: HOP-2769

Posted by GitBox <gi...@apache.org>.
hansva merged pull request #806:
URL: https://github.com/apache/incubator-hop/pull/806


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-hop] sramazzina commented on a change in pull request #806: HOP-2769

Posted by GitBox <gi...@apache.org>.
sramazzina commented on a change in pull request #806:
URL: https://github.com/apache/incubator-hop/pull/806#discussion_r633426243



##########
File path: plugins/transforms/propertyoutput/src/main/java/org/apache/hop/pipeline/transforms/propertyoutput/PropertyOutputDialog.java
##########
@@ -606,34 +607,13 @@ public void widgetDefaultSelected( SelectionEvent e ) {
 
     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 )
+    );

Review comment:
       I know and you are right. But, as you said, that was the original setting used int the system dialog. If you want I can open a ticket and take care about that.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-hop] hansva merged pull request #806: HOP-2769

Posted by GitBox <gi...@apache.org>.
hansva merged pull request #806:
URL: https://github.com/apache/incubator-hop/pull/806


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org