From 5ad6d22a16fa4f18fd03880a18fb88e654a627ac Mon Sep 17 00:00:00 2001 From: alfred Date: Fri, 1 Sep 2006 06:19:05 +0000 Subject: [PATCH] add lisence modify ui func git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1421 6f19259b-4bc3-4df7-8a09-765794883524 --- .../org/tianocore/migration/FirstPanel.java | 13 +++++-------- .../org/tianocore/migration/MigrationTool.java | 16 +++++++++++++++- .../org/tianocore/migration/MsaTreeEditor.java | 11 +++-------- .../org/tianocore/migration/PathIterator.java | 12 ++++++++++++ .../org/tianocore/migration/UI.java | 2 +- 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java b/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java index ce15570807..90274d0910 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java @@ -27,12 +27,11 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList private static final FirstPanel INSTANCE = FirstPanel.init(); private String startpath; - private ModuleInfo mi; private JButton moduleButton, goButton, msaEditorButton, criticButton, specifyCommentButton; private JTextField moduletext; private JTextArea log; - private JFileChooser fc; + private JFileChooser fc = new JFileChooser(); private JCheckBox filebox, screenbox, mibox, criticbox, defaultpathbox; private boolean tofile = true, toscreen = true; @@ -120,9 +119,6 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList cst.fill = GridBagConstraints.BOTH; gridbag.setConstraints(logScrollPane, cst); add(logScrollPane); - - fc = new JFileChooser(); - fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } //---------------------------------------------------------------------------------------// @@ -165,8 +161,9 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList //---------------------------------------------------------------------------------------// - public String getFilepath(String title) { + public String getFilepath(String title, int mode) { fc.setDialogTitle(title); + fc.setFileSelectionMode(mode); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { log.append(fc.getSelectedFile().getAbsolutePath() + "\n"); return fc.getSelectedFile().getAbsolutePath(); @@ -178,7 +175,7 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList public void actionPerformed(ActionEvent e) { if ( e.getSource() == moduleButton ) { - startpath = getFilepath("Please choose a starting path"); + startpath = getFilepath("Please choose a starting path", JFileChooser.DIRECTORIES_ONLY); moduletext.setText(startpath); } if ( e.getSource() == goButton ) { @@ -192,7 +189,7 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList } if ( e.getSource() == msaEditorButton) { try { - MsaTreeEditor.init(mi, this); + MsaTreeEditor.init(); } catch (Exception en) { println(en.getMessage()); } diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java index 3b3486fea6..cbb49a13da 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java @@ -1,8 +1,22 @@ +/** @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.io.File; import java.util.*; +import javax.swing.JFileChooser; + public class MigrationTool { public static UI ui = null; public static Database db = null; @@ -64,7 +78,7 @@ public class MigrationTool { if (MigrationTool.defaultoutput) { return inputpath.replaceAll(Common.strseparate, "$1"); } else { - return MigrationTool.ui.getFilepath("Please choose where to place the output module"); + return MigrationTool.ui.getFilepath("Please choose where to place the output module", JFileChooser.DIRECTORIES_ONLY); } } diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java b/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java index 7bdf028119..81870c09e5 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java @@ -41,10 +41,7 @@ public class MsaTreeEditor extends JPanel { addNode(rootNode, "2nd"); } */ - MsaTreeEditor(ModuleInfo m, UI u) { - mi = m; - ui = u; - + MsaTreeEditor() { rootNode = new DefaultMutableTreeNode("Root Node"); treeModel = new DefaultTreeModel(rootNode); @@ -69,8 +66,6 @@ public class MsaTreeEditor extends JPanel { addNode(rootNode, "2nd"); } - private ModuleInfo mi; - private UI ui; //private ModuleSurfaceAreaDocument msadoc; private JTree tree; @@ -115,13 +110,13 @@ public class MsaTreeEditor extends JPanel { init(mi, ui); } */ - public static void init(ModuleInfo mi, UI ui) throws Exception { + public static void init() throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JFrame frame = new JFrame("MsaTreeEditor"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - MsaTreeEditor mte = new MsaTreeEditor(mi, ui); + MsaTreeEditor mte = new MsaTreeEditor(); mte.setLayout(new GridBagLayout()); mte.setOpaque(true); frame.setContentPane(mte); diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java b/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java index 0207577ba3..00dfe719aa 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.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.util.*; diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/UI.java b/Tools/Source/MigrationTools/org/tianocore/migration/UI.java index 2ad306d132..9a77a53068 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/UI.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/UI.java @@ -28,5 +28,5 @@ public interface UI { public String getInput(String message); - public String getFilepath(String title); // necessary ? + public String getFilepath(String title, int mode); // necessary ? } -- 2.39.2