matthiasblaesing commented on a change in pull request #2169:
URL: https://github.com/apache/netbeans/pull/2169#discussion_r475205365



##########
File path: 
ide/db.dataview/src/org/netbeans/modules/db/dataview/output/dataexport/DataViewTableDataExportFileChooser.java
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.db.dataview.output.dataexport;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import javax.swing.JTable;
+import javax.swing.filechooser.FileFilter;
+import org.netbeans.api.progress.BaseProgressUtils;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Periklis Ntanasis <[email protected]>
+ */
[email protected]({
+    "LBL_FILE_CHOOSER=Export Table Data",
+    "LBL_OVEWRITE_DIALOG=Confirm Data Export",
+    "MSG_OVEWRITE_DIALOG=File already exists.\nDo you want to overwrite it?",
+    "MSG_EXPORT_DATA=Export Data..."
+})
+public class DataViewTableDataExportFileChooser {
+
+    private static final List<DataExporter> EXPORTERS = Arrays.asList(
+            new CSVDataExporter(),
+            new TSVDataExporter(),
+            new XLSXDataExporter()
+    );
+
+    public static void extractAsFile(final JTable table) {
+        final JFileChooser fc = new JFileChooser();
+        fc.setAcceptAllFileFilterUsed(false);
+        EXPORTERS.forEach(exporter -> 
fc.addChoosableFileFilter(exporter.getFileFilter()));
+        int returnVal = fc.showDialog(null, Bundle.LBL_FILE_CHOOSER());
+        switch (returnVal) {
+            case JFileChooser.APPROVE_OPTION:
+                FileFilter filter = fc.getFileFilter();

Review comment:
       At this point I would store the value of `fc.getCurrentDirectory()` into 
a static variable `currentDirectory` and initialize the file chooser in line 51 
via `fc.setCurrentDirectory` to that value. The same is true for the selected 
file format. I would expect both value to be pretty constant when invoked 
multiple times.

##########
File path: ide/db.dataview/external/commons-collections4-4.4-license.txt
##########
@@ -0,0 +1,208 @@
+Name: Apache Commons Collections
+Version: 4.4
+License: Apache-2.0
+Description: The Apache Commons Collections package contains types that extend 
and augment the Java Collections Framework.
+Origin: Apache Software Foundation
+URL: https://commons.apache.org/proper/commons-collections/

Review comment:
       Apache Policy allows to drop license comment for certain files under 
strict conditions. We have verbatim exclusions for test files, but that 
historic and at some point might be removed. Having the licenseinfo now makes 
it easier in the future to remove the exclusion.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to