From 055e7ae674d038d79c2eb2b36bef44d37ed5c4c9 Mon Sep 17 00:00:00 2001 From: jlin16 Date: Fri, 14 Jul 2006 09:19:24 +0000 Subject: [PATCH] Fix bug of missing Pcd information in FPD ModuleSA. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1010 6f19259b-4bc3-4df7-8a09-765794883524 --- .../platform/ui/FpdFileContents.java | 51 ++++++++++++++----- .../platform/ui/FpdFrameworkModules.java | 4 +- .../platform/ui/FpdModuleSA.java | 16 +++--- 3 files changed, 49 insertions(+), 22 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 8805bad904..4783a74a25 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 @@ -287,29 +287,56 @@ public class FpdFileContents { // // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer" // - public int getPcdDataCount(String key){ - ModuleSADocument.ModuleSA msa = getModuleSA(key); + public int getPcdDataCount(int i){ + if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) { + return 0; + } + + XmlCursor cursor = getfpdFrameworkModules().newCursor(); + ModuleSADocument.ModuleSA msa = null; + if (cursor.toFirstChild()) { + for (int j = 0; j < i; ++j) { + cursor.toNextSibling(); + } + msa = (ModuleSADocument.ModuleSA)cursor.getObject(); + } + cursor.dispose(); + if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){ return 0; } return msa.getPcdBuildDefinition().getPcdDataList().size(); + } - public void getPcdData(String key, String[][] saa) { - ModuleSADocument.ModuleSA msa = getModuleSA(key); + public void getPcdData(int i, String[][] saa) { + if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) { + return; + } + + XmlCursor cursor = getfpdFrameworkModules().newCursor(); + ModuleSADocument.ModuleSA msa = null; + if (cursor.toFirstChild()) { + for (int j = 0; j < i; ++j) { + cursor.toNextSibling(); + } + msa = (ModuleSADocument.ModuleSA)cursor.getObject(); + } + cursor.dispose(); + if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){ return; } ListIteratorli = msa.getPcdBuildDefinition().getPcdDataList().listIterator(); - for (int i = 0; i < saa.length; ++i) { + for (int k = 0; k < saa.length; ++k) { PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next(); - saa[i][0] = pcdData.getCName(); - saa[i][1] = pcdData.getTokenSpaceGuidCName(); - saa[i][2] = pcdData.getItemType()+""; - saa[i][3] = pcdData.getToken().toString(); - saa[i][4] = pcdData.getMaxDatumSize()+""; - saa[i][5] = pcdData.getDatumType()+""; - saa[i][6] = pcdData.getValue(); + saa[k][0] = pcdData.getCName(); + saa[k][1] = pcdData.getTokenSpaceGuidCName(); + saa[k][2] = pcdData.getItemType()+""; + saa[k][3] = pcdData.getToken().toString(); + saa[k][4] = pcdData.getMaxDatumSize()+""; + saa[k][5] = pcdData.getDatumType()+""; + saa[k][6] = pcdData.getValue(); } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index c6af497638..27faa3644f 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -202,7 +202,7 @@ public class FpdFrameworkModules extends IInternalFrame { docConsole.setSaved(false); try{ - ffc.addFrameworkModulesPcdBuildDefs(miList.get(selectedRow), null); + ffc.addFrameworkModulesPcdBuildDefs(mi, null); } catch (Exception exception) { JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage()); @@ -292,7 +292,7 @@ public class FpdFrameworkModules extends IInternalFrame { String mv = model1.getValueAt(selectedRow, 2)+""; String pg = model1.getValueAt(selectedRow, 3)+""; String pv = model1.getValueAt(selectedRow, 4)+""; - settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv); + settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv, selectedRow); settingDlg.setVisible(true); } }); 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 4857311522..7fd914adcc 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 @@ -129,27 +129,27 @@ public class FpdModuleSA extends JDialog implements ActionListener { this.ffc = ffc; } - public void setKey(String k){ + public void setKey(String k, int i){ this.moduleKey = k; jTabbedPane.setSelectedIndex(0); - initPcdBuildDefinition(k); + initPcdBuildDefinition(i); } /** init will be called each time FpdModuleSA object is to be shown. @param key Module information. **/ - public void initPcdBuildDefinition(String key) { + public void initPcdBuildDefinition(int i) { // // display pcd for key. // model.setRowCount(0); - int pcdCount = ffc.getPcdDataCount(key); + int pcdCount = ffc.getPcdDataCount(i); if (pcdCount != 0) { String[][] saa = new String[pcdCount][7]; - ffc.getPcdData(key, saa); - for (int i = 0; i < saa.length; ++i) { - model.addRow(saa[i]); + ffc.getPcdData(i, saa); + for (int j = 0; j < saa.length; ++j) { + model.addRow(saa[j]); } } } @@ -483,7 +483,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { jPanel.add(getJPanel2(), java.awt.BorderLayout.SOUTH); jPanel.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentShown(java.awt.event.ComponentEvent e) { - initPcdBuildDefinition(moduleKey); +// initPcdBuildDefinition(moduleKey); } }); -- 2.39.2