Fix EDKT191.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1301 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2006-08-17 03:11:55 +00:00
parent 739c6b04fd
commit daa4663bdd
5 changed files with 64 additions and 66 deletions

View File

@ -934,9 +934,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
ModuleIdentification mi = (ModuleIdentification) ismi.next(); ModuleIdentification mi = (ModuleIdentification) ismi.next();
Map<String, XmlObject> m = GlobalData.getNativeMsa(mi); Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);
SurfaceAreaQuery.setDoc(m); SurfaceAreaQuery.setDoc(m);
String[] classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED"); Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
for (int i = 0; i < classProduced.length; ++i) { for (int i = 0; i < classProduced.size(); ++i) {
if (classProduced[i].equals(libClass)) { if (classProduced.get(i).equals(libClass)) {
libNameGuidMap.put(mi.getName(), mi.getGuid()); libNameGuidMap.put(mi.getName(), mi.getGuid());
} }
} }

View File

@ -379,7 +379,7 @@ public class FpdFileContents {
Map<String, XmlObject> m = new HashMap<String, XmlObject>(); Map<String, XmlObject> m = new HashMap<String, XmlObject>();
m.put("ModuleSurfaceArea", msa); m.put("ModuleSurfaceArea", msa);
SurfaceAreaQuery.setDoc(m); SurfaceAreaQuery.setDoc(m);
PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null); PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, vMi.get(i));
PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs); PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
if (spdPcd == null) { if (spdPcd == null) {
// //
@ -541,7 +541,7 @@ public class FpdFileContents {
Map<String, XmlObject> m = new HashMap<String, XmlObject>(); Map<String, XmlObject> m = new HashMap<String, XmlObject>();
m.put("ModuleSurfaceArea", msa); m.put("ModuleSurfaceArea", msa);
SurfaceAreaQuery.setDoc(m); SurfaceAreaQuery.setDoc(m);
PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null); PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);
// //
// First look through MSA pcd entries. // First look through MSA pcd entries.
// //
@ -896,7 +896,7 @@ public class FpdFileContents {
Map<String, XmlObject> m = new HashMap<String, XmlObject>(); Map<String, XmlObject> m = new HashMap<String, XmlObject>();
m.put("ModuleSurfaceArea", msa); m.put("ModuleSurfaceArea", msa);
SurfaceAreaQuery.setDoc(m); SurfaceAreaQuery.setDoc(m);
PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null); PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);
// //
// Implementing InitializePlatformPcdBuildDefinitions // Implementing InitializePlatformPcdBuildDefinitions
// //

View File

@ -579,6 +579,7 @@ public class FpdFrameworkModules extends IInternalFrame {
if (selectedRow < 0) { if (selectedRow < 0) {
return; return;
} }
docConsole.setSaved(false);
TableSorter sorter = (TableSorter) jTableFpdModules.getModel(); TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
selectedRow = sorter.modelIndex(selectedRow); selectedRow = sorter.modelIndex(selectedRow);
@ -606,7 +607,6 @@ public class FpdFrameworkModules extends IInternalFrame {
} }
} }
docConsole.setSaved(false);
ffc.removeModuleSA(selectedRow); ffc.removeModuleSA(selectedRow);
} }
}); });

View File

@ -23,7 +23,6 @@ import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableModel; import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel; import javax.swing.table.TableModel;
import org.apache.xmlbeans.XmlObject;
import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
import org.tianocore.frameworkwizard.platform.ui.global.GlobalData; import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;
@ -38,7 +37,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.Vector; import java.util.Vector;
@ -226,37 +224,35 @@ public class FpdModuleSA extends JDialog implements ActionListener {
ModuleIdentification mi = GlobalData.getModuleId(key); ModuleIdentification mi = GlobalData.getModuleId(key);
PackageIdentification[] depPkgList = null; PackageIdentification[] depPkgList = null;
try{ try{
Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);
SurfaceAreaQuery.setDoc(m);
// //
// Get dependency pkg list into which we will search lib instances. // Get dependency pkg list into which we will search lib instances.
// //
depPkgList = SurfaceAreaQuery.getDependencePkg(null); depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
// //
// Get the lib class consumed, produced by this module itself. // Get the lib class consumed, produced by this module itself.
// //
String[] classConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED"); Vector<String> vClassConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
if (this.classConsumed == null) { if (this.classConsumed == null) {
this.classConsumed = new HashMap<String, ArrayList<String>>(); this.classConsumed = new HashMap<String, ArrayList<String>>();
} }
for(int i = 0; i < classConsumed.length; ++i){ for(int i = 0; i < vClassConsumed.size(); ++i){
ArrayList<String> consumedBy = this.classConsumed.get(classConsumed[i]); ArrayList<String> consumedBy = this.classConsumed.get(vClassConsumed.get(i));
if (consumedBy == null) { if (consumedBy == null) {
consumedBy = new ArrayList<String>(); consumedBy = new ArrayList<String>();
} }
consumedBy.add(key); consumedBy.add(key);
this.classConsumed.put(classConsumed[i], consumedBy); this.classConsumed.put(vClassConsumed.get(i), consumedBy);
} }
String[] classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED"); Vector<String> vClassProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
if (this.classProduced == null) { if (this.classProduced == null) {
this.classProduced = new ArrayList<String>(); this.classProduced = new ArrayList<String>();
} }
for(int i = 0; i < classProduced.length; ++i){ for(int i = 0; i < vClassProduced.size(); ++i){
if (!this.classProduced.contains(classProduced[i])){ if (!this.classProduced.contains(vClassProduced.get(i))){
this.classProduced.add(classProduced[i]); this.classProduced.add(vClassProduced.get(i));
} }
} }
@ -362,10 +358,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
private String[] getClassProduced(ModuleIdentification mi){ private String[] getClassProduced(ModuleIdentification mi){
try{ try{
Map<String, XmlObject> m = GlobalData.getNativeMsa(mi); Vector<String> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
SurfaceAreaQuery.setDoc(m); String[] sClassProduced = new String[clsProduced.size()];
String[] clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED"); for (int i = 0; i < clsProduced.size(); ++i) {
return clsProduced; sClassProduced[i] = clsProduced.get(i);
}
return sClassProduced;
}catch (Exception e) { }catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -376,16 +374,17 @@ public class FpdModuleSA extends JDialog implements ActionListener {
private String[] getClassConsumed(ModuleIdentification mi){ private String[] getClassConsumed(ModuleIdentification mi){
String[] clsConsumed = null;
try{ try{
Map<String, XmlObject> m = GlobalData.getNativeMsa(mi); Vector<String> clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
SurfaceAreaQuery.setDoc(m); String[] sClassConsumed = new String[clsConsumed.size()];
clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED"); for (int i = 0; i < clsConsumed.size(); ++i) {
sClassConsumed[i] = clsConsumed.get(i);
}
return sClassConsumed;
}catch (Exception e) { }catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return clsConsumed; return new String[0];
} }
private void showClassToResolved(){ private void showClassToResolved(){
@ -397,12 +396,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
while(li.hasNext()){ while(li.hasNext()){
String[] s = {li.next()}; String[] s = {li.next()};
if (classConsumed.get(s[0]) == null) { // if (classConsumed.get(s[0]) == null) {
continue; // continue;
} // }
if (classConsumed.get(s[0]).size() == 0) { // if (classConsumed.get(s[0]).size() == 0) {
continue; // continue;
} // }
if (!classProduced.contains(s[0])){ if (!classProduced.contains(s[0])){
libClassTableModel.addRow(s); libClassTableModel.addRow(s);
} }

View File

@ -21,6 +21,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.Stack; import java.util.Stack;
import java.util.Vector;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -37,6 +38,7 @@ import org.tianocore.LibrariesDocument;
import org.tianocore.LibraryClassDeclarationsDocument; import org.tianocore.LibraryClassDeclarationsDocument;
import org.tianocore.LibraryClassDocument; import org.tianocore.LibraryClassDocument;
import org.tianocore.ModuleSADocument; import org.tianocore.ModuleSADocument;
import org.tianocore.ModuleSurfaceAreaDocument;
import org.tianocore.ModuleTypeDef; import org.tianocore.ModuleTypeDef;
import org.tianocore.MsaFilesDocument; import org.tianocore.MsaFilesDocument;
import org.tianocore.MsaHeaderDocument; import org.tianocore.MsaHeaderDocument;
@ -341,22 +343,22 @@ public class SurfaceAreaQuery {
* @returns package name list if elements are found at the known xpath * @returns package name list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static PackageIdentification[] getDependencePkg(String arch) {
String[] xPath; public static PackageIdentification[] getDependencePkg(String arch, ModuleIdentification mi) throws Exception{
String packageGuid = null; String packageGuid = null;
String packageVersion = null; String packageVersion = null;
if (arch == null || arch.equals("")) { ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) GlobalData.getModuleXmlObject(mi);
xPath = new String[] { "/PackageDependencies/Package" }; if (msa.getPackageDependencies() == null) {
} else {
xPath = new String[] { "/PackageDependencies/Package[not(@SupArchList) or @SupArchList='"
+ arch + "']" };
}
XmlObject[] returns = get("ModuleSurfaceArea", xPath);
if (returns == null) {
return new PackageIdentification[0]; return new PackageIdentification[0];
} }
int size = msa.getPackageDependencies().getPackageList().size();
XmlObject[] returns = new XmlObject[size];
for (int i = 0; i < size; ++i) {
returns[i] = msa.getPackageDependencies().getPackageList().get(i);
}
PackageIdentification[] packageIdList = new PackageIdentification[returns.length]; PackageIdentification[] packageIdList = new PackageIdentification[returns.length];
for (int i = 0; i < returns.length; i++) { for (int i = 0; i < returns.length; i++) {
PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i]; PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];
@ -401,25 +403,22 @@ public class SurfaceAreaQuery {
* xpath * xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getLibraryClasses(String usage) { public static Vector<String> getLibraryClasses(String usage, ModuleIdentification mi) throws Exception{
String[] xPath; ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);
Vector<String> libraryClassName = new Vector<String>();
if (usage == null || usage.equals("")) { if (msa.getLibraryClassDefinitions() == null) {
xPath = new String[] { "/LibraryClass" }; return libraryClassName;
} else {
xPath = new String[] { "/LibraryClass[@Usage='" + usage + "']" };
} }
XmlObject[] returns = get("LibraryClassDefinitions", xPath); int size = msa.getLibraryClassDefinitions().getLibraryClassList().size();
if (returns == null || returns.length == 0) {
return new String[0]; for (int i = 0; i < size; i++) {
LibraryClassDocument.LibraryClass libClass = msa.getLibraryClassDefinitions().getLibraryClassList().get(i);
if (usage.equals(libClass.getUsage().toString())) {
libraryClassName.add(libClass.getKeyword());
}
} }
LibraryClassDocument.LibraryClass[] libraryClassList = (LibraryClassDocument.LibraryClass[]) returns;
String[] libraryClassName = new String[libraryClassList.length];
for (int i = 0; i < libraryClassList.length; i++) {
libraryClassName[i] = libraryClassList[i].getKeyword();
}
return libraryClassName; return libraryClassName;
} }