summaryrefslogtreecommitdiff
path: root/Tools/Source
diff options
context:
space:
mode:
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-27 07:40:21 +0000
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-27 07:40:21 +0000
commit82dcbb45c7c50421d0875b269044666a64585930 (patch)
treedd8354b053420d464215a730f44fe41269509cee /Tools/Source
parent0543618356ae1d39dc168b65be407769db03c595 (diff)
downloadedk2-platforms-82dcbb45c7c50421d0875b269044666a64585930.tar.xz
Fix EDKT143.
Add the feature of inserting Xml Comments before ModuleSA elements and library instance elements. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1115 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source')
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java84
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java7
2 files changed, 73 insertions, 18 deletions
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
index 6e7c79f658..fa0924a7a4 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
@@ -286,6 +286,13 @@ public class FpdFileContents {
maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleInfo);
}
}
+
+ cursor.push();
+ cursor.toPrevToken();
+ if (cursor.isComment()) {
+ cursor.removeXml();
+ }
+ cursor.pop();
cursor.removeXml();
if (getFrameworkModulesCount() == 0) {
cursor.toParent();
@@ -448,25 +455,31 @@ public class FpdFileContents {
while(li.hasNext()) {
PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();
ModuleSADocument.ModuleSA moduleSA = getModuleSA(moduleKey);
- XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();
- if (cursor.toFirstChild()) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();
- if (msaPcd.getCName().equals(pcdData.getCName()) && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {
-
- maintainDynPcdMap(pcdData.getCName()+" "+pcdData.getTokenSpaceGuidCName(), moduleKey);
- cursor.removeXml();
- break;
- }
- while (cursor.toNextSibling()) {
- pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();
- if (msaPcd.getCName().equals(pcdData.getCName()) && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {
- maintainDynPcdMap(pcdData.getCName()+" "+pcdData.getTokenSpaceGuidCName(), moduleKey);
+ if (moduleSA.getPcdBuildDefinition() != null) {
+ XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();
+ if (cursor.toFirstChild()) {
+ PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor
+ .getObject();
+ if (msaPcd.getCName().equals(pcdData.getCName())
+ && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {
+
+ maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleKey);
cursor.removeXml();
break;
}
+ while (cursor.toNextSibling()) {
+ pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor.getObject();
+ if (msaPcd.getCName().equals(pcdData.getCName())
+ && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {
+ maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(),
+ moduleKey);
+ cursor.removeXml();
+ break;
+ }
+ }
}
+ cursor.dispose();
}
- cursor.dispose();
}
}
@@ -513,13 +526,23 @@ public class FpdFileContents {
for (int j = 0; j < i; ++j) {
cursor.toNextSibling();
}
+ cursor.push();
+ cursor.toPrevToken();
+ if (cursor.isComment()) {
+ cursor.removeXml();
+ }
+ cursor.pop();
cursor.removeXml();
+ if (getLibraryInstancesCount(key) == 0) {
+ cursor.toParent();
+ cursor.removeXml();
+ }
}
cursor.dispose();
}
- public void genLibraryInstance(String mg, String mv, String pg, String pv, String key) {
+ public void genLibraryInstance(ModuleIdentification libMi, String key) {
ModuleSADocument.ModuleSA msa = getModuleSA(key);
if (msa == null){
msa = getfpdFrameworkModules().addNewModuleSA();
@@ -529,7 +552,26 @@ public class FpdFileContents {
libs = msa.addNewLibraries();
}
+ 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();
LibrariesDocument.Libraries.Instance instance = libs.addNewInstance();
+ XmlCursor cursor = instance.newCursor();
+ try{
+ String comment = "Pkg: " + pn + " Mod: " + mn
+ + " Path: " + GlobalData.getMsaFile(libMi).getPath();
+ cursor.insertComment(comment);
+ }
+ catch (Exception e){
+ e.printStackTrace();
+ }
+ finally {
+ cursor.dispose();
+ }
+
instance.setModuleGuid(mg);
instance.setModuleVersion(mv);
instance.setPackageGuid(pg);
@@ -776,6 +818,18 @@ public class FpdFileContents {
private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {
PackageIdentification pi = GlobalData.getPackageForModule(mi);
ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();
+ XmlCursor cursor = msa.newCursor();
+ try{
+ String comment = "Mod: " + mi.getName() + " Type: " + mi.getModuleType() + " Path: "
+ + GlobalData.getMsaFile(mi).getPath();
+ cursor.insertComment(comment);
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ }
+ finally {
+ cursor.dispose();
+ }
msa.setModuleGuid(mi.getGuid());
msa.setModuleVersion(mi.getVersion());
msa.setPackageGuid(pi.getGuid());
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
index d90d0798ce..5164c0f6c9 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
@@ -328,7 +328,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
//
// remove pcd information of instance from current ModuleSA
//
- ffc.removePcdData(key, mi);
+ ffc.removePcdData(moduleKey, mi);
//
// remove class produced by this instance and add back these produced class to be bound.
//
@@ -1018,12 +1018,13 @@ public class FpdModuleSA extends JDialog implements ActionListener {
model3.getValueAt(row, 2) + " " +
model3.getValueAt(row, 3) + " " +
model3.getValueAt(row, 4);
- ffc.genLibraryInstance(model3.getValueAt(row, 1)+"", model3.getValueAt(row, 2)+"", model3.getValueAt(row, 3)+"", model3.getValueAt(row, 4)+"", moduleKey);
+ ModuleIdentification libMi = getModuleId(instanceValue);
+ ffc.genLibraryInstance(libMi, moduleKey);
//
// Add pcd information of selected instance to current moduleSA
//
try{
- ffc.addFrameworkModulesPcdBuildDefs(getModuleId(instanceValue), null, ffc.getModuleSA(moduleKey));
+ ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey));
}
catch (Exception exception) {
JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage());