]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java
1. Fix EDKT323 (Only dependent packages' ppis can be added to module's ppi section)
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / ui / dialog / PCDsDlg.java
index 81a4dfe3daa3a96b5ccbb01375f80f9368cc6687..58b983dad7c64f12ece2b82168bcb5f1515d0f24 100644 (file)
@@ -36,8 +36,10 @@ import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
 import org.tianocore.frameworkwizard.common.ui.IDialog;\r
 import org.tianocore.frameworkwizard.common.ui.IFrame;\r
 import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
 import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
 \r
 /**\r
@@ -307,9 +309,19 @@ public class PCDsDlg extends IDialog implements ItemListener {
      * @param inPcdCodedId\r
      * \r
      */\r
-    private void init(PcdCodedIdentification inPcdCodedId) {\r
+    private void init(PcdCodedIdentification inPcdCodedId, ModuleIdentification mid) {\r
         init();\r
         this.id = inPcdCodedId;\r
+        \r
+        Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);\r
+        if (vpid.size() <= 0) {\r
+            Log.wrn("Init Pcd", "This module hasn't defined any package dependency, so there is no pcd can be added");\r
+        }\r
+\r
+        pcd = wt.getAllPcdDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid));\r
+        for (int index = 0; index < pcd.size(); index++) {\r
+            jComboBoxCName.addItem(pcd.getPcd(index));\r
+        }\r
 \r
         if (this.id != null) {\r
             for (int index = 0; index < this.jComboBoxCName.getItemCount(); index++) {\r
@@ -335,9 +347,9 @@ public class PCDsDlg extends IDialog implements ItemListener {
      * @param iFrame\r
      * \r
      */\r
-    public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame) {\r
+    public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame, ModuleIdentification mid) {\r
         super(iFrame, true);\r
-        init(inPcdCodedId);\r
+        init(inPcdCodedId, mid);\r
     }\r
 \r
     /**\r
@@ -441,10 +453,6 @@ public class PCDsDlg extends IDialog implements ItemListener {
      * \r
      */\r
     private void initFrame() {\r
-        for (int index = 0; index < pcd.size(); index++) {\r
-            jComboBoxCName.addItem(pcd.getPcd(index));\r
-        }\r
-\r
         Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPcdUsage());\r
     }\r
 \r
@@ -486,6 +494,11 @@ public class PCDsDlg extends IDialog implements ItemListener {
         //\r
         // Check C_Name\r
         //\r
+        if (this.jComboBoxCName.getSelectedItem() == null) {\r
+            Log.wrn("Update Pcd", "Please select one Pcd Name");\r
+            return false;\r
+        }\r
+\r
         if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {\r
             if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {\r
                 Log.wrn("Update PcdCoded", "Incorrect data type for C Name");\r