mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 14:44:28 +02:00
singleton of Database & FirstPanel
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1394 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
482407d3d6
commit
4f60c26f93
@ -17,15 +17,21 @@ import java.util.*;
|
|||||||
import java.util.regex.*;
|
import java.util.regex.*;
|
||||||
|
|
||||||
public final class Database {
|
public final class Database {
|
||||||
Database(String path) throws Exception {
|
private static final Database INSTANCE = Database.init();
|
||||||
|
|
||||||
|
Database(String path) {
|
||||||
DatabasePath = path;
|
DatabasePath = path;
|
||||||
|
|
||||||
|
try {
|
||||||
importDBLib("Library.csv");
|
importDBLib("Library.csv");
|
||||||
importDBGuid("Guid.csv", "Guid");
|
importDBGuid("Guid.csv", "Guid");
|
||||||
importDBGuid("Ppi.csv", "Ppi");
|
importDBGuid("Ppi.csv", "Ppi");
|
||||||
importDBGuid("Protocol.csv", "Protocol");
|
importDBGuid("Protocol.csv", "Protocol");
|
||||||
importDBMacro("Macro.csv");
|
importDBMacro("Macro.csv");
|
||||||
importListR8Only();
|
importListR8Only();
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String DatabasePath;
|
public String DatabasePath;
|
||||||
@ -166,11 +172,15 @@ public final class Database {
|
|||||||
|
|
||||||
//-------------------------------------init------------------------------------------//
|
//-------------------------------------init------------------------------------------//
|
||||||
|
|
||||||
public static Database init() throws Exception {
|
private static final Database init() {
|
||||||
if (System.getenv("WORKSPACE") == null) {
|
if (System.getenv("WORKSPACE") == null) {
|
||||||
return new Database("C:" + File.separator + "tianocore" + File.separator + "edk2" + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");
|
return new Database("C:" + File.separator + "tianocore" + File.separator + "edk2" + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");
|
||||||
} else {
|
} else {
|
||||||
return new Database(System.getenv("WORKSPACE") + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");
|
return new Database(System.getenv("WORKSPACE") + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final Database getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
|
|||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 207759413522910399L;
|
private static final long serialVersionUID = 207759413522910399L;
|
||||||
|
|
||||||
|
private static final FirstPanel INSTANCE = FirstPanel.init();
|
||||||
|
|
||||||
private String startpath;
|
private String startpath;
|
||||||
private ModuleInfo mi;
|
private ModuleInfo mi;
|
||||||
|
|
||||||
@ -36,7 +38,7 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
|
|||||||
private boolean tofile = true, toscreen = true;
|
private boolean tofile = true, toscreen = true;
|
||||||
private PrintWriter logfile;
|
private PrintWriter logfile;
|
||||||
|
|
||||||
FirstPanel() throws Exception {
|
FirstPanel() {
|
||||||
GridBagLayout gridbag = new GridBagLayout();
|
GridBagLayout gridbag = new GridBagLayout();
|
||||||
setLayout(gridbag);
|
setLayout(gridbag);
|
||||||
|
|
||||||
@ -235,14 +237,17 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
|
|||||||
|
|
||||||
//---------------------------------------------------------------------------------------//
|
//---------------------------------------------------------------------------------------//
|
||||||
|
|
||||||
public static FirstPanel init() throws Exception {
|
private static final FirstPanel init() {
|
||||||
|
try {
|
||||||
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
|
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
|
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
|
||||||
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
||||||
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
//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.gtk.GTKLookAndFeel");
|
||||||
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
|
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
JFrame frame = new JFrame("MigrationTools");
|
JFrame frame = new JFrame("MigrationTools");
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
@ -258,4 +263,8 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
|
|||||||
|
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final FirstPanel getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
@ -4,6 +4,15 @@ import java.io.File;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class MigrationTool {
|
public class MigrationTool {
|
||||||
|
public static UI ui = null;
|
||||||
|
public static Database db = null;
|
||||||
|
|
||||||
|
public static final String MIGRATIONCOMMENT = "//%$//";
|
||||||
|
|
||||||
|
public static boolean printModuleInfo = false;
|
||||||
|
public static boolean doCritic = false;
|
||||||
|
public static boolean defaultoutput = false;
|
||||||
|
|
||||||
private static final void manipulate(ModuleInfo mi) throws Exception {
|
private static final void manipulate(ModuleInfo mi) throws Exception {
|
||||||
|
|
||||||
ModuleReader.ModuleScan(mi);
|
ModuleReader.ModuleScan(mi);
|
||||||
@ -60,17 +69,8 @@ public class MigrationTool {
|
|||||||
Common.toDoAll(path, MigrationTool.class.getMethod("seekModule", String.class), null, null, Common.DIR);
|
Common.toDoAll(path, MigrationTool.class.getMethod("seekModule", String.class), null, null, Common.DIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UI ui = null;
|
|
||||||
public static Database db = null;
|
|
||||||
|
|
||||||
public static final String MIGRATIONCOMMENT = "//%$//";
|
|
||||||
|
|
||||||
public static boolean printModuleInfo = false;
|
|
||||||
public static boolean doCritic = false;
|
|
||||||
public static boolean defaultoutput = false;
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
ui = FirstPanel.init();
|
ui = FirstPanel.getInstance();
|
||||||
db = Database.init();
|
db = Database.getInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user