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