mirror of https://github.com/acidanthera/audk.git
Use unified global data to get module informations.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1383 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
55e83b18d8
commit
3658f95e1a
|
@ -18,7 +18,6 @@ import java.awt.event.ComponentEvent;
|
|||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
|
@ -42,20 +41,17 @@ import javax.swing.event.TableModelEvent;
|
|||
import javax.swing.event.TableModelListener;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.tianocore.PackageSurfaceAreaDocument;
|
||||
import org.tianocore.frameworkwizard.common.DataValidation;
|
||||
import org.tianocore.frameworkwizard.common.GlobalData;
|
||||
import org.tianocore.frameworkwizard.common.Tools;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
|
||||
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
|
||||
import org.tianocore.frameworkwizard.common.ui.StarLabel;
|
||||
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
|
||||
import org.tianocore.frameworkwizard.platform.ui.ListEditor;
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -919,20 +915,10 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
|
|||
private void getLibInstances(String libClass){
|
||||
libNameGuidMap.clear();
|
||||
try {
|
||||
WorkspaceProfile.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));
|
||||
|
||||
Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();
|
||||
Iterator ispi = spi.iterator();
|
||||
|
||||
while (ispi.hasNext()) {
|
||||
PackageIdentification pi = (PackageIdentification) ispi.next();
|
||||
|
||||
Set<ModuleIdentification> smi = WorkspaceProfile.getModules(pi);
|
||||
Iterator ismi = smi.iterator();
|
||||
Iterator ismi = GlobalData.vModuleList.iterator();
|
||||
while (ismi.hasNext()) {
|
||||
ModuleIdentification mi = (ModuleIdentification) ismi.next();
|
||||
Map<String, XmlObject> m = WorkspaceProfile.getNativeMsa(mi);
|
||||
SurfaceAreaQuery.setDoc(m);
|
||||
|
||||
Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
|
||||
for (int i = 0; i < classProduced.size(); ++i) {
|
||||
if (classProduced.get(i).equals(libClass)) {
|
||||
|
@ -940,7 +926,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch(Exception e){
|
||||
JOptionPane.showMessageDialog(frame, "Search Instances Failed.");
|
||||
|
|
|
@ -60,8 +60,8 @@ import org.tianocore.UserDefinedAntTasksDocument;
|
|||
import org.tianocore.UserExtensionsDocument;
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
|
||||
/**
|
||||
This class processes fpd file contents such as add remove xml elements.
|
||||
|
@ -702,14 +702,14 @@ public class FpdFileContents {
|
|||
String mn = libMi.getName();
|
||||
String mg = libMi.getGuid();
|
||||
String mv = libMi.getVersion();
|
||||
String pn = libMi.getPackage().getName();
|
||||
String pg = libMi.getPackage().getGuid();
|
||||
String pv = libMi.getPackage().getVersion();
|
||||
String pn = libMi.getPackageId().getName();
|
||||
String pg = libMi.getPackageId().getGuid();
|
||||
String pv = libMi.getPackageId().getVersion();
|
||||
LibrariesDocument.Libraries.Instance instance = libs.addNewInstance();
|
||||
XmlCursor cursor = instance.newCursor();
|
||||
try{
|
||||
String comment = "Pkg: " + pn + " Mod: " + mn
|
||||
+ " Path: " + WorkspaceProfile.getMsaFile(libMi).getPath().substring(System.getenv("WORKSPACE").length() + 1);
|
||||
+ " Path: " + libMi.getPath().substring(System.getenv("WORKSPACE").length() + 1);
|
||||
cursor.insertComment(comment);
|
||||
}
|
||||
catch (Exception e){
|
||||
|
@ -947,12 +947,10 @@ public class FpdFileContents {
|
|||
|
||||
private PcdDeclarationsDocument.PcdDeclarations.PcdEntry LookupPcdDeclaration (PcdCodedDocument.PcdCoded.PcdEntry msaPcd, PackageIdentification[] depPkgs) {
|
||||
|
||||
Map<String, XmlObject> m = new HashMap<String, XmlObject>();
|
||||
PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = null;
|
||||
for (int i = 0; i < depPkgs.length; ++i) {
|
||||
m.put("PackageSurfaceArea", WorkspaceProfile.getPackageXmlObject(depPkgs[i]));
|
||||
SurfaceAreaQuery.setDoc(m);
|
||||
XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations();
|
||||
|
||||
XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations(depPkgs[i]);
|
||||
if (xo == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -980,8 +978,8 @@ public class FpdFileContents {
|
|||
ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();
|
||||
XmlCursor cursor = msa.newCursor();
|
||||
try{
|
||||
String comment = "Mod: " + mi.getName() + " Type: " + mi.getModuleType() + " Path: "
|
||||
+ WorkspaceProfile.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1);
|
||||
String comment = "Mod: " + mi.getName() + " Type: " + SurfaceAreaQuery.getModuleType(mi) + " Path: "
|
||||
+ mi.getPath().substring(System.getenv("WORKSPACE").length() + 1);
|
||||
cursor.insertComment(comment);
|
||||
}
|
||||
catch(Exception e){
|
||||
|
@ -2693,7 +2691,7 @@ class PcdItemTypeConflictException extends Exception {
|
|||
|
||||
PcdItemTypeConflictException(String pcdName, String info){
|
||||
ModuleIdentification mi = WorkspaceProfile.getModuleId(info);
|
||||
details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackage().getName();
|
||||
details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackageId().getName();
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
|
|
|
@ -17,6 +17,7 @@ import javax.swing.JPanel;
|
|||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.DefaultCellEditor;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
|
@ -36,11 +37,14 @@ import java.awt.event.ComponentAdapter;
|
|||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JTextField;
|
||||
|
@ -59,6 +63,7 @@ import javax.swing.table.TableColumn;
|
|||
import javax.swing.table.TableModel;
|
||||
import javax.swing.JComboBox;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.JSplitPane;
|
||||
|
||||
public class FpdFlash extends IInternalFrame {
|
||||
|
||||
|
@ -124,6 +129,284 @@ public class FpdFlash extends IInternalFrame {
|
|||
private JScrollPane jScrollPane = null;
|
||||
private JTable jTableFvImageOpts = null;
|
||||
private JButton jButtonUpdateFvImage = null;
|
||||
private JButton jButtonTest = null;
|
||||
private JPanel jPanelFdfN = null;
|
||||
private JPanel jPanelFdfS = null;
|
||||
private JSplitPane jSplitPaneFdfC = null;
|
||||
private JPanel jPanelFdfCTop = null;
|
||||
private JPanel jPanelFdfCBottom = null;
|
||||
private JPanel jPanelFdfCTopN = null;
|
||||
private JPanel jPanelFdfCTopS = null;
|
||||
private JPanel jPanelFdfCTopC = null;
|
||||
private JPanel jPanelFdfCBottomN = null;
|
||||
private JPanel jPanelFdfCBottomC = null;
|
||||
private JLabel jLabelFvInFdf = null;
|
||||
private JLabel jLabelFvAdditional = null;
|
||||
private JScrollPane jScrollPaneFvInFdf = null;
|
||||
private JTable jTableFvInFdf = null;
|
||||
private NonEditableTableModel fvInFdfTableModel = null; // @jve:decl-index=0:visual-constraint=""
|
||||
private JButton jButtonFvInFdfOptions = null;
|
||||
private JScrollPane jScrollPaneFvAdditional = null;
|
||||
private JTable jTableFvAdditional = null;
|
||||
private DefaultTableModel fvAddtionalTableModel = null; // @jve:decl-index=0:visual-constraint=""
|
||||
private JButton jButtonAddFv = null;
|
||||
private JButton jButtonDelFv = null;
|
||||
private JButton jButtonAddFvOptions = null;
|
||||
|
||||
private NonEditableTableModel nonEditableTableModel = null; // @jve:decl-index=0:visual-constraint=""
|
||||
|
||||
private JPanel jPanelModOrder = null;
|
||||
private JPanel jPanelModOrderN = null;
|
||||
private JPanel jPanelModOrderS = null;
|
||||
private JPanel jPanelModOrderC = null;
|
||||
private JScrollPane jScrollPaneModInFv = null;
|
||||
private JTable jTableModInFv = null;
|
||||
private JPanel jPanelController = null;
|
||||
private JScrollPane jScrollPaneFpdModules = null;
|
||||
private JTable jTableFpdModules = null;
|
||||
private JButton jButtonUp = null;
|
||||
private JButton jButtonInsert = null;
|
||||
private JButton jButtonRemove = null;
|
||||
private JButton jButtonDown = null;
|
||||
private JButton jButtonOk = null;
|
||||
private JButton jButtonCancel = null;
|
||||
|
||||
/**
|
||||
* This method initializes jPanelModOrder
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelModOrder() {
|
||||
// if (jPanelModOrder == null) {
|
||||
jPanelModOrder = new JPanel();
|
||||
jPanelModOrder.setLayout(new BorderLayout());
|
||||
jPanelModOrder.add(getJPanelModOrderN(), java.awt.BorderLayout.NORTH);
|
||||
jPanelModOrder.add(getJPanelModOrderS(), java.awt.BorderLayout.SOUTH);
|
||||
jPanelModOrder.add(getJPanelModOrderC(), java.awt.BorderLayout.CENTER);
|
||||
jPanelModOrder.addComponentListener(new java.awt.event.ComponentAdapter() {
|
||||
public void componentShown(java.awt.event.ComponentEvent e) {
|
||||
System.out.println("componentShown()" + jTabbedPane.getTitleAt(jTabbedPane.getSelectedIndex())); // TODO Auto-generated Event stub componentShown()
|
||||
}
|
||||
});
|
||||
// }
|
||||
return jPanelModOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelModOrderN
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelModOrderN() {
|
||||
// if (jPanelModOrderN == null) {
|
||||
jPanelModOrderN = new JPanel();
|
||||
// }
|
||||
return jPanelModOrderN;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelModOrderS
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelModOrderS() {
|
||||
// if (jPanelModOrderS == null) {
|
||||
FlowLayout flowLayout6 = new FlowLayout();
|
||||
flowLayout6.setAlignment(java.awt.FlowLayout.RIGHT);
|
||||
jPanelModOrderS = new JPanel();
|
||||
jPanelModOrderS.setLayout(flowLayout6);
|
||||
jPanelModOrderS.add(getJButtonOk(), null);
|
||||
jPanelModOrderS.add(getJButtonCancel(), null);
|
||||
// }
|
||||
return jPanelModOrderS;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelModOrderC
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelModOrderC() {
|
||||
// if (jPanelModOrderC == null) {
|
||||
jPanelModOrderC = new JPanel();
|
||||
jPanelModOrderC.add(getJScrollPaneModInFv(), null);
|
||||
jPanelModOrderC.add(getJPanelController(), null);
|
||||
jPanelModOrderC.add(getJScrollPaneFpdModules(), null);
|
||||
// }
|
||||
return jPanelModOrderC;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jScrollPaneModInFv
|
||||
*
|
||||
* @return javax.swing.JScrollPane
|
||||
*/
|
||||
private JScrollPane getJScrollPaneModInFv() {
|
||||
// if (jScrollPaneModInFv == null) {
|
||||
jScrollPaneModInFv = new JScrollPane();
|
||||
jScrollPaneModInFv.setPreferredSize(new java.awt.Dimension(150,500));
|
||||
jScrollPaneModInFv.setViewportView(getJTableModInFv());
|
||||
// }
|
||||
return jScrollPaneModInFv;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTableModInFv
|
||||
*
|
||||
* @return javax.swing.JTable
|
||||
*/
|
||||
private JTable getJTableModInFv() {
|
||||
// if (jTableModInFv == null) {
|
||||
NonEditableTableModel modInFvTableModel = new NonEditableTableModel();
|
||||
modInFvTableModel.addColumn("Module Orders in FV");
|
||||
jTableModInFv = new JTable(modInFvTableModel);
|
||||
jTableModInFv.setRowHeight(20);
|
||||
// }
|
||||
return jTableModInFv;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelController
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelController() {
|
||||
// if (jPanelController == null) {
|
||||
FlowLayout flowLayout5 = new FlowLayout();
|
||||
flowLayout5.setVgap(50);
|
||||
flowLayout5.setHgap(50);
|
||||
jPanelController = new JPanel();
|
||||
jPanelController.setLayout(flowLayout5);
|
||||
jPanelController.setPreferredSize(new java.awt.Dimension(150,500));
|
||||
jPanelController.add(getJButtonUp(), null);
|
||||
jPanelController.add(getJButtonInsert(), null);
|
||||
jPanelController.add(getJButtonRemove(), null);
|
||||
jPanelController.add(getJButtonDown(), null);
|
||||
// }
|
||||
return jPanelController;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jScrollPaneFpdModules
|
||||
*
|
||||
* @return javax.swing.JScrollPane
|
||||
*/
|
||||
private JScrollPane getJScrollPaneFpdModules() {
|
||||
// if (jScrollPaneFpdModules == null) {
|
||||
jScrollPaneFpdModules = new JScrollPane();
|
||||
jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(150,500));
|
||||
jScrollPaneFpdModules.setViewportView(getJTableFpdModules());
|
||||
// }
|
||||
return jScrollPaneFpdModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTableFpdModules
|
||||
*
|
||||
* @return javax.swing.JTable
|
||||
*/
|
||||
private JTable getJTableFpdModules() {
|
||||
// if (jTableFpdModules == null) {
|
||||
NonEditableTableModel fpdModTableModel = new NonEditableTableModel();
|
||||
fpdModTableModel.addColumn("Modules in Platform");
|
||||
jTableFpdModules = new JTable(fpdModTableModel);
|
||||
jTableFpdModules.setRowHeight(20);
|
||||
// }
|
||||
return jTableFpdModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonUp
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonUp() {
|
||||
// if (jButtonUp == null) {
|
||||
jButtonUp = new JButton();
|
||||
jButtonUp.setPreferredSize(new java.awt.Dimension(60,20));
|
||||
jButtonUp.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
|
||||
jButtonUp.setText("^");
|
||||
// }
|
||||
return jButtonUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonInsert
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonInsert() {
|
||||
// if (jButtonInsert == null) {
|
||||
jButtonInsert = new JButton();
|
||||
jButtonInsert.setText("<<");
|
||||
jButtonInsert.setPreferredSize(new java.awt.Dimension(60,20));
|
||||
// }
|
||||
return jButtonInsert;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonRemove
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonRemove() {
|
||||
// if (jButtonRemove == null) {
|
||||
jButtonRemove = new JButton();
|
||||
jButtonRemove.setPreferredSize(new java.awt.Dimension(60,20));
|
||||
jButtonRemove.setText(">>");
|
||||
// }
|
||||
return jButtonRemove;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonDown
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonDown() {
|
||||
// if (jButtonDown == null) {
|
||||
jButtonDown = new JButton();
|
||||
jButtonDown.setPreferredSize(new java.awt.Dimension(60,20));
|
||||
jButtonDown.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
|
||||
jButtonDown.setText("v");
|
||||
// }
|
||||
return jButtonDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonOk
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonOk() {
|
||||
// if (jButtonOk == null) {
|
||||
jButtonOk = new JButton();
|
||||
jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
|
||||
jButtonOk.setText("Ok");
|
||||
// }
|
||||
return jButtonOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonCancel
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonCancel() {
|
||||
// if (jButtonCancel == null) {
|
||||
jButtonCancel = new JButton();
|
||||
jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
|
||||
jButtonCancel.setText("Cancel");
|
||||
jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent e) {
|
||||
getJTabbedPane().setSelectedIndex(0);
|
||||
}
|
||||
});
|
||||
// }
|
||||
return jButtonCancel;
|
||||
}
|
||||
|
||||
|
||||
public FpdFlash() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
|
@ -205,8 +488,8 @@ public class FpdFlash extends IInternalFrame {
|
|||
private JTabbedPane getJTabbedPane() {
|
||||
if (jTabbedPane == null) {
|
||||
jTabbedPane = new JTabbedPane();
|
||||
jTabbedPane.addTab("FV Images", null, getJPanelFvImages(), null);
|
||||
jTabbedPane.addTab("Flash Definition File", null, getJPanelFdf(), null);
|
||||
jTabbedPane.addTab("General", null, getJPanelFdf(), null);
|
||||
jTabbedPane.addTab("FV Parameters", null, getJPanelFvImages(), null);
|
||||
|
||||
}
|
||||
return jTabbedPane;
|
||||
|
@ -246,7 +529,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
jLabelFvPropName.setEnabled(false);
|
||||
jLabelFvPropName.setPreferredSize(new java.awt.Dimension(38,20));
|
||||
FlowLayout flowLayout2 = new FlowLayout();
|
||||
flowLayout2.setAlignment(java.awt.FlowLayout.CENTER);
|
||||
flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
|
||||
flowLayout2.setHgap(15);
|
||||
jPanelFvImageN = new JPanel();
|
||||
jPanelFvImageN.setPreferredSize(new java.awt.Dimension(576,100));
|
||||
|
@ -289,7 +572,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
private JCheckBox getJCheckBoxFvProperty() {
|
||||
if (jCheckBoxFvProperty == null) {
|
||||
jCheckBoxFvProperty = new JCheckBox();
|
||||
jCheckBoxFvProperty.setText("FV Properties");
|
||||
jCheckBoxFvProperty.setText("Global FV Variables");
|
||||
jCheckBoxFvProperty.addItemListener(new ItemListener(){
|
||||
|
||||
public void itemStateChanged(ItemEvent arg0) {
|
||||
|
@ -952,25 +1235,24 @@ public class FpdFlash extends IInternalFrame {
|
|||
*/
|
||||
private JPanel getJPanelFdf() {
|
||||
if (jPanelFdf == null) {
|
||||
FlowLayout flowLayout1 = new FlowLayout();
|
||||
flowLayout1.setAlignment(FlowLayout.LEFT);
|
||||
jPanelFdf = new JPanel();
|
||||
jPanelFdf.setLayout(flowLayout1);
|
||||
jPanelFdf.add(getJCheckBoxFdf(), null);
|
||||
jPanelFdf.add(getJTextFieldFdf(), null);
|
||||
jPanelFdf.add(getJButtonFdfBrowse(), null);
|
||||
jPanelFdf.addComponentListener(new ComponentAdapter(){
|
||||
public void componentShown(ComponentEvent e) {
|
||||
if (ffc.getFlashDefinitionFile() != null) {
|
||||
jTextFieldFdf.setText(ffc.getFlashDefinitionFile());
|
||||
}
|
||||
}
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
if (jCheckBoxFdf.isSelected()) {
|
||||
ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
|
||||
}
|
||||
}
|
||||
});
|
||||
jPanelFdf.setLayout(new BorderLayout());
|
||||
|
||||
jPanelFdf.add(getJPanelFdfN(), java.awt.BorderLayout.NORTH);
|
||||
jPanelFdf.add(getJPanelFdfS(), java.awt.BorderLayout.SOUTH);
|
||||
jPanelFdf.add(getJSplitPaneFdfC(), java.awt.BorderLayout.CENTER);
|
||||
// jPanelFdf.addComponentListener(new ComponentAdapter(){
|
||||
// public void componentShown(ComponentEvent e) {
|
||||
// if (ffc.getFlashDefinitionFile() != null) {
|
||||
// jTextFieldFdf.setText(ffc.getFlashDefinitionFile());
|
||||
// }
|
||||
// }
|
||||
// public void componentHidden(ComponentEvent e) {
|
||||
// if (jCheckBoxFdf.isSelected()) {
|
||||
// ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
return jPanelFdf;
|
||||
}
|
||||
|
@ -1055,6 +1337,16 @@ public class FpdFlash extends IInternalFrame {
|
|||
return;
|
||||
}
|
||||
jTextFieldFdf.setText(filePath.substring(wsDir.length() + 1).replace('\\', '/'));
|
||||
ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
|
||||
docConsole.setSaved(false);
|
||||
Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();
|
||||
getFvInfoFromFdf(filePath, vFvInfo);
|
||||
getFvInFdfTableModel().setRowCount(0);
|
||||
for (int j = 0; j < vFvInfo.size(); ++j) {
|
||||
FvInfoFromFdf fvInfo = vFvInfo.get(j);
|
||||
String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};
|
||||
getFvInFdfTableModel().addRow(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1231,6 +1523,352 @@ public class FpdFlash extends IInternalFrame {
|
|||
return jButtonUpdateFvImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonTest
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
// private JButton getJButtonTest() {
|
||||
// if (jButtonTest == null) {
|
||||
// jButtonTest = new JButton();
|
||||
// jButtonTest.addActionListener(new java.awt.event.ActionListener() {
|
||||
// public void actionPerformed(java.awt.event.ActionEvent e) {
|
||||
// docConsole.setSaved(false);
|
||||
// String[][] includeModules = {{"1", "a"}, {"2", "b"}};
|
||||
// ffc.genBuildOptionsUserExtensions("FV_RECOVERY", "FvRecovery.inf", null, includeModules);
|
||||
// int i = ffc.getUserExtsIncModCount("FV_RECOVERY");
|
||||
// String[][] saa = new String[i][2];
|
||||
// ffc.getUserExtsIncMods("FV_RECOVERY", saa);
|
||||
// jTextFieldFdf.setText(saa[0][0] + saa[0][1] + saa[1][0] + saa[1][1]);
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// return jButtonTest;
|
||||
// }
|
||||
|
||||
/**
|
||||
* This method initializes jPanelFdfN
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelFdfN() {
|
||||
if (jPanelFdfN == null) {
|
||||
jPanelFdfN = new JPanel();
|
||||
jPanelFdfN.add(getJCheckBoxFdf(), null);
|
||||
jPanelFdfN.add(getJTextFieldFdf(), null);
|
||||
jPanelFdfN.add(getJButtonFdfBrowse(), null);
|
||||
}
|
||||
return jPanelFdfN;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelFdfS
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelFdfS() {
|
||||
if (jPanelFdfS == null) {
|
||||
FlowLayout flowLayout4 = new FlowLayout();
|
||||
flowLayout4.setAlignment(java.awt.FlowLayout.RIGHT);
|
||||
jPanelFdfS = new JPanel();
|
||||
jPanelFdfS.setLayout(flowLayout4);
|
||||
jPanelFdfS.add(getJButtonAddFv(), null);
|
||||
jPanelFdfS.add(getJButtonDelFv(), null);
|
||||
jPanelFdfS.add(getJButtonAddFvOptions(), null);
|
||||
}
|
||||
return jPanelFdfS;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jSplitPaneFdfC
|
||||
*
|
||||
* @return javax.swing.JSplitPane
|
||||
*/
|
||||
private JSplitPane getJSplitPaneFdfC() {
|
||||
if (jSplitPaneFdfC == null) {
|
||||
jSplitPaneFdfC = new JSplitPane();
|
||||
jSplitPaneFdfC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPaneFdfC.setDividerSize(5);
|
||||
jSplitPaneFdfC.setTopComponent(getJPanelFdfCTop());
|
||||
jSplitPaneFdfC.setBottomComponent(getJPanelFdfCBottom());
|
||||
jSplitPaneFdfC.setDividerLocation(280);
|
||||
}
|
||||
return jSplitPaneFdfC;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelFdfCTop
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelFdfCTop() {
|
||||
if (jPanelFdfCTop == null) {
|
||||
jPanelFdfCTop = new JPanel();
|
||||
jPanelFdfCTop.setLayout(new BorderLayout());
|
||||
jPanelFdfCTop.add(getJPanelFdfCTopN(), java.awt.BorderLayout.NORTH);
|
||||
jPanelFdfCTop.add(getJPanelFdfCTopS(), java.awt.BorderLayout.SOUTH);
|
||||
jPanelFdfCTop.add(getJPanelFdfCTopC(), java.awt.BorderLayout.CENTER);
|
||||
}
|
||||
return jPanelFdfCTop;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelFdfCBottom
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelFdfCBottom() {
|
||||
if (jPanelFdfCBottom == null) {
|
||||
jPanelFdfCBottom = new JPanel();
|
||||
jPanelFdfCBottom.setLayout(new BorderLayout());
|
||||
jPanelFdfCBottom.add(getJPanelFdfCBottomN(), java.awt.BorderLayout.NORTH);
|
||||
jPanelFdfCBottom.add(getJPanelFdfCBottomC(), java.awt.BorderLayout.CENTER);
|
||||
}
|
||||
return jPanelFdfCBottom;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelFdfCTopN
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelFdfCTopN() {
|
||||
if (jPanelFdfCTopN == null) {
|
||||
jLabelFvInFdf = new JLabel();
|
||||
jLabelFvInFdf.setText("FVs in Flash Definition File");
|
||||
jPanelFdfCTopN = new JPanel();
|
||||
jPanelFdfCTopN.add(jLabelFvInFdf, null);
|
||||
}
|
||||
return jPanelFdfCTopN;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelFdfCTopS
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelFdfCTopS() {
|
||||
if (jPanelFdfCTopS == null) {
|
||||
FlowLayout flowLayout1 = new FlowLayout();
|
||||
flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
|
||||
jPanelFdfCTopS = new JPanel();
|
||||
jPanelFdfCTopS.setLayout(flowLayout1);
|
||||
jPanelFdfCTopS.add(getJButtonFvInFdfOptions(), null);
|
||||
}
|
||||
return jPanelFdfCTopS;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelFdfCTopC
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelFdfCTopC() {
|
||||
if (jPanelFdfCTopC == null) {
|
||||
jPanelFdfCTopC = new JPanel();
|
||||
jPanelFdfCTopC.add(getJScrollPaneFvInFdf(), null);
|
||||
}
|
||||
return jPanelFdfCTopC;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelFdfCBottomN
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelFdfCBottomN() {
|
||||
if (jPanelFdfCBottomN == null) {
|
||||
jLabelFvAdditional = new JLabel();
|
||||
jLabelFvAdditional.setText("Additional FVs");
|
||||
jPanelFdfCBottomN = new JPanel();
|
||||
jPanelFdfCBottomN.add(jLabelFvAdditional, null);
|
||||
}
|
||||
return jPanelFdfCBottomN;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelFdfCBottomC
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelFdfCBottomC() {
|
||||
if (jPanelFdfCBottomC == null) {
|
||||
jPanelFdfCBottomC = new JPanel();
|
||||
jPanelFdfCBottomC.add(getJScrollPaneFvAdditional(), null);
|
||||
}
|
||||
return jPanelFdfCBottomC;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jScrollPaneFvInFdf
|
||||
*
|
||||
* @return javax.swing.JScrollPane
|
||||
*/
|
||||
private JScrollPane getJScrollPaneFvInFdf() {
|
||||
if (jScrollPaneFvInFdf == null) {
|
||||
jScrollPaneFvInFdf = new JScrollPane();
|
||||
jScrollPaneFvInFdf.setPreferredSize(new java.awt.Dimension(653,200));
|
||||
jScrollPaneFvInFdf.setViewportView(getJTableFvInFdf());
|
||||
}
|
||||
return jScrollPaneFvInFdf;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTableFvInFdf
|
||||
*
|
||||
* @return javax.swing.JTable
|
||||
*/
|
||||
private JTable getJTableFvInFdf() {
|
||||
if (jTableFvInFdf == null) {
|
||||
jTableFvInFdf = new JTable();
|
||||
jTableFvInFdf.setRowHeight(20);
|
||||
jTableFvInFdf.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
jTableFvInFdf.setModel(getFvInFdfTableModel());
|
||||
}
|
||||
return jTableFvInFdf;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes fvInFdfTableModel
|
||||
*
|
||||
* @return org.tianocore.frameworkwizard.platform.ui.NonEditableTableModel
|
||||
*/
|
||||
private NonEditableTableModel getFvInFdfTableModel() {
|
||||
if (fvInFdfTableModel == null) {
|
||||
fvInFdfTableModel = new NonEditableTableModel();
|
||||
fvInFdfTableModel.addColumn("FV Name");
|
||||
fvInFdfTableModel.addColumn("Size");
|
||||
fvInFdfTableModel.addColumn("Corresponding File Name");
|
||||
}
|
||||
return fvInFdfTableModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonFvInFdfOptions
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonFvInFdfOptions() {
|
||||
if (jButtonFvInFdfOptions == null) {
|
||||
jButtonFvInFdfOptions = new JButton();
|
||||
jButtonFvInFdfOptions.setPreferredSize(new java.awt.Dimension(80,20));
|
||||
jButtonFvInFdfOptions.setText("Options");
|
||||
jButtonFvInFdfOptions.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent e) {
|
||||
int selectedRow = jTableFvInFdf.getSelectedRow();
|
||||
if (selectedRow <= 0) {
|
||||
return;
|
||||
}
|
||||
fvInFdfTableModel.moveRow(selectedRow, selectedRow, selectedRow - 1);
|
||||
jTableFvInFdf.changeSelection(selectedRow - 1, 0, false, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
return jButtonFvInFdfOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jScrollPaneFvAdditional
|
||||
*
|
||||
* @return javax.swing.JScrollPane
|
||||
*/
|
||||
private JScrollPane getJScrollPaneFvAdditional() {
|
||||
if (jScrollPaneFvAdditional == null) {
|
||||
jScrollPaneFvAdditional = new JScrollPane();
|
||||
jScrollPaneFvAdditional.setPreferredSize(new java.awt.Dimension(653,200));
|
||||
jScrollPaneFvAdditional.setViewportView(getJTableFvAdditional());
|
||||
}
|
||||
return jScrollPaneFvAdditional;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTableFvAdditional
|
||||
*
|
||||
* @return javax.swing.JTable
|
||||
*/
|
||||
private JTable getJTableFvAdditional() {
|
||||
if (jTableFvAdditional == null) {
|
||||
jTableFvAdditional = new JTable();
|
||||
jTableFvAdditional.setRowHeight(20);
|
||||
jTableFvAdditional.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
jTableFvAdditional.setModel(getFvAddtionalTableModel());
|
||||
}
|
||||
return jTableFvAdditional;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes fvAddtionalTableModel
|
||||
*
|
||||
* @return javax.swing.table.DefaultTableModel
|
||||
*/
|
||||
private DefaultTableModel getFvAddtionalTableModel() {
|
||||
if (fvAddtionalTableModel == null) {
|
||||
fvAddtionalTableModel = new DefaultTableModel();
|
||||
fvAddtionalTableModel.addColumn("FV Name");
|
||||
fvAddtionalTableModel.addColumn("Size");
|
||||
fvAddtionalTableModel.addColumn("Corresponding File Name");
|
||||
}
|
||||
return fvAddtionalTableModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonAddFv
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonAddFv() {
|
||||
if (jButtonAddFv == null) {
|
||||
jButtonAddFv = new JButton();
|
||||
jButtonAddFv.setPreferredSize(new java.awt.Dimension(80,20));
|
||||
jButtonAddFv.setText("New");
|
||||
}
|
||||
return jButtonAddFv;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonDelFv
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonDelFv() {
|
||||
if (jButtonDelFv == null) {
|
||||
jButtonDelFv = new JButton();
|
||||
jButtonDelFv.setPreferredSize(new java.awt.Dimension(80,20));
|
||||
jButtonDelFv.setText("Delete");
|
||||
}
|
||||
return jButtonDelFv;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonAddFvOptions
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonAddFvOptions() {
|
||||
if (jButtonAddFvOptions == null) {
|
||||
jButtonAddFvOptions = new JButton();
|
||||
jButtonAddFvOptions.setPreferredSize(new java.awt.Dimension(80,20));
|
||||
jButtonAddFvOptions.setText("Options");
|
||||
}
|
||||
return jButtonAddFvOptions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This method initializes nonEditableTableModel
|
||||
*
|
||||
* @return org.tianocore.frameworkwizard.platform.ui.NonEditableTableModel
|
||||
*/
|
||||
private NonEditableTableModel getNonEditableTableModel() {
|
||||
if (nonEditableTableModel == null) {
|
||||
nonEditableTableModel = new NonEditableTableModel();
|
||||
}
|
||||
return nonEditableTableModel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
|
@ -1269,13 +1907,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
return;
|
||||
}
|
||||
String[][] saa = new String[ffc.getFvImagesFvImageCount()][2];
|
||||
// ArrayList<LinkedHashMap<String, String>> options = new ArrayList<LinkedHashMap<String, String>>(ffc.getFvImagesFvImageCount());
|
||||
//
|
||||
// for (int j = 0; j < ffc.getFvImagesFvImageCount(); ++j){
|
||||
// options.add(new LinkedHashMap<String, String>());
|
||||
// }
|
||||
ffc.getFvImagesFvImages(saa);
|
||||
|
||||
|
||||
int i = 0;
|
||||
while (i < saa.length) {
|
||||
|
@ -1284,10 +1916,34 @@ public class FpdFlash extends IInternalFrame {
|
|||
++i;
|
||||
}
|
||||
|
||||
// String fdfFile = ffc.getFlashDefinitionFile();
|
||||
// if (fdfFile != null) {
|
||||
// jTextField3.setText(fdfFile);
|
||||
// }
|
||||
saa = new String[ffc.getFvImagesNameValueCount()][2];
|
||||
ffc.getFvImagesNameValues(saa);
|
||||
for (int m = 0; m < saa.length; ++m) {
|
||||
fvPropertyTableModel.addRow(saa[m]);
|
||||
}
|
||||
|
||||
jTextFieldFdf.setText("");
|
||||
String fdfFile = ffc.getFlashDefinitionFile();
|
||||
if (fdfFile != null) {
|
||||
jTextFieldFdf.setText(fdfFile);
|
||||
}
|
||||
|
||||
String fdfPath = System.getenv("WORKSPACE") + File.separator + fdfFile;
|
||||
Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();
|
||||
getFvInfoFromFdf(fdfPath, vFvInfo);
|
||||
getFvInFdfTableModel().setRowCount(0);
|
||||
for (int j = 0; j < vFvInfo.size(); ++j) {
|
||||
FvInfoFromFdf fvInfo = vFvInfo.get(j);
|
||||
String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};
|
||||
getFvInFdfTableModel().addRow(row);
|
||||
}
|
||||
|
||||
|
||||
for (int k = 0; k < vFvInfo.size(); ++k) {
|
||||
FvInfoFromFdf fvInfo = vFvInfo.get(k);
|
||||
getJTabbedPane().addTab(fvInfo.getFvName(), null, getJPanelModOrder(), null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void getOptionNameValue(Map<String, String> m){
|
||||
|
@ -1312,6 +1968,118 @@ public class FpdFlash extends IInternalFrame {
|
|||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
private void getFvInfoFromFdf(String fdfPath, Vector<FvInfoFromFdf> vFvInfo) {
|
||||
File fdf = new File(fdfPath);
|
||||
if (!fdf.exists()) {
|
||||
return;
|
||||
}
|
||||
int lines = 0;
|
||||
|
||||
try {
|
||||
FileReader reader = new FileReader(fdf);
|
||||
BufferedReader in = new BufferedReader(reader);
|
||||
String str;
|
||||
|
||||
while ((str = in.readLine()) != null) {
|
||||
++lines;
|
||||
str = str.trim();
|
||||
//
|
||||
// skip empty line, comment (start with //)
|
||||
//
|
||||
if (str.length() == 0 || str.startsWith("//")) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// dig into Region {} section, create FvInfoFromFdf object for it.
|
||||
//
|
||||
if (str.startsWith("Region") && str.endsWith("{")) {
|
||||
FvInfoFromFdf fvInfo = new FvInfoFromFdf();
|
||||
boolean nameFound = false;
|
||||
boolean sizeFound = false;
|
||||
while ((str = in.readLine()) != null) {
|
||||
++lines;
|
||||
str = str.trim();
|
||||
//
|
||||
// skip empty line, comment (start with //)
|
||||
//
|
||||
if (str.length() == 0 || str.startsWith("//")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (str.startsWith("Name")) {
|
||||
int firstQuote = str.indexOf("\"");
|
||||
int lastQuote = str.lastIndexOf("\"");
|
||||
fvInfo.setFvName(str.substring(firstQuote + 1, lastQuote));
|
||||
nameFound = true;
|
||||
}
|
||||
|
||||
if (str.startsWith("Size")) {
|
||||
int equalIndex = str.indexOf("=");
|
||||
int commaIndex = str.indexOf(",");
|
||||
fvInfo.setSize(str.substring(equalIndex + 1, commaIndex).trim());
|
||||
sizeFound = true;
|
||||
}
|
||||
|
||||
if (nameFound && sizeFound) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vFvInfo.add(fvInfo);
|
||||
}
|
||||
//
|
||||
// dig into File {} section, supply file name information to existing FvInfoFromFdf object.
|
||||
//
|
||||
if (str.startsWith("File")) {
|
||||
boolean fileNameFound = false;
|
||||
boolean fvFound = false;
|
||||
String fileName = "";
|
||||
String fvName = "";
|
||||
while ((str = in.readLine()) != null) {
|
||||
++lines;
|
||||
str = str.trim();
|
||||
//
|
||||
// skip empty line, comment (start with //)
|
||||
//
|
||||
if (str.length() == 0 || str.startsWith("//")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (str.startsWith("Name")) {
|
||||
int firstQuote = str.indexOf("\"");
|
||||
int lastQuote = str.lastIndexOf("\"");
|
||||
fileName = str.substring(firstQuote + 1, lastQuote);
|
||||
fileNameFound = true;
|
||||
}
|
||||
|
||||
if (str.startsWith("Region")) {
|
||||
int firstQuote = str.indexOf("\"");
|
||||
int lastQuote = str.lastIndexOf("\"");
|
||||
fvName = str.substring(firstQuote + 1, lastQuote);
|
||||
fvFound = true;
|
||||
}
|
||||
|
||||
if (fileNameFound && fvFound) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i <vFvInfo.size(); ++i) {
|
||||
if (vFvInfo.get(i).getFvName().equals(fvName)) {
|
||||
vFvInfo.get(i).setEfiFileName(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // @jve:decl-index=0:visual-constraint="10,10"
|
||||
|
||||
|
@ -1327,3 +2095,39 @@ class ImageParaTableModel extends DefaultTableModel {
|
|||
}
|
||||
}
|
||||
|
||||
class FvInfoFromFdf {
|
||||
private String fvName;
|
||||
private String size;
|
||||
private String efiFileName;
|
||||
|
||||
public FvInfoFromFdf () {
|
||||
fvName = "";
|
||||
size = "";
|
||||
efiFileName = "";
|
||||
}
|
||||
public FvInfoFromFdf (String f, String s, String e) {
|
||||
this();
|
||||
fvName = f;
|
||||
size = s;
|
||||
efiFileName = e;
|
||||
}
|
||||
public String getEfiFileName() {
|
||||
return efiFileName;
|
||||
}
|
||||
public void setEfiFileName(String efiFileName) {
|
||||
this.efiFileName = efiFileName;
|
||||
}
|
||||
public String getFvName() {
|
||||
return fvName;
|
||||
}
|
||||
public void setFvName(String fvName) {
|
||||
this.fvName = fvName;
|
||||
}
|
||||
public String getSize() {
|
||||
return size;
|
||||
}
|
||||
public void setSize(String size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,19 +30,18 @@ import javax.swing.table.DefaultTableModel;
|
|||
import javax.swing.table.TableModel;
|
||||
|
||||
import org.tianocore.PlatformSurfaceAreaDocument;
|
||||
import org.tianocore.frameworkwizard.common.GlobalData;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
|
||||
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
public class FpdFrameworkModules extends IInternalFrame {
|
||||
|
@ -358,9 +357,9 @@ public class FpdFrameworkModules extends IInternalFrame {
|
|||
String archsAdded = "";
|
||||
String mg = mi.getGuid();
|
||||
String mv = mi.getVersion();
|
||||
String pg = mi.getPackage().getGuid();
|
||||
String pv = mi.getPackage().getVersion();
|
||||
String mType = mi.getModuleType();
|
||||
String pg = mi.getPackageId().getGuid();
|
||||
String pv = mi.getPackageId().getVersion();
|
||||
String mType = SurfaceAreaQuery.getModuleType(mi);
|
||||
|
||||
ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
|
||||
if (al == null) {
|
||||
|
@ -408,7 +407,7 @@ public class FpdFrameworkModules extends IInternalFrame {
|
|||
|
||||
if (mi != null) {
|
||||
row[modNameColForFpdModTable] = mi.getName();
|
||||
row[pkgNameColForFpdModTable] = mi.getPackage().getName();
|
||||
row[pkgNameColForFpdModTable] = mi.getPackageId().getName();
|
||||
row[pathColForFpdModTable] = path;
|
||||
row[archColForFpdModTable] = arch;
|
||||
row[pkgVerColForFpdModTable] = pv;
|
||||
|
@ -629,7 +628,7 @@ public class FpdFrameworkModules extends IInternalFrame {
|
|||
String arch = sa[ffcModArch];
|
||||
ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);
|
||||
mv = mi.getVersion();
|
||||
pv = mi.getPackage().getVersion();
|
||||
pv = mi.getPackageId().getVersion();
|
||||
modelFpdModules.removeRow(selectedRow);
|
||||
if (arch == null) {
|
||||
// if no arch specified in ModuleSA
|
||||
|
@ -679,12 +678,6 @@ public class FpdFrameworkModules extends IInternalFrame {
|
|||
}
|
||||
|
||||
private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
|
||||
try {
|
||||
WorkspaceProfile.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));
|
||||
}
|
||||
catch(Exception e){
|
||||
JOptionPane.showMessageDialog(frame, "Error occurred when getting module data.");
|
||||
}
|
||||
|
||||
if (ffc == null) {
|
||||
ffc = new FpdFileContents(fpd);
|
||||
|
@ -705,14 +698,12 @@ public class FpdFrameworkModules extends IInternalFrame {
|
|||
if (mi != null) {
|
||||
row[modNameColForFpdModTable] = mi.getName();
|
||||
row[modVerColForFpdModTable] = mi.getVersion();
|
||||
row[typeColForFpdModTable] = mi.getModuleType();
|
||||
row[pkgNameColForFpdModTable] = mi.getPackage().getName();
|
||||
row[pkgVerColForFpdModTable] = mi.getPackage().getVersion();
|
||||
row[typeColForFpdModTable] = SurfaceAreaQuery.getModuleType(mi);
|
||||
row[pkgNameColForFpdModTable] = mi.getPackageId().getName();
|
||||
row[pkgVerColForFpdModTable] = mi.getPackageId().getVersion();
|
||||
row[archColForFpdModTable] = saa[i][ffcModArch];
|
||||
try {
|
||||
row[pathColForFpdModTable] = WorkspaceProfile.getMsaFile(mi).getPath().substring(
|
||||
System.getenv("WORKSPACE")
|
||||
.length() + 1);
|
||||
row[pathColForFpdModTable] = mi.getPath().substring(System.getenv("WORKSPACE").length() + 1);
|
||||
} catch (Exception e) {
|
||||
JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage());
|
||||
}
|
||||
|
@ -743,32 +734,26 @@ public class FpdFrameworkModules extends IInternalFrame {
|
|||
if (miList == null) {
|
||||
miList = new ArrayList<ModuleIdentification>();
|
||||
}
|
||||
Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();
|
||||
Iterator ispi = spi.iterator();
|
||||
|
||||
while (ispi.hasNext()) {
|
||||
PackageIdentification pi = (PackageIdentification) ispi.next();
|
||||
String[] s = { "", "", "", "", "", "" };
|
||||
|
||||
Set<ModuleIdentification> smi = WorkspaceProfile.getModules(pi);
|
||||
Iterator ismi = smi.iterator();
|
||||
|
||||
Iterator ismi = GlobalData.vModuleList.iterator();
|
||||
while (ismi.hasNext()) {
|
||||
ModuleIdentification mi = (ModuleIdentification) ismi.next();
|
||||
s[modNameColForAllModTable] = mi.getName();
|
||||
s[modVerColForAllModTable] = mi.getVersion();
|
||||
s[typeColForAllModTable] = mi.getModuleType();
|
||||
s[pkgNameColForAllModTable] = pi.getName();
|
||||
s[pkgVerColForAllModTable] = pi.getVersion();
|
||||
s[typeColForAllModTable] = SurfaceAreaQuery.getModuleType(mi);
|
||||
s[pkgNameColForAllModTable] = mi.getPackageId().getName();
|
||||
s[pkgVerColForAllModTable] = mi.getPackageId().getVersion();
|
||||
try {
|
||||
s[pathColForAllModTable] = WorkspaceProfile.getMsaFile(mi).getPath()
|
||||
.substring(System.getenv("WORKSPACE").length() + 1);
|
||||
s[pathColForAllModTable] = mi.getPath().substring(System.getenv("WORKSPACE").length() + 1);
|
||||
} catch (Exception e) {
|
||||
JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage());
|
||||
}
|
||||
modelAllModules.addRow(s);
|
||||
miList.add(mi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TableSorter sorter = (TableSorter)jTableAllModules.getModel();
|
||||
sorter.setSortState(modNameColForAllModTable, TableSorter.ASCENDING);
|
||||
|
|
|
@ -494,7 +494,7 @@ public class FpdHeader extends IInternalFrame {
|
|||
private void init() {
|
||||
//this.setSize(500, 515);
|
||||
this.setContentPane(getJContentPane());
|
||||
this.setTitle("Package Surface Area Header");
|
||||
this.setTitle("Platform Surface Area Header");
|
||||
initFrame();
|
||||
|
||||
}
|
||||
|
|
|
@ -24,11 +24,12 @@ import javax.swing.table.DefaultTableModel;
|
|||
import javax.swing.table.TableModel;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataValidation;
|
||||
import org.tianocore.frameworkwizard.common.GlobalData;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
@ -37,7 +38,6 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
|
@ -185,7 +185,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||
if (mi != null) {
|
||||
saa[i][0] = mi.getName();
|
||||
saa[i][2] = mi.getVersion();
|
||||
saa[i][4] = mi.getPackage().getVersion();
|
||||
saa[i][4] = mi.getPackageId().getVersion();
|
||||
//
|
||||
// re-evaluate lib instance usage when adding a already-selected lib instance.
|
||||
//
|
||||
|
@ -297,11 +297,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||
ArrayList<String> al = new ArrayList<String>();
|
||||
|
||||
for (int i = 0; i < depPkgList.length; ++i) {
|
||||
Set<ModuleIdentification> smi = WorkspaceProfile.getModules(depPkgList[i]);
|
||||
Iterator ismi = smi.iterator();
|
||||
Iterator ismi = GlobalData.vModuleList.iterator();
|
||||
while(ismi.hasNext()) {
|
||||
ModuleIdentification mi = (ModuleIdentification)ismi.next();
|
||||
|
||||
if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
|
||||
continue;
|
||||
}
|
||||
String[] clsProduced = getClassProduced(mi);
|
||||
|
||||
boolean isPotential = false;
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
/** @file
|
||||
Spd class.
|
||||
|
||||
This class is to generate a global table for the content of spd 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.frameworkwizard.platform.ui.global;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;
|
||||
|
||||
/**
|
||||
|
||||
This class is to generate a global table for the content of spd file.
|
||||
|
||||
**/
|
||||
public class Spd {
|
||||
///
|
||||
///
|
||||
///
|
||||
Map<ModuleIdentification, File> msaInfo = new HashMap<ModuleIdentification, File>();
|
||||
|
||||
//
|
||||
// Xml Doc of Spd file, Msa file
|
||||
//
|
||||
public Map<String, XmlObject> spdDocMap = new HashMap<String, XmlObject>();
|
||||
public Map<ModuleIdentification, XmlObject> msaDocMap = new HashMap<ModuleIdentification, XmlObject>();
|
||||
///
|
||||
/// Package path.
|
||||
///
|
||||
PackageIdentification packageId;
|
||||
|
||||
/**
|
||||
Constructor function
|
||||
|
||||
This function mainly initialize some member variables.
|
||||
**/
|
||||
Spd(File packageFile) throws Exception {
|
||||
try {
|
||||
XmlObject spdDoc = XmlObject.Factory.parse(packageFile);
|
||||
//
|
||||
// Verify SPD file, if is invalid, throw Exception
|
||||
//
|
||||
// if (! spdDoc.validate()) {
|
||||
// throw new Exception("Package Surface Area file [" + packageFile.getPath() + "] is invalid. ");
|
||||
// }
|
||||
// We can change Map to XmlObject
|
||||
|
||||
spdDocMap.put("PackageSurfaceArea", spdDoc);
|
||||
SurfaceAreaQuery.setDoc(spdDocMap);
|
||||
//
|
||||
//
|
||||
//
|
||||
packageId = SurfaceAreaQuery.getSpdHeader();
|
||||
packageId.setSpdFile(packageFile);
|
||||
|
||||
//
|
||||
// initialize Msa Files
|
||||
// MSA file is absolute file path
|
||||
//
|
||||
String[] msaFilenames = SurfaceAreaQuery.getSpdMsaFile();
|
||||
for (int i = 0; i < msaFilenames.length; i++){
|
||||
File msaFile = new File(packageId.getPackageDir() + File.separatorChar + msaFilenames[i]);
|
||||
if (!msaFile.exists()) {
|
||||
continue;
|
||||
}
|
||||
Map<String, XmlObject> msaDoc = WorkspaceProfile.getNativeMsa( msaFile );
|
||||
SurfaceAreaQuery.push(msaDoc);
|
||||
ModuleIdentification moduleId = SurfaceAreaQuery.getMsaHeader();
|
||||
SurfaceAreaQuery.pop();
|
||||
moduleId.setPackage(packageId);
|
||||
msaInfo.put(moduleId, msaFile);
|
||||
msaDocMap.put(moduleId, msaDoc.get("ModuleSurfaceArea"));
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
throw new Exception("Parse package description file [" + packageId.getSpdFile() + "] Error.\n"
|
||||
+ e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public PackageIdentification getPackageId() {
|
||||
return packageId;
|
||||
}
|
||||
|
||||
public File getModuleFile(ModuleIdentification moduleId) {
|
||||
return msaInfo.get(moduleId);
|
||||
}
|
||||
|
||||
public Set<ModuleIdentification> getModules(){
|
||||
return msaInfo.keySet();
|
||||
}
|
||||
|
||||
}
|
|
@ -14,46 +14,25 @@
|
|||
package org.tianocore.frameworkwizard.platform.ui.global;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.Vector;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.xmlbeans.XmlNormalizedString;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.apache.xmlbeans.XmlString;
|
||||
import org.tianocore.BuildTargetList;
|
||||
import org.tianocore.DataIdDocument;
|
||||
import org.tianocore.ExternsDocument;
|
||||
import org.tianocore.FileNameConvention;
|
||||
//import org.tianocore.FvImageDocument;
|
||||
import org.tianocore.GuidDeclarationsDocument;
|
||||
import org.tianocore.LibrariesDocument;
|
||||
import org.tianocore.LibraryClassDeclarationsDocument;
|
||||
import org.tianocore.LibraryClassDocument;
|
||||
import org.tianocore.ModuleSADocument;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument;
|
||||
import org.tianocore.ModuleTypeDef;
|
||||
import org.tianocore.MsaFilesDocument;
|
||||
import org.tianocore.MsaHeaderDocument;
|
||||
import org.tianocore.PackageDependenciesDocument;
|
||||
import org.tianocore.PackageHeadersDocument;
|
||||
import org.tianocore.PpiDeclarationsDocument;
|
||||
import org.tianocore.ProtocolDeclarationsDocument;
|
||||
import org.tianocore.SpdHeaderDocument;
|
||||
import org.tianocore.PackageSurfaceAreaDocument;
|
||||
import org.tianocore.FilenameDocument.Filename;
|
||||
import org.tianocore.MsaHeaderDocument.MsaHeader;
|
||||
import org.tianocore.PlatformHeaderDocument;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.FpdModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.PlatformIdentification;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.GlobalData;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
|
||||
/**
|
||||
* SurfaceAreaQuery class is used to query Surface Area information from msa,
|
||||
|
@ -322,16 +301,10 @@ public class SurfaceAreaQuery {
|
|||
* @returns The module type name if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String getModuleType() {
|
||||
String[] xPath = new String[] { "/ModuleType" };
|
||||
public static String getModuleType(ModuleIdentification mi) {
|
||||
ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = WorkspaceProfile.getModuleXmlObject(mi);
|
||||
|
||||
XmlObject[] returns = get(xPath);
|
||||
if (returns != null && returns.length > 0) {
|
||||
ModuleTypeDef type = (ModuleTypeDef) returns[0];
|
||||
return type.enumValue().toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
return msa.getMsaHeader().getModuleType()+"";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -365,8 +338,7 @@ public class SurfaceAreaQuery {
|
|||
packageGuid = item.getPackageGuid();
|
||||
packageVersion = item.getPackageVersion();
|
||||
|
||||
Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();
|
||||
Iterator<PackageIdentification> ispi = spi.iterator();
|
||||
Iterator<PackageIdentification> ispi = GlobalData.vPackageList.iterator();
|
||||
String ver = "";
|
||||
while(ispi.hasNext()) {
|
||||
PackageIdentification pi = ispi.next();
|
||||
|
@ -422,813 +394,18 @@ public class SurfaceAreaQuery {
|
|||
return libraryClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve ModuleEntryPoint names
|
||||
*
|
||||
* @returns ModuleEntryPoint name list if elements are found at the known
|
||||
* xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String[] getModuleEntryPointArray() {
|
||||
String[] xPath = new String[] { "/Extern/ModuleEntryPoint" };
|
||||
|
||||
XmlObject[] returns = get("Externs", xPath);
|
||||
|
||||
if (returns != null && returns.length > 0) {
|
||||
String[] entryPoints = new String[returns.length];
|
||||
|
||||
for (int i = 0; i < returns.length; ++i) {
|
||||
entryPoints[i] = ((XmlNormalizedString) returns[i])
|
||||
.getStringValue();
|
||||
}
|
||||
|
||||
return entryPoints;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve ModuleUnloadImage names
|
||||
*
|
||||
* @returns ModuleUnloadImage name list if elements are found at the known
|
||||
* xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String[] getModuleUnloadImageArray() {
|
||||
String[] xPath = new String[] { "/Extern/ModuleUnloadImage" };
|
||||
|
||||
XmlObject[] returns = get("Externs", xPath);
|
||||
if (returns != null && returns.length > 0) {
|
||||
String[] stringArray = new String[returns.length];
|
||||
XmlNormalizedString[] doc = (XmlNormalizedString[]) returns;
|
||||
|
||||
for (int i = 0; i < returns.length; ++i) {
|
||||
stringArray[i] = doc[i].getStringValue();
|
||||
}
|
||||
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Extern
|
||||
*
|
||||
* @returns Extern objects list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static ExternsDocument.Externs.Extern[] getExternArray() {
|
||||
String[] xPath = new String[] { "/Extern" };
|
||||
|
||||
XmlObject[] returns = get("Externs", xPath);
|
||||
if (returns != null && returns.length > 0) {
|
||||
return (ExternsDocument.Externs.Extern[]) returns;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Library instance information
|
||||
*
|
||||
* @param arch
|
||||
* Architecture name
|
||||
* @param usage
|
||||
* Library instance usage
|
||||
*
|
||||
* @returns library instance name list if elements are found at the known
|
||||
* xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static ModuleIdentification[] getLibraryInstance(String arch) {
|
||||
String[] xPath;
|
||||
String saGuid = null;
|
||||
String saVersion = null;
|
||||
String pkgGuid = null;
|
||||
String pkgVersion = null;
|
||||
|
||||
if (arch == null || arch.equalsIgnoreCase("")) {
|
||||
xPath = new String[] { "/Instance" };
|
||||
} else {
|
||||
xPath = new String[] { "/Instance[not(@SupArchList) or @SupArchList='"
|
||||
+ arch + "']" };
|
||||
}
|
||||
|
||||
XmlObject[] returns = get("Libraries", xPath);
|
||||
if (returns == null || returns.length == 0) {
|
||||
return new ModuleIdentification[0];
|
||||
}
|
||||
|
||||
ModuleIdentification[] saIdList = new ModuleIdentification[returns.length];
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
LibrariesDocument.Libraries.Instance library = (LibrariesDocument.Libraries.Instance) returns[i];
|
||||
saGuid = library.getModuleGuid();
|
||||
saVersion = library.getModuleVersion();
|
||||
|
||||
pkgGuid = library.getPackageGuid();
|
||||
pkgVersion = library.getPackageVersion();
|
||||
|
||||
ModuleIdentification saId = new ModuleIdentification(null, saGuid,
|
||||
saVersion);
|
||||
PackageIdentification pkgId = new PackageIdentification(null,
|
||||
pkgGuid, pkgVersion);
|
||||
saId.setPackage(pkgId);
|
||||
|
||||
saIdList[i] = saId;
|
||||
|
||||
}
|
||||
return saIdList;
|
||||
}
|
||||
|
||||
// /
|
||||
// / This method is used for retrieving the elements information which has
|
||||
// / CName sub-element
|
||||
// /
|
||||
private static String[] getCNames(String from, String xPath[]) {
|
||||
XmlObject[] returns = get(from, xPath);
|
||||
if (returns == null || returns.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String[] strings = new String[returns.length];
|
||||
for (int i = 0; i < returns.length; ++i) {
|
||||
// TBD
|
||||
// strings[i] = ((CName) returns[i]).getStringValue();
|
||||
}
|
||||
|
||||
return strings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive library's constructor name
|
||||
*
|
||||
* @returns constructor name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String getLibConstructorName() {
|
||||
String[] xPath = new String[] { "/Extern/Constructor" };
|
||||
|
||||
XmlObject[] returns = get("Externs", xPath);
|
||||
if (returns != null && returns.length > 0) {
|
||||
// CName constructor = (CName) returns[0];
|
||||
// return constructor.getStringValue();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive library's destructor name
|
||||
*
|
||||
* @returns destructor name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String getLibDestructorName() {
|
||||
String[] xPath = new String[] { "/Extern/Destructor" };
|
||||
|
||||
XmlObject[] returns = get("Externs", xPath);
|
||||
if (returns != null && returns.length > 0) {
|
||||
// CName destructor = (CName) returns[0];
|
||||
// return destructor.getStringValue();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive DriverBinding names
|
||||
*
|
||||
* @returns DriverBinding name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String[] getDriverBindingArray() {
|
||||
String[] xPath = new String[] { "/Extern/DriverBinding" };
|
||||
return getCNames("Externs", xPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive ComponentName names
|
||||
*
|
||||
* @returns ComponentName name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String[] getComponentNameArray() {
|
||||
String[] xPath = new String[] { "/Extern/ComponentName" };
|
||||
return getCNames("Externs", xPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive DriverConfig names
|
||||
*
|
||||
* @returns DriverConfig name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String[] getDriverConfigArray() {
|
||||
String[] xPath = new String[] { "/Extern/DriverConfig" };
|
||||
return getCNames("Externs", xPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive DriverDiag names
|
||||
*
|
||||
* @returns DriverDiag name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String[] getDriverDiagArray() {
|
||||
String[] xPath = new String[] { "/Extern/DriverDiag" };
|
||||
return getCNames("Externs", xPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive SetVirtualAddressMapCallBack names
|
||||
*
|
||||
* @returns SetVirtualAddressMapCallBack name list if elements are found at
|
||||
* the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String[] getSetVirtualAddressMapCallBackArray() {
|
||||
String[] xPath = new String[] { "/Extern/SetVirtualAddressMapCallBack" };
|
||||
return getCNames("Externs", xPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive ExitBootServicesCallBack names
|
||||
*
|
||||
* @returns ExitBootServicesCallBack name list if elements are found at the
|
||||
* known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String[] getExitBootServicesCallBackArray() {
|
||||
String[] xPath = new String[] { "/Extern/ExitBootServicesCallBack" };
|
||||
return getCNames("Externs", xPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve module surface area file information
|
||||
*
|
||||
* @returns ModuleSA objects list if elements are found at the known xpath
|
||||
* @returns Empty ModuleSA list if nothing is there
|
||||
*/
|
||||
public static Map<FpdModuleIdentification, Map<String, XmlObject>> getFpdModules() {
|
||||
String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };
|
||||
XmlObject[] result = get("FrameworkPlatformDescription", xPath);
|
||||
String arch = null;
|
||||
String fvBinding = null;
|
||||
String saGuid = null;
|
||||
String saVersion = null;
|
||||
String pkgGuid = null;
|
||||
String pkgVersion = null;
|
||||
|
||||
Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleMap = new LinkedHashMap<FpdModuleIdentification, Map<String, XmlObject>>();
|
||||
|
||||
if (result == null) {
|
||||
return fpdModuleMap;
|
||||
}
|
||||
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
//
|
||||
// Get Fpd SA Module element node and add to xmlObjectMap.
|
||||
//
|
||||
Map<String, XmlObject> xmlObjectMap = new HashMap<String, XmlObject>();
|
||||
ModuleSADocument.ModuleSA moduleSA = (ModuleSADocument.ModuleSA) result[i];
|
||||
if (((ModuleSADocument.ModuleSA) result[i]).getLibraries() != null) {
|
||||
xmlObjectMap.put("Libraries", moduleSA.getLibraries());
|
||||
}
|
||||
if (((ModuleSADocument.ModuleSA) result[i]).getPcdBuildDefinition() != null) {
|
||||
xmlObjectMap.put("PcdBuildDefinition", moduleSA
|
||||
.getPcdBuildDefinition());
|
||||
}
|
||||
if (((ModuleSADocument.ModuleSA) result[i])
|
||||
.getModuleSaBuildOptions() != null) {
|
||||
xmlObjectMap.put("ModuleSaBuildOptions", moduleSA
|
||||
.getModuleSaBuildOptions());
|
||||
}
|
||||
|
||||
//
|
||||
// Get Fpd SA Module attribute and create FpdMoudleIdentification.
|
||||
//
|
||||
arch = moduleSA.getSupArchList().toString();
|
||||
|
||||
// TBD
|
||||
fvBinding = null;
|
||||
saVersion = ((ModuleSADocument.ModuleSA) result[i])
|
||||
.getModuleVersion();
|
||||
|
||||
saGuid = moduleSA.getModuleGuid();
|
||||
pkgGuid = moduleSA.getPackageGuid();
|
||||
pkgVersion = moduleSA.getPackageVersion();
|
||||
|
||||
//
|
||||
// Create Module Identification which have class member of package
|
||||
// identification.
|
||||
//
|
||||
PackageIdentification pkgId = new PackageIdentification(null,
|
||||
pkgGuid, pkgVersion);
|
||||
ModuleIdentification saId = new ModuleIdentification(null, saGuid,
|
||||
saVersion);
|
||||
|
||||
saId.setPackage(pkgId);
|
||||
|
||||
//
|
||||
// Create FpdModule Identification which have class member of module
|
||||
// identification
|
||||
//
|
||||
FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId,
|
||||
arch);
|
||||
if (arch != null) {
|
||||
fpdSaId.setArch(arch);
|
||||
}
|
||||
if (fvBinding != null) {
|
||||
fpdSaId.setFvBinding(fvBinding);
|
||||
}
|
||||
|
||||
//
|
||||
// Put element to Map<FpdModuleIdentification, Map<String,
|
||||
// XmlObject>>.
|
||||
//
|
||||
fpdModuleMap.put(fpdSaId, xmlObjectMap);
|
||||
}
|
||||
return fpdModuleMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve valid image names
|
||||
*
|
||||
* @returns valid iamges name list if elements are found at the known xpath
|
||||
* @returns empty list if nothing is there
|
||||
*/
|
||||
public static String[] getFpdValidImageNames() {
|
||||
String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FvImages/FvImage[@Type='ValidImageNames']/FvImageNames" };
|
||||
|
||||
XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath);
|
||||
if (queryResult == null) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
String[] result = new String[queryResult.length];
|
||||
for (int i = 0; i < queryResult.length; i++) {
|
||||
result[i] = ((XmlString) queryResult[i]).getStringValue();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static XmlObject getFpdBuildOptions() {
|
||||
String[] xPath = new String[] { "/BuildOptions" };
|
||||
|
||||
XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath);
|
||||
|
||||
if (queryResult == null || queryResult.length == 0) {
|
||||
return null;
|
||||
}
|
||||
return queryResult[0];
|
||||
}
|
||||
|
||||
public static PlatformIdentification getFpdHeader() {
|
||||
String[] xPath = new String[] { "/PlatformHeader" };
|
||||
|
||||
XmlObject[] returns = get("FrameworkPlatformDescription", xPath);
|
||||
|
||||
if (returns == null || returns.length == 0) {
|
||||
return null;
|
||||
}
|
||||
PlatformHeaderDocument.PlatformHeader header = (PlatformHeaderDocument.PlatformHeader) returns[0];
|
||||
|
||||
String name = header.getPlatformName();
|
||||
|
||||
String guid = header.getGuidValue();
|
||||
|
||||
String version = header.getVersion();
|
||||
|
||||
return new PlatformIdentification(name, guid, version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve flash definition file name
|
||||
*
|
||||
* @returns file name if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String getFlashDefinitionFile() {
|
||||
String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FlashDefinitionFile" };
|
||||
|
||||
XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath);
|
||||
if (queryResult == null || queryResult.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FileNameConvention filename = (FileNameConvention) queryResult[queryResult.length - 1];
|
||||
return filename.getStringValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve FV image component options
|
||||
*
|
||||
* @param fvName
|
||||
* FV image name
|
||||
*
|
||||
* @returns name/value pairs list if elements are found at the known xpath
|
||||
* @returns empty list if nothing is there
|
||||
*/
|
||||
public static String[][] getFpdComponents(String fvName) {
|
||||
String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/DataRegions/FvDataRegion[@Name='"
|
||||
+ fvName.toUpperCase() + "']/DataId" };
|
||||
|
||||
XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath);
|
||||
if (queryResult == null) {
|
||||
return new String[0][];
|
||||
}
|
||||
|
||||
ArrayList<String[]> list = new ArrayList<String[]>();
|
||||
for (int i = 0; i < queryResult.length; i++) {
|
||||
DataIdDocument.DataId item = (DataIdDocument.DataId) queryResult[i];
|
||||
list
|
||||
.add(new String[] { item.getStringValue(),
|
||||
item.getDataSize() });
|
||||
}
|
||||
|
||||
String[][] result = new String[list.size()][2];
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
result[i][0] = list.get(i)[0];
|
||||
result[i][1] = list.get(i)[1];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve PCD tokens
|
||||
*
|
||||
* @returns CName/ItemType pairs list if elements are found at the known
|
||||
* xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String[][] getPcdTokenArray() {
|
||||
String[] xPath = new String[] { "/PcdData" };
|
||||
|
||||
XmlObject[] returns = get("PCDs", xPath);
|
||||
if (returns == null || returns.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// PcdCoded.PcdData[] pcds = (PcdCoded.PcdData[]) returns;
|
||||
// String[][] result = new String[pcds.length][2];
|
||||
// for (int i = 0; i < returns.length; ++i) {
|
||||
// if (pcds[i].getItemType() != null) {
|
||||
// result[i][1] = pcds[i].getItemType().toString();
|
||||
// } else {
|
||||
// result[i][1] = null;
|
||||
// }
|
||||
// result[i][0] = pcds[i].getCName();
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve MSA header
|
||||
*
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public static ModuleIdentification getMsaHeader() {
|
||||
String[] xPath = new String[] { "/" };
|
||||
XmlObject[] returns = get("MsaHeader", xPath);
|
||||
|
||||
if (returns == null || returns.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MsaHeader msaHeader = (MsaHeader) returns[0];
|
||||
//
|
||||
// Get BaseName, ModuleType, GuidValue, Version
|
||||
// which in MsaHeader.
|
||||
//
|
||||
String name = msaHeader.getModuleName();
|
||||
String moduleType = "";
|
||||
if (msaHeader.getModuleType() != null) {
|
||||
moduleType = msaHeader.getModuleType().toString();
|
||||
public static XmlObject[] getSpdPcdDeclarations(PackageIdentification pi) {
|
||||
XmlObject[] returns = null;
|
||||
PackageSurfaceAreaDocument.PackageSurfaceArea psa = WorkspaceProfile.getPackageXmlObject(pi);
|
||||
if (psa.getPcdDeclarations() != null && psa.getPcdDeclarations().getPcdEntryList() != null) {
|
||||
int size = psa.getPcdDeclarations().getPcdEntryList().size();
|
||||
returns = new XmlObject[size];
|
||||
for (int i = 0; i < size; ++i) {
|
||||
returns[i] = psa.getPcdDeclarations().getPcdEntryList().get(i);
|
||||
}
|
||||
}
|
||||
|
||||
String guid = msaHeader.getGuidValue();
|
||||
String version = msaHeader.getVersion();
|
||||
|
||||
ModuleIdentification moduleId = new ModuleIdentification(name, guid,
|
||||
version);
|
||||
|
||||
moduleId.setModuleType(moduleType);
|
||||
|
||||
return moduleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Extern Specification
|
||||
*
|
||||
* @param
|
||||
*
|
||||
* @return String[] If have specification element in the <extern> String[0]
|
||||
* If no specification element in the <extern>
|
||||
*
|
||||
*/
|
||||
|
||||
public static String[] getExternSpecificaiton() {
|
||||
String[] xPath = new String[] { "/Specification" };
|
||||
|
||||
XmlObject[] queryResult = get("Externs", xPath);
|
||||
if (queryResult == null) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
String[] specificationList = new String[queryResult.length];
|
||||
for (int i = 0; i < queryResult.length; i++) {
|
||||
// specificationList[i] = ((SpecificationDocument.Specification)
|
||||
// queryResult[i])
|
||||
// .getStringValue();
|
||||
}
|
||||
return specificationList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive MsaFile which in SPD
|
||||
*
|
||||
* @param
|
||||
* @return String[][3] The string sequence is ModuleName, ModuleGuid,
|
||||
* ModuleVersion, MsaFile String[0][] If no msafile in SPD
|
||||
*/
|
||||
public static String[] getSpdMsaFile() {
|
||||
String[] xPath = new String[] { "/MsaFiles" };
|
||||
|
||||
XmlObject[] returns = get("PackageSurfaceArea", xPath);
|
||||
if (returns == null) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
List<String> filenameList = ((MsaFilesDocument.MsaFiles) returns[0])
|
||||
.getFilenameList();
|
||||
return filenameList.toArray(new String[filenameList.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reteive
|
||||
*/
|
||||
public static Map<String, String[]> getSpdLibraryClasses() {
|
||||
String[] xPath = new String[] { "/LibraryClassDeclarations/LibraryClass" };
|
||||
|
||||
XmlObject[] returns = get("PackageSurfaceArea", xPath);
|
||||
|
||||
//
|
||||
// Create Map, Key - LibraryClass, String[] - LibraryClass Header file.
|
||||
//
|
||||
Map<String, String[]> libClassHeaderMap = new HashMap<String, String[]>();
|
||||
|
||||
if (returns == null) {
|
||||
return libClassHeaderMap;
|
||||
}
|
||||
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass library = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass) returns[i];
|
||||
libClassHeaderMap.put(library.getName(), new String[] { library
|
||||
.getIncludeHeader() });
|
||||
}
|
||||
return libClassHeaderMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reteive
|
||||
*/
|
||||
public static Map<String, String> getSpdPackageHeaderFiles() {
|
||||
String[] xPath = new String[] { "/PackageHeaders/IncludePkgHeader" };
|
||||
|
||||
XmlObject[] returns = get("PackageSurfaceArea", xPath);
|
||||
|
||||
//
|
||||
// Create Map, Key - ModuleType, String - PackageInclude Header file.
|
||||
//
|
||||
Map<String, String> packageIncludeMap = new HashMap<String, String>();
|
||||
|
||||
if (returns == null) {
|
||||
return packageIncludeMap;
|
||||
}
|
||||
WorkspaceProfile.log.info("" + returns[0].getClass().getName());
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
PackageHeadersDocument.PackageHeaders.IncludePkgHeader includeHeader = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) returns[i];
|
||||
packageIncludeMap.put(includeHeader.getModuleType().toString(),
|
||||
includeHeader.getStringValue());
|
||||
}
|
||||
return packageIncludeMap;
|
||||
}
|
||||
|
||||
public static PackageIdentification getSpdHeader() {
|
||||
String[] xPath = new String[] { "/SpdHeader" };
|
||||
|
||||
XmlObject[] returns = get("PackageSurfaceArea", xPath);
|
||||
|
||||
if (returns == null || returns.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SpdHeaderDocument.SpdHeader header = (SpdHeaderDocument.SpdHeader) returns[0];
|
||||
|
||||
String name = header.getPackageName();
|
||||
|
||||
String guid = header.getGuidValue();
|
||||
|
||||
String version = header.getVersion();
|
||||
|
||||
return new PackageIdentification(name, guid, version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reteive
|
||||
*/
|
||||
public static Map<String, String[]> getSpdGuid() {
|
||||
String[] xPath = new String[] { "/GuidDeclarations/Entry" };
|
||||
|
||||
XmlObject[] returns = get("PackageSurfaceArea", xPath);
|
||||
|
||||
//
|
||||
// Create Map, Key - GuidName, String[] - C_NAME & GUID value.
|
||||
//
|
||||
Map<String, String[]> guidDeclMap = new HashMap<String, String[]>();
|
||||
if (returns == null) {
|
||||
return guidDeclMap;
|
||||
}
|
||||
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
GuidDeclarationsDocument.GuidDeclarations.Entry entry = (GuidDeclarationsDocument.GuidDeclarations.Entry) returns[i];
|
||||
String[] guidPair = new String[2];
|
||||
guidPair[0] = entry.getCName();
|
||||
guidPair[1] = entry.getGuidValue();
|
||||
guidDeclMap.put(entry.getName(), guidPair);
|
||||
}
|
||||
return guidDeclMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reteive
|
||||
*/
|
||||
public static Map<String, String[]> getSpdProtocol() {
|
||||
String[] xPath = new String[] { "/ProtocolDeclarations/Entry" };
|
||||
|
||||
XmlObject[] returns = get("PackageSurfaceArea", xPath);
|
||||
|
||||
//
|
||||
// Create Map, Key - protocolName, String[] - C_NAME & GUID value.
|
||||
//
|
||||
Map<String, String[]> protoclMap = new HashMap<String, String[]>();
|
||||
|
||||
if (returns == null) {
|
||||
return protoclMap;
|
||||
}
|
||||
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
ProtocolDeclarationsDocument.ProtocolDeclarations.Entry entry = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) returns[i];
|
||||
String[] protocolPair = new String[2];
|
||||
|
||||
protocolPair[0] = entry.getCName();
|
||||
protocolPair[1] = entry.getGuidValue();
|
||||
protoclMap.put(entry.getName(), protocolPair);
|
||||
}
|
||||
return protoclMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* getSpdPpi() Retrieve the SPD PPI Entry
|
||||
*
|
||||
* @param
|
||||
* @return Map<String, String[2]> if get the PPI entry from SPD. Key - PPI
|
||||
* Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI
|
||||
* entry in SPD.
|
||||
*/
|
||||
public static Map<String, String[]> getSpdPpi() {
|
||||
String[] xPath = new String[] { "/PpiDeclarations/Entry" };
|
||||
|
||||
XmlObject[] returns = get("PackageSurfaceArea", xPath);
|
||||
|
||||
//
|
||||
// Create Map, Key - protocolName, String[] - C_NAME & GUID value.
|
||||
//
|
||||
Map<String, String[]> ppiMap = new HashMap<String, String[]>();
|
||||
|
||||
if (returns == null) {
|
||||
return ppiMap;
|
||||
}
|
||||
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
PpiDeclarationsDocument.PpiDeclarations.Entry entry = (PpiDeclarationsDocument.PpiDeclarations.Entry) returns[i];
|
||||
String[] ppiPair = new String[2];
|
||||
ppiPair[0] = entry.getCName();
|
||||
ppiPair[1] = entry.getGuidValue();
|
||||
ppiMap.put(entry.getName(), ppiPair);
|
||||
}
|
||||
return ppiMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* getModuleSupportedArchs()
|
||||
*
|
||||
* This function is to Retrieve Archs one module supported.
|
||||
*
|
||||
* @param
|
||||
* @return supportArch String of supporting archs. null No arch specified in
|
||||
* <MouduleSupport> element.
|
||||
*/
|
||||
public static List<String> getModuleSupportedArchs() {
|
||||
String[] xPath = new String[] { "/ModuleDefinitions/SupportedArchitectures" };
|
||||
|
||||
XmlObject[] returns = get("ModuleSurfaceArea", xPath);
|
||||
|
||||
if (returns == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (List<String>)returns[0];
|
||||
}
|
||||
|
||||
public static XmlObject[] getSpdPcdDeclarations() {
|
||||
String[] xPath = null;
|
||||
// if (tsGuid != null){
|
||||
// xPath = new String[] { "/PcdDeclarations/PcdEntry[C_Name='" + cName + "' and TokenSpaceGuid='"+ tsGuid + "']" };
|
||||
// }
|
||||
// else{
|
||||
// xPath = new String[] { "/PcdDeclarations/PcdEntry[C_Name='" + cName + "']" };
|
||||
// }
|
||||
xPath = new String[] { "/PcdDeclarations/PcdEntry"};
|
||||
XmlObject[] returns = get("PackageSurfaceArea", xPath);
|
||||
|
||||
return returns;
|
||||
}
|
||||
|
||||
public static XmlObject[] getFpdPcdBuildDefinitions(String cName, String tsGuid, String type) {
|
||||
String[] xPath = new String[] { "/PcdBuildDefinition/PcdData[C_Name='" + cName + "' and TokenSpaceGuid='"
|
||||
+ tsGuid + "' and DatumType!='" + type + "']" };
|
||||
|
||||
XmlObject[] returns = get("ModuleSA", xPath);
|
||||
|
||||
return returns;
|
||||
}
|
||||
/**
|
||||
* getToolChainFamily
|
||||
*
|
||||
* This function is to retrieve ToolChainFamily attribute of FPD
|
||||
* <BuildOptions>
|
||||
*
|
||||
* @param
|
||||
* @return toolChainFamily If find toolChainFamily attribute in
|
||||
* <BuildOptions> Null If don't have toolChainFamily in
|
||||
* <BuildOptions>.
|
||||
*/
|
||||
public String getToolChainFamily() {
|
||||
String[] xPath = new String[] { "/BuildOptions" };
|
||||
|
||||
XmlObject[] result = get("FrameworkPlatformDescription", xPath);
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
// toolChainFamily =
|
||||
// ((BuildOptionsDocument.BuildOptions)result[0]).getToolChainFamilies();
|
||||
// return toolChainFamily;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve module Guid string
|
||||
*
|
||||
* @returns GUILD string if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
public static String getModuleGuid() {
|
||||
String[] xPath = new String[] { "" };
|
||||
|
||||
XmlObject[] returns = get("MsaHeader", xPath);
|
||||
if (returns != null && returns.length > 0) {
|
||||
String guid = ((MsaHeaderDocument.MsaHeader) returns[0])
|
||||
.getGuidValue();
|
||||
return guid;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
// For new Pcd
|
||||
//
|
||||
public static ModuleSADocument.ModuleSA[] getFpdModuleSAs() {
|
||||
String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };
|
||||
XmlObject[] result = get("FrameworkPlatformDescription", xPath);
|
||||
if (result != null) {
|
||||
return (ModuleSADocument.ModuleSA[]) result;
|
||||
}
|
||||
return new ModuleSADocument.ModuleSA[0];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,28 +16,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
**/
|
||||
package org.tianocore.frameworkwizard.platform.ui.global;
|
||||
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.tianocore.DbPathAndFilename;
|
||||
import org.tianocore.FrameworkDatabaseDocument;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument;
|
||||
import org.tianocore.PackageSurfaceAreaDocument;
|
||||
import org.tianocore.PcdCodedDocument;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.FpdModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.id.PlatformIdentification;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import org.tianocore.frameworkwizard.common.GlobalData;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
WorkspaceProfile provide initializing, instoring, querying and update global data.
|
||||
|
@ -50,102 +37,11 @@ import java.util.logging.Logger;
|
|||
@since GenBuild 1.0
|
||||
**/
|
||||
public class WorkspaceProfile {
|
||||
|
||||
|
||||
public static Logger log = Logger.getAnonymousLogger();
|
||||
public static KeyComparator comparator = new KeyComparator();
|
||||
///
|
||||
/// Record current WORKSPACE Directory
|
||||
///
|
||||
private static String workspaceDir = "";
|
||||
|
||||
///
|
||||
/// Be used to ensure Global data will be initialized only once.
|
||||
///
|
||||
// private static boolean globalFlag = false;
|
||||
|
||||
///
|
||||
/// Framework Database information: package list and platform list
|
||||
///
|
||||
private static Set<PackageIdentification> packageList = new HashSet<PackageIdentification>();
|
||||
|
||||
private static Set<PlatformIdentification> platformList = new HashSet<PlatformIdentification>();
|
||||
|
||||
///
|
||||
/// Every detail SPD informations: Module list, Library class definition,
|
||||
/// Package header file, GUID/PPI/Protocol definitions
|
||||
///
|
||||
private static final Map<PackageIdentification, Spd> spdTable = new HashMap<PackageIdentification, Spd>();
|
||||
|
||||
///
|
||||
/// Build informations are divided into three parts:
|
||||
/// 1. From MSA 2. From FPD 3. From FPD' ModuleSA
|
||||
///
|
||||
private static Map<ModuleIdentification, Map<String, XmlObject>> nativeMsa = new HashMap<ModuleIdentification, Map<String, XmlObject>>();
|
||||
|
||||
private static Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleSA= new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();
|
||||
|
||||
private static XmlObject fpdBuildOptions;
|
||||
|
||||
private static XmlObject fpdDynamicPcds;
|
||||
|
||||
///
|
||||
/// Parsed modules list
|
||||
///
|
||||
private static Map<FpdModuleIdentification, Map<String, XmlObject>> parsedModules = new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();
|
||||
|
||||
///
|
||||
/// built modules list with ARCH, TARGET, TOOLCHAIN
|
||||
///
|
||||
private static Set<FpdModuleIdentification> builtModules = new HashSet<FpdModuleIdentification>();
|
||||
|
||||
/**
|
||||
Parse framework database (DB) and all SPD files listed in DB to initialize
|
||||
the environment for next build. This method will only be executed only once
|
||||
in the whole build process.
|
||||
|
||||
@param workspaceDatabaseFile the file name of framework database
|
||||
@param workspaceDir current workspace directory path
|
||||
@throws Exception
|
||||
Framework Dababase or SPD or MSA file is not valid
|
||||
**/
|
||||
public synchronized static void initInfo(String workspaceDatabaseFile, String workspaceDir) throws Exception {
|
||||
|
||||
//
|
||||
// Backup workspace directory. It will be used by other method
|
||||
//
|
||||
WorkspaceProfile.workspaceDir = workspaceDir.replaceAll("(\\\\)", "/");
|
||||
File dbFile = new File(workspaceDir + File.separatorChar + workspaceDatabaseFile);
|
||||
try {
|
||||
FrameworkDatabaseDocument db = (FrameworkDatabaseDocument) XmlObject.Factory.parse(dbFile);
|
||||
//
|
||||
// validate FrameworkDatabaseFile
|
||||
//
|
||||
// if (! db.validate()) {
|
||||
// throw new Exception("Framework Database file [" + dbFile.getPath() + "] is invalid.");
|
||||
// }
|
||||
//
|
||||
// Get package list
|
||||
//
|
||||
packageList.clear();
|
||||
List<DbPathAndFilename> packages = db.getFrameworkDatabase().getPackageList().getFilenameList();
|
||||
|
||||
Iterator iter = packages.iterator();
|
||||
while (iter.hasNext()) {
|
||||
DbPathAndFilename dbPath = (DbPathAndFilename)iter.next();
|
||||
String fileName = dbPath.getStringValue();
|
||||
Spd spd = new Spd(new File(workspaceDir + File.separatorChar + fileName));
|
||||
packageList.add(spd.getPackageId());
|
||||
spdTable.put(spd.getPackageId(), spd);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new Exception("Parse workspace Database [" + dbFile.getPath() + "] Error.\n" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get the current WORKSPACE Directory.
|
||||
|
||||
|
@ -155,313 +51,57 @@ public class WorkspaceProfile {
|
|||
return workspaceDir;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the MSA file name with absolute path
|
||||
*/
|
||||
public synchronized static File getMsaFile(ModuleIdentification moduleId) throws Exception {
|
||||
File msaFile = null;
|
||||
//
|
||||
// TBD. Do only when package is null.
|
||||
//
|
||||
Iterator iter = packageList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
PackageIdentification packageId = (PackageIdentification)iter.next();
|
||||
Spd spd = spdTable.get(packageId);
|
||||
msaFile = spd.getModuleFile(moduleId);
|
||||
if (msaFile != null ) {
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if (msaFile == null){
|
||||
throw new Exception("Can not find Module [" + moduleId.getName() + "] in any packages in this workspace.");
|
||||
}
|
||||
else {
|
||||
return msaFile;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized static PackageIdentification getPackageForModule(ModuleIdentification moduleId) {
|
||||
//
|
||||
// If package already defined in module
|
||||
//
|
||||
if (moduleId.getPackage() != null) {
|
||||
return moduleId.getPackage();
|
||||
if (moduleId.getPackageId() != null) {
|
||||
return moduleId.getPackageId();
|
||||
}
|
||||
|
||||
PackageIdentification packageId = null;
|
||||
Iterator iter = packageList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
packageId = (PackageIdentification)iter.next();
|
||||
|
||||
Spd spd = spdTable.get(packageId);
|
||||
if (spd.getModuleFile(moduleId) != null ) {
|
||||
moduleId.setPackage(packageId);
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if (packageId == null){
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return packageId;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Difference between build and parse: ToolChain and Target
|
||||
**/
|
||||
public synchronized static boolean isModuleBuilt(FpdModuleIdentification moduleId) {
|
||||
return builtModules.contains(moduleId);
|
||||
}
|
||||
|
||||
public synchronized static void registerBuiltModule(FpdModuleIdentification fpdModuleId) {
|
||||
builtModules.add(fpdModuleId);
|
||||
}
|
||||
|
||||
|
||||
public synchronized static void registerFpdModuleSA(FpdModuleIdentification fpdModuleId, Map<String, XmlObject> doc) throws Exception{
|
||||
Map<String, XmlObject> result = new HashMap<String, XmlObject>();
|
||||
Set keySet = doc.keySet();
|
||||
Iterator iter = keySet.iterator();
|
||||
while (iter.hasNext()){
|
||||
String key = (String)iter.next();
|
||||
XmlObject item = cloneXmlObject(doc.get(key), true);
|
||||
result.put(key, item);
|
||||
}
|
||||
fpdModuleSA.put(fpdModuleId, result);
|
||||
}
|
||||
|
||||
/**
|
||||
Query overrided module surface area information. If current is Package
|
||||
or Platform build, also include the information from FPD file.
|
||||
|
||||
<p>Note that surface area parsing is incremental. That means the method will
|
||||
only parse the MSA and MBD files if necessary. </p>
|
||||
|
||||
@param moduleName the base name of the module
|
||||
@return the overrided module surface area information
|
||||
@throws Exception
|
||||
MSA or MBD is not valid
|
||||
**/
|
||||
public synchronized static Map<String, XmlObject> getDoc(FpdModuleIdentification fpdModuleId) throws Exception {
|
||||
if (parsedModules.containsKey(fpdModuleId)) {
|
||||
return parsedModules.get(fpdModuleId);
|
||||
}
|
||||
Map<String, XmlObject> doc = new HashMap<String, XmlObject>();
|
||||
ModuleIdentification moduleId = fpdModuleId.getModule();
|
||||
//
|
||||
// First part: get the MSA files info
|
||||
//
|
||||
doc = getNativeMsa(moduleId);
|
||||
|
||||
//
|
||||
// Second part: put build options
|
||||
//
|
||||
doc.put("BuildOptions", fpdBuildOptions);
|
||||
|
||||
//
|
||||
// Third part: get Module info from FPD, such as Library instances, PCDs
|
||||
//
|
||||
if (fpdModuleSA.containsKey(fpdModuleId)){
|
||||
//
|
||||
// merge module info in FPD to final Doc
|
||||
// For Library Module, do nothing here
|
||||
//
|
||||
doc.putAll(fpdModuleSA.get(fpdModuleId));
|
||||
}
|
||||
parsedModules.put(fpdModuleId, doc);
|
||||
return doc;
|
||||
}
|
||||
|
||||
public synchronized static Map<String, XmlObject> getDoc(ModuleIdentification moduleId, String arch) throws Exception {
|
||||
FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, arch);
|
||||
return getDoc(fpdModuleId);
|
||||
}
|
||||
/**
|
||||
Query the native MSA information with module base name.
|
||||
|
||||
<p>Note that MSA parsing is incremental. That means the method will
|
||||
only to parse the MSA files when never parsed before. </p>
|
||||
|
||||
@param moduleName the base name of the module
|
||||
@return the native MSA information
|
||||
@throws Exception
|
||||
MSA file is not valid
|
||||
**/
|
||||
public synchronized static Map<String, XmlObject> getNativeMsa(ModuleIdentification moduleId) throws Exception {
|
||||
if (nativeMsa.containsKey(moduleId)) {
|
||||
return nativeMsa.get(moduleId);
|
||||
}
|
||||
File msaFile = getMsaFile(moduleId);
|
||||
Map<String, XmlObject> msaMap = getNativeMsa(msaFile);
|
||||
nativeMsa.put(moduleId, msaMap);
|
||||
return msaMap;
|
||||
}
|
||||
|
||||
public synchronized static Map<String, XmlObject> getNativeMsa(File msaFile) throws Exception {
|
||||
|
||||
try {
|
||||
ModuleSurfaceAreaDocument doc = (ModuleSurfaceAreaDocument)XmlObject.Factory.parse(msaFile);
|
||||
//
|
||||
// Validate File if they accord with XML Schema
|
||||
//
|
||||
// if ( ! doc.validate()){
|
||||
// throw new Exception("Module Surface Area file [" + msaFile.getPath() + "] is invalid.");
|
||||
// }
|
||||
//
|
||||
// parse MSA file
|
||||
//
|
||||
ModuleSurfaceArea msa= doc.getModuleSurfaceArea();
|
||||
Map<String, XmlObject> msaMap = new HashMap<String, XmlObject>();
|
||||
msaMap.put("ModuleSurfaceArea", msa);
|
||||
msaMap.put("MsaHeader", cloneXmlObject(msa.getMsaHeader(), true));
|
||||
msaMap.put("LibraryClassDefinitions", cloneXmlObject(msa.getLibraryClassDefinitions(), true));
|
||||
msaMap.put("SourceFiles", cloneXmlObject(msa.getSourceFiles(), true));
|
||||
msaMap.put("PackageDependencies", cloneXmlObject(msa.getPackageDependencies(), true));
|
||||
msaMap.put("Protocols", cloneXmlObject(msa.getProtocols(), true));
|
||||
msaMap.put("PPIs", cloneXmlObject(msa.getPPIs(), true));
|
||||
msaMap.put("Guids", cloneXmlObject(msa.getGuids(), true));
|
||||
msaMap.put("Externs", cloneXmlObject(msa.getExterns(), true));
|
||||
return msaMap;
|
||||
}
|
||||
catch (Exception ex){
|
||||
throw new Exception(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, XmlObject> getFpdBuildOptions() {
|
||||
Map<String, XmlObject> map = new HashMap<String, XmlObject>();
|
||||
map.put("BuildOptions", fpdBuildOptions);
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void setFpdBuildOptions(XmlObject fpdBuildOptions) throws Exception{
|
||||
WorkspaceProfile.fpdBuildOptions = cloneXmlObject(fpdBuildOptions, true);
|
||||
}
|
||||
|
||||
public static XmlObject getFpdDynamicPcds() {
|
||||
return fpdDynamicPcds;
|
||||
}
|
||||
|
||||
public static void setFpdDynamicPcds(XmlObject fpdDynamicPcds) {
|
||||
WorkspaceProfile.fpdDynamicPcds = fpdDynamicPcds;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
|
||||
public static Set<ModuleIdentification> getModules(PackageIdentification packageId){
|
||||
Spd spd = spdTable.get(packageId);
|
||||
if (spd == null ) {
|
||||
Set<ModuleIdentification> dummy = new HashSet<ModuleIdentification>();
|
||||
return dummy;
|
||||
}
|
||||
else {
|
||||
return spd.getModules();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized static PlatformIdentification getPlatform(String name) throws Exception {
|
||||
Iterator iter = platformList.iterator();
|
||||
while(iter.hasNext()){
|
||||
PlatformIdentification platformId = (PlatformIdentification)iter.next();
|
||||
if (platformId.getName().equalsIgnoreCase(name)) {
|
||||
WorkspaceProfile.log.info("Platform: " + platformId + platformId.getFpdFile());
|
||||
return platformId;
|
||||
}
|
||||
}
|
||||
throw new Exception("Can not find platform [" + name + "] in the current workspace. ");
|
||||
}
|
||||
|
||||
public synchronized static File getPackageFile(PackageIdentification packageId) throws Exception {
|
||||
Iterator iter = packageList.iterator();
|
||||
while(iter.hasNext()){
|
||||
PackageIdentification packageItem = (PackageIdentification)iter.next();
|
||||
if (packageItem.equals(packageId)) {
|
||||
packageId.setName(packageItem.getName());
|
||||
return packageItem.getSpdFile();
|
||||
}
|
||||
}
|
||||
throw new Exception("Can not find " + packageId + " in the current workspace. ");
|
||||
}
|
||||
|
||||
public synchronized static File getModuleFile(ModuleIdentification moduleId) throws Exception {
|
||||
PackageIdentification packageId = getPackageForModule(moduleId);
|
||||
moduleId.setPackage(packageId);
|
||||
Spd spd = spdTable.get(packageId);
|
||||
return spd.getModuleFile(moduleId);
|
||||
return null;
|
||||
}
|
||||
//
|
||||
// expanded by FrameworkWizard
|
||||
//
|
||||
public synchronized static XmlObject getModuleXmlObject(ModuleIdentification moduleId) throws Exception {
|
||||
PackageIdentification packageId = getPackageForModule(moduleId);
|
||||
moduleId.setPackage(packageId);
|
||||
Spd spd = spdTable.get(packageId);
|
||||
return spd.msaDocMap.get(moduleId);
|
||||
public synchronized static ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleXmlObject(ModuleIdentification moduleId) {
|
||||
return GlobalData.openingModuleList.getModuleSurfaceAreaFromId(moduleId);
|
||||
}
|
||||
|
||||
public synchronized static XmlObject getPackageXmlObject(PackageIdentification packageId) {
|
||||
Spd spd = spdTable.get(packageId);
|
||||
if (spd != null){
|
||||
return spd.spdDocMap.get("PackageSurfaceArea");
|
||||
}
|
||||
return null;
|
||||
public synchronized static PackageSurfaceAreaDocument.PackageSurfaceArea getPackageXmlObject(PackageIdentification packageId) {
|
||||
return GlobalData.openingPackageList.getPackageSurfaceAreaFromId(packageId);
|
||||
}
|
||||
|
||||
public synchronized static Set<PackageIdentification> getPackageList(){
|
||||
return packageList;
|
||||
}
|
||||
///// remove!!
|
||||
private static XmlObject cloneXmlObject(XmlObject object, boolean deep) throws Exception {
|
||||
if ( object == null) {
|
||||
return null;
|
||||
}
|
||||
XmlObject result = null;
|
||||
try {
|
||||
result = XmlObject.Factory.parse(object.getDomNode()
|
||||
.cloneNode(deep));
|
||||
} catch (Exception ex) {
|
||||
throw new Exception(ex.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ModuleIdentification getModuleId(String key){
|
||||
//
|
||||
// Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.
|
||||
//
|
||||
String[] keyPart = key.split(" ");
|
||||
Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();
|
||||
Iterator ispi = spi.iterator();
|
||||
|
||||
while(ispi.hasNext()) {
|
||||
PackageIdentification pi = (PackageIdentification)ispi.next();
|
||||
if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){
|
||||
|
||||
continue;
|
||||
}
|
||||
if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){
|
||||
if(!pi.getVersion().equals(keyPart[3])){
|
||||
Iterator<ModuleIdentification> iMiList = GlobalData.vModuleList.iterator();
|
||||
|
||||
while (iMiList.hasNext()) {
|
||||
ModuleIdentification mi = iMiList.next();
|
||||
if (mi.getGuid().equalsIgnoreCase(keyPart[0])){
|
||||
if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){
|
||||
if(!mi.getVersion().equals(keyPart[1])){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
PackageIdentification pi = mi.getPackageId();
|
||||
if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Set<ModuleIdentification> smi = WorkspaceProfile.getModules(pi);
|
||||
Iterator ismi = smi.iterator();
|
||||
while(ismi.hasNext()) {
|
||||
ModuleIdentification mi = (ModuleIdentification)ismi.next();
|
||||
if (mi.getGuid().equalsIgnoreCase(keyPart[0])){
|
||||
if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){
|
||||
if(!mi.getVersion().equals(keyPart[1])){
|
||||
continue;
|
||||
}
|
||||
if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){
|
||||
if(!pi.getVersion().equals(keyPart[3])){
|
||||
continue;
|
||||
}
|
||||
|
||||
return mi;
|
||||
}
|
||||
return mi;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -499,10 +139,4 @@ public class WorkspaceProfile {
|
|||
|
||||
}
|
||||
|
||||
final class KeyComparator implements Comparator<String> {
|
||||
public int compare(String x, String y) {
|
||||
return x.compareToIgnoreCase(y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
/** @file
|
||||
Java class FpdModuleIdentification is used to present a module identification
|
||||
from BaseName, GUID, Version, PackageName, and ARCH.
|
||||
|
||||
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.frameworkwizard.platform.ui.id;
|
||||
|
||||
|
||||
/**
|
||||
This class is used to identify a module with BaseName, GUID, Version, PackageName
|
||||
and ARCH.
|
||||
|
||||
@since GenBuild 1.0
|
||||
**/
|
||||
public class FpdModuleIdentification {
|
||||
|
||||
private String arch;
|
||||
|
||||
private String fvBinding = "NULL"; // Optional
|
||||
|
||||
private String sequence = "0"; // Optional
|
||||
|
||||
private ModuleIdentification module;
|
||||
|
||||
public FpdModuleIdentification(String arch, String fvBinding, String sequence, ModuleIdentification module){
|
||||
this.arch = arch;
|
||||
this.fvBinding = fvBinding;
|
||||
this.sequence = sequence;
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public FpdModuleIdentification(ModuleIdentification module, String arch){
|
||||
this.arch = arch;
|
||||
this.module = module;
|
||||
}
|
||||
/**
|
||||
Override java.lang.Object#equals.
|
||||
|
||||
<p>Currently, use BaseName and ARCH to identify a module. It will enhance
|
||||
in the next version. </p>
|
||||
|
||||
@see java.lang.Object#equals(java.lang.Object)
|
||||
**/
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof FpdModuleIdentification) {
|
||||
FpdModuleIdentification moduleIdObj = (FpdModuleIdentification)obj;
|
||||
if ( module.equals(moduleIdObj.module) && arch.equalsIgnoreCase(moduleIdObj.arch)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void setFvBinding(String fvBinding) {
|
||||
this.fvBinding = fvBinding;
|
||||
}
|
||||
|
||||
public void setSequence(String sequence) {
|
||||
this.sequence = sequence;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return arch + ":" + module;
|
||||
}
|
||||
|
||||
public String getFvBinding() {
|
||||
return fvBinding;
|
||||
}
|
||||
|
||||
public String getSequence() {
|
||||
return sequence;
|
||||
}
|
||||
|
||||
public ModuleIdentification getModule() {
|
||||
return module;
|
||||
}
|
||||
|
||||
public void setModule(ModuleIdentification module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public String getArch() {
|
||||
return arch;
|
||||
}
|
||||
|
||||
public void setArch(String arch) {
|
||||
this.arch = arch;
|
||||
}
|
||||
|
||||
public int hashCode(){
|
||||
return module.hashCode();
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
package org.tianocore.frameworkwizard.platform.ui.id;
|
||||
|
||||
public class Identification {
|
||||
|
||||
String name;
|
||||
|
||||
String guid;
|
||||
|
||||
String version;
|
||||
|
||||
String type; // Optional
|
||||
|
||||
Identification(String name, String guid, String version){
|
||||
this.name = name;
|
||||
this.guid = guid;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Identification) {
|
||||
Identification id = (Identification)obj;
|
||||
if ( guid.equalsIgnoreCase(id.guid)) {
|
||||
if (version == null || id.version == null) {
|
||||
updateName(name, id.name);
|
||||
return true;
|
||||
}
|
||||
else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")){
|
||||
return true;
|
||||
}
|
||||
else if (version.equalsIgnoreCase(id.version)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
void updateName(String name1, String name2) {
|
||||
if (name1 == null) {
|
||||
name1 = name2;
|
||||
}
|
||||
if (name2 == null) {
|
||||
name2 = name1;
|
||||
}
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setGuid(String guid) {
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getGuid() {
|
||||
return guid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public int hashCode(){
|
||||
return guid.hashCode();
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package org.tianocore.frameworkwizard.platform.ui.id;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
|
||||
|
||||
public class ModuleIdentification extends Identification {
|
||||
|
||||
private PackageIdentification packageId;
|
||||
|
||||
private File msaFile;
|
||||
|
||||
private String moduleType;
|
||||
|
||||
private boolean isLibrary = false;
|
||||
|
||||
public boolean isLibrary() {
|
||||
return isLibrary;
|
||||
}
|
||||
|
||||
public void setLibrary(boolean isLibrary) {
|
||||
this.isLibrary = isLibrary;
|
||||
}
|
||||
|
||||
public File getMsaFile() throws Exception{
|
||||
prepareMsaFile();
|
||||
return msaFile;
|
||||
}
|
||||
|
||||
public String getModuleRelativePath() throws Exception{
|
||||
prepareMsaFile();
|
||||
return msaFile.getParent().substring(packageId.getPackageDir().length() + 1);
|
||||
}
|
||||
|
||||
private void prepareMsaFile()throws Exception{
|
||||
if (msaFile == null) {
|
||||
msaFile = WorkspaceProfile.getModuleFile(this);
|
||||
}
|
||||
}
|
||||
public void setMsaFile(File msaFile) {
|
||||
this.msaFile = msaFile;
|
||||
}
|
||||
|
||||
public ModuleIdentification(String name, String guid, String version){
|
||||
super(name, guid, version);
|
||||
}
|
||||
|
||||
public ModuleIdentification(String name, String guid, String version, PackageIdentification packageId){
|
||||
super(name, guid, version);
|
||||
this.packageId = packageId;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof ModuleIdentification) {
|
||||
ModuleIdentification id = (ModuleIdentification)obj;
|
||||
if (guid.equals(id.getGuid()) && packageId.equals(id.getPackage())) {
|
||||
if (version == null || id.version == null) {
|
||||
updateName(name, id.name);
|
||||
return true;
|
||||
}
|
||||
else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")){
|
||||
updateName(name, id.name);
|
||||
return true;
|
||||
}
|
||||
else if (version.equalsIgnoreCase(id.version)) {
|
||||
updateName(name, id.name);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
if (version == null || version.trim().equalsIgnoreCase("")) {
|
||||
return "Module [" + name + "] in " + packageId;
|
||||
}
|
||||
else {
|
||||
return "Module [" + name + " " + version + "] in " + packageId;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPackage(PackageIdentification packageId) {
|
||||
this.packageId = packageId;
|
||||
}
|
||||
|
||||
public PackageIdentification getPackage() {
|
||||
return packageId;
|
||||
}
|
||||
|
||||
public String getModuleType() {
|
||||
return moduleType;
|
||||
}
|
||||
|
||||
public void setModuleType(String moduleType) {
|
||||
this.moduleType = moduleType;
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package org.tianocore.frameworkwizard.platform.ui.id;
|
||||
import java.io.File;
|
||||
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
|
||||
|
||||
public class PackageIdentification extends Identification{
|
||||
|
||||
//
|
||||
// It is optional
|
||||
//
|
||||
private File spdFile;
|
||||
|
||||
public PackageIdentification(String name, String guid, String version){
|
||||
super(name, guid, version);
|
||||
}
|
||||
|
||||
public PackageIdentification(String name, String guid, String version, String spdFilename){
|
||||
super(name, guid, version);
|
||||
this.spdFile = new File(spdFilename);
|
||||
}
|
||||
|
||||
public PackageIdentification(String name, String guid, String version, File spdFile){
|
||||
super(name, guid, version);
|
||||
this.spdFile = spdFile;
|
||||
}
|
||||
|
||||
public void setSpdFile(File spdFile) {
|
||||
this.spdFile = spdFile;
|
||||
}
|
||||
|
||||
public File getSpdFile() {
|
||||
return spdFile;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
if (version == null || version.trim().equalsIgnoreCase("")) {
|
||||
return "package [" + name + "]";
|
||||
}
|
||||
else {
|
||||
return "package [" + name + " " + version + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public String getPackageDir()throws Exception{
|
||||
prepareSpdFile();
|
||||
return spdFile.getParent();
|
||||
}
|
||||
|
||||
public String getPackageRelativeDir()throws Exception{
|
||||
prepareSpdFile();
|
||||
return spdFile.getParent().substring(WorkspaceProfile.getWorkspacePath().length() + 1);
|
||||
}
|
||||
|
||||
private void prepareSpdFile() throws Exception{
|
||||
if (spdFile == null) {
|
||||
spdFile = WorkspaceProfile.getPackageFile(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package org.tianocore.frameworkwizard.platform.ui.id;
|
||||
import java.io.File;
|
||||
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
|
||||
|
||||
public class PlatformIdentification extends Identification{
|
||||
|
||||
private File fpdFile;
|
||||
|
||||
public PlatformIdentification(String name, String guid, String version){
|
||||
super(name, guid, version);
|
||||
}
|
||||
|
||||
public PlatformIdentification(String name, String guid, String version, String fpdFilename){
|
||||
super(name, guid, version);
|
||||
this.fpdFile = new File(fpdFilename);
|
||||
}
|
||||
|
||||
public PlatformIdentification(String name, String guid, String version, File fpdFile){
|
||||
super(name, guid, version);
|
||||
this.fpdFile = fpdFile;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "Platform " + name + "["+guid+"]";
|
||||
}
|
||||
|
||||
public void setFpdFile(File fpdFile) {
|
||||
this.fpdFile = fpdFile;
|
||||
}
|
||||
|
||||
public File getFpdFile() {
|
||||
return fpdFile;
|
||||
}
|
||||
|
||||
public String getPlatformRelativeDir(){
|
||||
return fpdFile.getParent().substring(WorkspaceProfile.getWorkspacePath().length());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue