]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java
Turn to Regex in ModuleReader.java
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / FirstPanel.java
index 342c01c44306b4a68909cf65853c92289fa0ef81..9f853e42f2e53cea900fa9a2b358d4cd1467db36 100644 (file)
@@ -1,3 +1,15 @@
+/** @file\r
\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution.  The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
+ **/\r
 package org.tianocore.migration;\r
 \r
 import java.awt.*;\r
@@ -13,8 +25,9 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
        private static final long serialVersionUID = 207759413522910399L;\r
        \r
        private String modulepath;\r
+       private ModuleInfo mi;\r
        \r
-       private JButton moduleButton , goButton;\r
+       private JButton moduleButton, goButton, msaEditorButton;\r
        private JTextField moduletext;\r
        private JTextArea log;\r
        private JFileChooser fc;\r
@@ -31,6 +44,9 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
                moduleButton = new JButton("Choose ModulePath");\r
                moduleButton.addActionListener(this);\r
 \r
+               msaEditorButton = new JButton("MsaEditor");\r
+               msaEditorButton.addActionListener(this);\r
+               \r
                moduletext = new JTextField(30);\r
                \r
                filebox = new JCheckBox("Output to logfile", true);\r
@@ -42,9 +58,10 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
         modulePanel.add(filebox);\r
         modulePanel.add(screenbox);\r
         modulePanel.add(goButton);\r
+        modulePanel.add(msaEditorButton);\r
         add(modulePanel);\r
 \r
-        log = new JTextArea(50,25);\r
+        log = new JTextArea(20,25);\r
         log.setMargin(new Insets(5,5,5,5));\r
         log.setEditable(false);\r
         JScrollPane logScrollPane = new JScrollPane(log);\r
@@ -84,15 +101,16 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
                }\r
        }\r
 \r
-       //---------------------------------------------------------------------------------------//\r
-       \r
-       /*\r
-       public boolean getOption(String item) {\r
-               if (item.matches("file")) {\r
-               }\r
+       public String choose(String message, Object[] choicelist) {\r
+               return (String)JOptionPane.showInputDialog(this, message,"Choose",JOptionPane.PLAIN_MESSAGE,null,choicelist,choicelist[0]);\r
        }\r
-       */\r
        \r
+       public String getInput(String message) {\r
+               return (String)JOptionPane.showInputDialog(message);\r
+       }\r
+\r
+       //---------------------------------------------------------------------------------------//\r
+\r
     public void actionPerformed(ActionEvent e) {\r
         if ( e.getSource() == moduleButton ) {\r
                int ret = fc.showOpenDialog(this);\r
@@ -107,12 +125,19 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
                        logfile = new PrintWriter(new BufferedWriter(new FileWriter(modulepath + File.separator + "migration.log")));\r
                        println("Project MsaGen");\r
                        println("Copyright (c) 2006, Intel Corporation");\r
-                       new ModuleInfo(modulepath, this, new Database());\r
+                       mi = new ModuleInfo(modulepath, this, new Database());\r
                        logfile.flush();\r
                } catch (Exception en) {\r
                        println(en.getMessage());\r
                }\r
         }\r
+        if ( e.getSource() == msaEditorButton) {\r
+               try {\r
+               MsaTreeEditor.init(mi, this);\r
+               } catch (Exception en) {\r
+                       println(en.getMessage());\r
+               }\r
+        }\r
     }\r
     \r
     public void itemStateChanged(ItemEvent e) {\r
@@ -124,8 +149,15 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
     //---------------------------------------------------------------------------------------//\r
     \r
     public static void init() throws Exception {\r
-               JFrame.setDefaultLookAndFeelDecorated(true);\r
-               JFrame frame = new JFrame("FrameDemo");\r
+       \r
+       //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());\r
+       UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());\r
+       //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");\r
+       //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");\r
+       //UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");\r
+       //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");\r
+       \r
+               JFrame frame = new JFrame("MigrationTools");\r
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
 \r
         FirstPanel fp = new FirstPanel();\r
@@ -133,7 +165,7 @@ public class FirstPanel extends JPanel implements ActionListener, UI {
                fp.setOpaque(true);\r
         frame.setContentPane(fp);\r
 \r
-               frame.setSize(800,600);\r
+               frame.pack();\r
                frame.setVisible(true);\r
     }\r
 }
\ No newline at end of file