]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java
add MigrationTool
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / FirstPanel.java
index b933dac0ea79d6506a98b197573d237980214aac..d0f9151ed7fe613b7ef2f1c134559d610884aa27 100644 (file)
@@ -24,7 +24,7 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
         */\r
        private static final long serialVersionUID = 207759413522910399L;\r
        \r
-       private String modulepath;\r
+       private String startpath;\r
        private ModuleInfo mi;\r
        \r
        private JButton moduleButton, goButton, msaEditorButton, criticButton;\r
@@ -65,14 +65,15 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
                \r
                mibox = new JCheckBox("Print ModuleInfo", false);\r
                mibox.addItemListener(this);\r
-               ModuleInfo.printModuleInfo = false;\r
+               MigrationTool.printModuleInfo = false;\r
                \r
                criticbox = new JCheckBox("Run Critic", true);\r
                criticbox.addItemListener(this);\r
-               ModuleInfo.doCritic = true;\r
+               MigrationTool.doCritic = true;\r
                \r
                defaultpathbox = new JCheckBox("Use Default Output Path", true);\r
                defaultpathbox.addItemListener(this);\r
+               MigrationTool.defaultoutput = true;\r
                \r
         JPanel modulePanel = new JPanel();\r
         modulePanel.add(moduleButton);\r
@@ -114,8 +115,8 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
         add(logScrollPane);\r
         \r
                fc = new JFileChooser();\r
-        fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);\r
-       }\r
+        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\r
+       }\r
        \r
        //---------------------------------------------------------------------------------------//\r
        \r
@@ -157,7 +158,8 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
 \r
        //---------------------------------------------------------------------------------------//\r
 \r
-       public String getFilepath() {\r
+       public String getFilepath(String title) {\r
+               fc.setDialogTitle(title);\r
                if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {\r
                        log.append(fc.getSelectedFile().getAbsolutePath() + "\n");\r
                        return fc.getSelectedFile().getAbsolutePath();\r
@@ -169,12 +171,13 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
 \r
     public void actionPerformed(ActionEvent e) {\r
         if ( e.getSource() == moduleButton ) {\r
-               modulepath = getFilepath();\r
+               startpath = getFilepath("Please choose a starting path");\r
+               moduletext.setText(startpath);\r
         }\r
         if ( e.getSource() == goButton ) {\r
                try {\r
-                       logfile = new PrintWriter(new BufferedWriter(new FileWriter(modulepath + File.separator + "migration.log")));\r
-                       ModuleInfo.triger(modulepath);\r
+                       logfile = new PrintWriter(new BufferedWriter(new FileWriter(startpath.replaceAll(Common.strseparate, "$1") + File.separator + "migration.log")));\r
+                       MigrationTool.triger(startpath);\r
                        logfile.flush();\r
                } catch (Exception en) {\r
                        println(en.getMessage());\r
@@ -189,7 +192,7 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
         }\r
         if ( e.getSource() == criticButton) {\r
                try {\r
-                       Critic.fireAt(modulepath);\r
+                       Critic.fireAt(startpath);\r
                } catch (Exception en) {\r
                        println(en.getMessage());\r
                }\r
@@ -211,23 +214,21 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
                }\r
        } else if (e.getSource() == mibox) {\r
                if (e.getStateChange() == ItemEvent.DESELECTED) {\r
-                       ModuleInfo.printModuleInfo = false;\r
+                       MigrationTool.printModuleInfo = false;\r
                } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
-                       ModuleInfo.printModuleInfo = true;\r
+                       MigrationTool.printModuleInfo = true;\r
                }\r
        } else if (e.getSource() == criticbox) {\r
                if (e.getStateChange() == ItemEvent.DESELECTED) {\r
-                       ModuleInfo.doCritic = false;\r
-                       System.out.println("criticbox DESELECTED");\r
+                       MigrationTool.doCritic = false;\r
                } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
-                       ModuleInfo.doCritic = true;\r
-                       System.out.println("criticbox SELECTED");\r
+                       MigrationTool.doCritic = true;\r
                }\r
        } else if (e.getSource() == defaultpathbox) {\r
                if (e.getStateChange() == ItemEvent.DESELECTED) {\r
-                       System.out.println("defaultpathbox DESELECTED");\r
+                       MigrationTool.defaultoutput = false;\r
                } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
-                       System.out.println("defaultpathbox SELECTED");\r
+                       MigrationTool.defaultoutput = true;\r
                }\r
        }\r
     }\r