For one library class, list all library instances from all packages in workspace.

Fix the PCD memory database inconsistency problem when changing PCD item type in platform.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1531 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16
2006-09-13 14:51:47 +00:00
parent 10e4f9901c
commit 73d9b1c494
2 changed files with 39 additions and 38 deletions

View File

@ -91,6 +91,11 @@ public class FpdFileContents {
private HashMap<String, String> defaultPcdValue = new HashMap<String, String>(); private HashMap<String, String> defaultPcdValue = new HashMap<String, String>();
private String itemType (String pcdInfo) {
return pcdInfo.substring(pcdInfo.lastIndexOf(" ") + 1);
}
/** /**
* look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings. * look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings.
*/ */
@ -557,6 +562,9 @@ public class FpdFileContents {
do { do {
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject(); PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();
if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) { if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {
//
// change item type while not updating dynPcdData????
//
pcdData.setItemType(PcdItemTypes.Enum.forString(itemType)); pcdData.setItemType(PcdItemTypes.Enum.forString(itemType));
if(pcdData.getDatumType().equals("VOID*")) { if(pcdData.getDatumType().equals("VOID*")) {
pcdData.setMaxDatumSize(new Integer(maxSize)); pcdData.setMaxDatumSize(new Integer(maxSize));
@ -1193,8 +1201,8 @@ public class FpdFileContents {
// Using existing Pcd type, if this pcd already exists in other ModuleSA // Using existing Pcd type, if this pcd already exists in other ModuleSA
// //
if (pcdConsumer.size() > 0) { if (pcdConsumer.size() > 0) {
String[] valPart = pcdConsumer.get(0).split(" ");
itemType = valPart[5]; itemType = itemType (pcdConsumer.get(0));
} }
String listValue = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() String listValue = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion()
+ " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList()) + " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList())

View File

@ -297,13 +297,13 @@ public class FpdModuleSA extends JDialog implements ActionListener {
private ArrayList<String> getInstancesForClass(String cls, PackageIdentification[] depPkgList) throws Exception{ private ArrayList<String> getInstancesForClass(String cls, PackageIdentification[] depPkgList) throws Exception{
ArrayList<String> al = new ArrayList<String>(); ArrayList<String> al = new ArrayList<String>();
for (int i = 0; i < depPkgList.length; ++i) { // for (int i = 0; i < depPkgList.length; ++i) {
Iterator ismi = GlobalData.vModuleList.iterator(); Iterator ismi = GlobalData.vModuleList.iterator();
while(ismi.hasNext()) { while(ismi.hasNext()) {
ModuleIdentification mi = (ModuleIdentification)ismi.next(); ModuleIdentification mi = (ModuleIdentification)ismi.next();
if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) { // if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
continue; // continue;
} // }
String[] clsProduced = getClassProduced(mi); String[] clsProduced = getClassProduced(mi);
boolean isPotential = false; boolean isPotential = false;
@ -321,10 +321,10 @@ public class FpdModuleSA extends JDialog implements ActionListener {
} }
if (isPotential) { if (isPotential) {
al.add(mi.getGuid() + " " + mi.getVersion() + " " + al.add(mi.getGuid() + " " + mi.getVersion() + " " +
depPkgList[i].getGuid() + " " + depPkgList[i].getVersion()); mi.getPackageId().getGuid() + " " + mi.getPackageId().getVersion());
} }
} }
} // }
return al; return al;
} }
@ -570,13 +570,14 @@ public class FpdModuleSA extends JDialog implements ActionListener {
} }
else{ else{
int selectedRow = lsm.getMinSelectionIndex(); int selectedRow = lsm.getMinSelectionIndex();
String cName = jTablePcd.getValueAt(selectedRow, 0)+""; String cName = model.getValueAt(selectedRow, 0)+"";
String tsGuid = jTablePcd.getValueAt(selectedRow, 1)+""; String tsGuid = model.getValueAt(selectedRow, 1)+"";
String itemType = model.getValueAt(selectedRow, 2)+"";
String[] pcdInfo = {"", ""}; String[] pcdInfo = {"", ""};
getPcdInfo(cName, tsGuid, pcdInfo); getPcdInfo(cName, tsGuid, pcdInfo);
jTextAreaPcdHelp.setText(pcdInfo[0]); jTextAreaPcdHelp.setText(pcdInfo[0]);
initComboBox(pcdInfo[1]); initComboBox(pcdInfo[1]);
jComboBoxItemType.setSelectedItem(pcdInfo[1]); jComboBoxItemType.setSelectedItem(itemType);
jTextFieldMaxDatumSize.setEnabled(true); jTextFieldMaxDatumSize.setEnabled(true);
jTextFieldMaxDatumSize.setVisible(true); jTextFieldMaxDatumSize.setVisible(true);
jTextFieldMaxDatumSize.setText(jTablePcd.getValueAt(selectedRow, 4)+""); jTextFieldMaxDatumSize.setText(jTablePcd.getValueAt(selectedRow, 4)+"");
@ -603,9 +604,9 @@ public class FpdModuleSA extends JDialog implements ActionListener {
jTextFieldMaxDatumSize.setEnabled(false); jTextFieldMaxDatumSize.setEnabled(false);
} }
if (!jTablePcd.getValueAt(selectedRow, 2).equals("DYNAMIC") && !jTablePcd.getValueAt(selectedRow, 2).equals("DYNAMIC_EX")) { if (!model.getValueAt(selectedRow, 2).equals("DYNAMIC") && !model.getValueAt(selectedRow, 2).equals("DYNAMIC_EX")) {
jTextFieldPcdDefault.setText(jTablePcd.getValueAt(selectedRow, 6)+""); jTextFieldPcdDefault.setText(model.getValueAt(selectedRow, 6)+"");
if (jTablePcd.getValueAt(selectedRow, 2).equals("FEATURE_FLAG")){ if (model.getValueAt(selectedRow, 2).equals("FEATURE_FLAG")){
jTextFieldPcdDefault.setVisible(false); jTextFieldPcdDefault.setVisible(false);
jComboBoxFeatureFlagValue.setVisible(true); jComboBoxFeatureFlagValue.setVisible(true);
jComboBoxFeatureFlagValue.setSelectedItem(jTablePcd.getValueAt(selectedRow, 6)+""); jComboBoxFeatureFlagValue.setSelectedItem(jTablePcd.getValueAt(selectedRow, 6)+"");
@ -625,18 +626,6 @@ public class FpdModuleSA extends JDialog implements ActionListener {
} }
}); });
jTablePcd.getModel().addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent arg0) {
// TODO Auto-generated method stub
// int row = arg0.getFirstRow();
// TableModel m = (TableModel)arg0.getSource();
if (arg0.getType() == TableModelEvent.UPDATE){
//update xml doc here.
}
}
});
} }
return jTablePcd; return jTablePcd;
} }
@ -1424,6 +1413,7 @@ private JPanel getJPanelPcdFieldsThirdRow() {
jPanelPcdFieldsThirdRow.add(jLabelPcdDefaultValue, null); jPanelPcdFieldsThirdRow.add(jLabelPcdDefaultValue, null);
jPanelPcdFieldsThirdRow.add(getJTextFieldPcdDefault(), null); jPanelPcdFieldsThirdRow.add(getJTextFieldPcdDefault(), null);
jPanelPcdFieldsThirdRow.add(getJComboBoxFeatureFlagValue(), null); jPanelPcdFieldsThirdRow.add(getJComboBoxFeatureFlagValue(), null);
jPanelPcdFieldsThirdRow.add(getJButtonUpdatePcd(), null);
} }
return jPanelPcdFieldsThirdRow; return jPanelPcdFieldsThirdRow;
} }
@ -1443,7 +1433,6 @@ private JPanel getJPanelPcdFieldsFirstRow() {
jPanelPcdFieldsFirstRow.setLayout(flowLayout1); jPanelPcdFieldsFirstRow.setLayout(flowLayout1);
jPanelPcdFieldsFirstRow.add(jLabelItemType, null); jPanelPcdFieldsFirstRow.add(jLabelItemType, null);
jPanelPcdFieldsFirstRow.add(getJComboBoxItemType(), null); jPanelPcdFieldsFirstRow.add(getJComboBoxItemType(), null);
jPanelPcdFieldsFirstRow.add(getJButtonUpdatePcd(), null);
} }
return jPanelPcdFieldsFirstRow; return jPanelPcdFieldsFirstRow;
} }
@ -1459,19 +1448,19 @@ private JComboBox getJComboBoxItemType() {
jComboBoxItemType.addItemListener(new java.awt.event.ItemListener() { jComboBoxItemType.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) { public void itemStateChanged(java.awt.event.ItemEvent e) {
int row = jTablePcd.getSelectedRow(); int row = jTablePcd.getSelectedRow();
if (row < 0 || jTablePcd.getValueAt(row, 2).equals(jComboBoxItemType.getSelectedItem())) { if (row < 0 || model.getValueAt(row, 2).equals(jComboBoxItemType.getSelectedItem())) {
return; return;
} }
if (jComboBoxItemType.getItemCount() == 3) { if (jComboBoxItemType.getItemCount() == 3) {
if (!jComboBoxItemType.getSelectedItem().equals("DYNAMIC")) { if (!jComboBoxItemType.getSelectedItem().equals("DYNAMIC")) {
pcdDynamicToNonDynamic(jTablePcd.getValueAt(row, 0)+"", jTablePcd.getValueAt(row, 1)+""); pcdDynamicToNonDynamic(model.getValueAt(row, 0)+"", model.getValueAt(row, 1)+"");
if (jComboBoxItemType.getSelectedItem().equals("FIXED_AT_BUILD")) { if (jComboBoxItemType.getSelectedItem().equals("FIXED_AT_BUILD")) {
jTextFieldPcdDefault.setText(""); jTextFieldPcdDefault.setText("");
jTextFieldPcdDefault.setEnabled(true); jTextFieldPcdDefault.setEnabled(true);
} }
} }
else{ else{
pcdNonDynamicToDynamic(jTablePcd.getValueAt(row, 0)+"", jTablePcd.getValueAt(row, 1)+""); pcdNonDynamicToDynamic(model.getValueAt(row, 0)+"", model.getValueAt(row, 1)+"");
} }
} }
} }
@ -1495,11 +1484,10 @@ private void pcdDynamicToNonDynamic(String cName, String tsGuid) {
ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid); ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
for (int i = 0; i < al.size(); ++i) { for (int i = 0; i < al.size(); ++i) {
String[] s = al.get(i).split(" "); String mKey = moduleInfo (al.get(i));
String mKey = s[0] + s[1] + s[2] + s[3];
ffc.updatePcdData(mKey, cName, tsGuid, jComboBoxItemType.getSelectedItem()+"", maxSize, value); ffc.updatePcdData(mKey, cName, tsGuid, jComboBoxItemType.getSelectedItem()+"", maxSize, value);
s[4] = jComboBoxItemType.getSelectedItem()+""; String itemType = jComboBoxItemType.getSelectedItem()+"";
al.set(i, s[0]+" "+s[1]+" "+s[2]+" "+s[3]+" "+s[4]); al.set(i, mKey + " " + itemType);
} }
ffc.removeDynamicPcdBuildData(cName, tsGuid); ffc.removeDynamicPcdBuildData(cName, tsGuid);
@ -1508,11 +1496,10 @@ private void pcdDynamicToNonDynamic(String cName, String tsGuid) {
private void pcdNonDynamicToDynamic(String cName, String tsGuid) { private void pcdNonDynamicToDynamic(String cName, String tsGuid) {
ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid); ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
for (int i = 0; i < al.size(); ++i) { for (int i = 0; i < al.size(); ++i) {
String[] s = al.get(i).split(" "); String mKey = moduleInfo (al.get(i));
String mKey = s[0] + " " + s[1]+ " " + s[2] + " " + s[3];
ffc.updatePcdData(mKey, cName, tsGuid, jComboBoxItemType.getSelectedItem()+"", jTextFieldMaxDatumSize.getText(), jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+""); ffc.updatePcdData(mKey, cName, tsGuid, jComboBoxItemType.getSelectedItem()+"", jTextFieldMaxDatumSize.getText(), jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");
s[4] = jComboBoxItemType.getSelectedItem()+""; String itemType = jComboBoxItemType.getSelectedItem()+"";
al.set(i, s[0]+" "+s[1]+" "+s[2]+" "+s[3]+" "+s[4]); al.set(i, mKey + " " + itemType);
} }
try{ try{
ffc.addDynamicPcdBuildData(cName, jTablePcd.getValueAt(jTablePcd.getSelectedRow(), 3), tsGuid, "DYNAMIC", jTablePcd.getValueAt(jTablePcd.getSelectedRow(), 5)+"", jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+""); ffc.addDynamicPcdBuildData(cName, jTablePcd.getValueAt(jTablePcd.getSelectedRow(), 3), tsGuid, "DYNAMIC", jTablePcd.getValueAt(jTablePcd.getSelectedRow(), 5)+"", jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");
@ -1521,6 +1508,12 @@ private void pcdNonDynamicToDynamic(String cName, String tsGuid) {
JOptionPane.showMessageDialog(frame, "PCD value format: " + e.getMessage()); JOptionPane.showMessageDialog(frame, "PCD value format: " + e.getMessage());
} }
} }
private String moduleInfo (String pcdInfo) {
return pcdInfo.substring(0, pcdInfo.lastIndexOf(" "));
}
/** /**
* This method initializes jTextFieldMaxDatumSize * This method initializes jTextFieldMaxDatumSize
* *