]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java
Many Many Modifies
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / FirstPanel.java
index 9f853e42f2e53cea900fa9a2b358d4cd1467db36..1d9cf64a618ac96ef5d70ef9a8194a3e3f2e58bd 100644 (file)
@@ -18,7 +18,7 @@ import java.io.*;
 import java.util.*;\r
 import javax.swing.*;\r
 \r
-public class FirstPanel extends JPanel implements ActionListener, UI {\r
+public final class FirstPanel extends JPanel implements ActionListener, UI {\r
        /**\r
         *  Define class Serial Version UID\r
         */\r
@@ -27,7 +27,7 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
        private String modulepath;\r
        private ModuleInfo mi;\r
        \r
-       private JButton moduleButton, goButton, msaEditorButton;\r
+       private JButton moduleButton, goButton, msaEditorButton, criticButton;\r
        private JTextField moduletext;\r
        private JTextArea log;\r
        private JFileChooser fc;\r
@@ -47,6 +47,9 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
                msaEditorButton = new JButton("MsaEditor");\r
                msaEditorButton.addActionListener(this);\r
                \r
+               criticButton = new JButton("Critic");\r
+               criticButton.addActionListener(this);\r
+               \r
                moduletext = new JTextField(30);\r
                \r
                filebox = new JCheckBox("Output to logfile", true);\r
@@ -58,7 +61,8 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
         modulePanel.add(filebox);\r
         modulePanel.add(screenbox);\r
         modulePanel.add(goButton);\r
-        modulePanel.add(msaEditorButton);\r
+        //modulePanel.add(msaEditorButton);\r
+        modulePanel.add(criticButton);\r
         add(modulePanel);\r
 \r
         log = new JTextArea(20,25);\r
@@ -111,21 +115,34 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
 \r
        //---------------------------------------------------------------------------------------//\r
 \r
+       public String getFilepath() {\r
+               if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {\r
+                       log.append(fc.getSelectedFile().getAbsolutePath() + "\n");\r
+                       return fc.getSelectedFile().getAbsolutePath();\r
+               }\r
+               return null;\r
+       }\r
+\r
+       //---------------------------------------------------------------------------------------//\r
+\r
     public void actionPerformed(ActionEvent e) {\r
         if ( e.getSource() == moduleButton ) {\r
+               modulepath = getFilepath();\r
+               /*\r
                int ret = fc.showOpenDialog(this);\r
                if (ret == JFileChooser.APPROVE_OPTION) {\r
                        modulepath = fc.getSelectedFile().getAbsolutePath();\r
                        moduletext.setText(modulepath);\r
                 log.append("ModulePath: " + modulepath + "\n");\r
                }\r
+               */\r
         }\r
         if ( e.getSource() == goButton ) {\r
                try {\r
                        logfile = new PrintWriter(new BufferedWriter(new FileWriter(modulepath + File.separator + "migration.log")));\r
                        println("Project MsaGen");\r
                        println("Copyright (c) 2006, Intel Corporation");\r
-                       mi = new ModuleInfo(modulepath, this, new Database());\r
+                       Common.toDoAll(modulepath, ModuleInfo.class.getMethod("seekModule", String.class), null, null, Common.DIR);\r
                        logfile.flush();\r
                } catch (Exception en) {\r
                        println(en.getMessage());\r
@@ -138,6 +155,13 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
                        println(en.getMessage());\r
                }\r
         }\r
+        if ( e.getSource() == criticButton) {\r
+               try {\r
+                       Critic.fireAt(modulepath);\r
+               } catch (Exception en) {\r
+                       println(en.getMessage());\r
+               }\r
+        }\r
     }\r
     \r
     public void itemStateChanged(ItemEvent e) {\r
@@ -148,7 +172,7 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
 \r
     //---------------------------------------------------------------------------------------//\r
     \r
-    public static void init() throws Exception {\r
+    public static FirstPanel init() throws Exception {\r
        \r
        //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());\r
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());\r
@@ -167,5 +191,7 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
 \r
                frame.pack();\r
                frame.setVisible(true);\r
+               \r
+               return fp;\r
     }\r
 }
\ No newline at end of file