]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java
1. Wrap text by word when showing a message box
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / ToolChainConfig.java
index ddfb479cc40ce1ae56694bf2b85d7ec275fa3058..8b901cbcb68776a08b9745897f18d7643b487fb7 100644 (file)
@@ -35,6 +35,7 @@ import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableModel;\r
 \r
 import org.tianocore.frameworkwizard.common.DataType;\r
+import org.tianocore.frameworkwizard.common.IFileFilter;\r
 import org.tianocore.frameworkwizard.common.Log;\r
 import org.tianocore.frameworkwizard.common.Tools;\r
 import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigId;\r
@@ -348,7 +349,9 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
 \r
         if (arg0.getSource() == jButtonOpen) {\r
             JFileChooser fc = new JFileChooser();\r
-            fc.setAcceptAllFileFilterUsed(true);\r
+            fc.setAcceptAllFileFilterUsed(false);\r
+            IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);\r
+            fc.addChoosableFileFilter(iff);\r
             fc.setCurrentDirectory(new File(toolsDir));\r
 \r
             int result = fc.showOpenDialog(new JPanel());\r
@@ -359,8 +362,8 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
                     currentFile = fc.getSelectedFile().getPath();\r
                     this.setTitle("Tool Chain Configuration" + " [" + currentFile + "]");\r
                 } catch (IOException e) {\r
+                    Log.wrn(this.currentFile + "Read Error", e.getMessage());\r
                     Log.err(this.currentFile + "Read Error", e.getMessage());\r
-                    e.printStackTrace();\r
                     return;\r
                 }\r
                 this.showTable();\r
@@ -369,8 +372,10 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
 \r
         if (arg0.getSource() == jButtonSave) {\r
             JFileChooser fc = new JFileChooser();\r
-            fc.setAcceptAllFileFilterUsed(true);\r
-            fc.setSelectedFile(new File(currentFile));\r
+            fc.setAcceptAllFileFilterUsed(false);\r
+            IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);\r
+            fc.addChoosableFileFilter(iff);\r
+            fc.setCurrentDirectory(new File(toolsDir));\r
 \r
             int result = fc.showSaveDialog(new JPanel());\r
             if (result == JFileChooser.APPROVE_OPTION) {\r
@@ -378,8 +383,8 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
                 try {\r
                     vtcc.saveFile(currentFile);\r
                 } catch (IOException e) {\r
+                    Log.wrn(this.currentFile + "Write Error", e.getMessage());\r
                     Log.err(this.currentFile + "Write Error", e.getMessage());\r
-                    e.printStackTrace();\r
                     return;\r
                 }\r
             }\r
@@ -447,12 +452,12 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
      **/\r
     private boolean check() {\r
         if (isEmpty(this.jTextFieldName.getText())) {\r
-            Log.err("Add Tool Chain", "Name couldn't be empty!");\r
+            Log.wrn("Add Tool Chain", "Name couldn't be empty!");\r
             return false;\r
         }\r
 \r
         if (isEmpty(this.jTextFieldValue.getText())) {\r
-            Log.err("Add Tool Chain", "Value couldn't be empty");\r
+            Log.wrn("Add Tool Chain", "Value couldn't be empty");\r
             return false;\r
         }\r
         return true;\r