summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-22 08:48:00 +0000
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-22 08:48:00 +0000
commitc25ad66ccb055f5cb2e474ea1c786cbb644e9eab (patch)
tree512ddf97c62f9e7348e211799371701ab12c4dae /Tools
parentc493be6c9d2829c73e2e884846d098d955738f62 (diff)
downloadedk2-c25ad66ccb055f5cb2e474ea1c786cbb644e9eab.zip
edk2-c25ad66ccb055f5cb2e474ea1c786cbb644e9eab.tar.gz
edk2-c25ad66ccb055f5cb2e474ea1c786cbb644e9eab.tar.bz2
1. Fix EDKT323 (Only dependent packages' ppis can be added to module's ppi section)
2. Fix EDKT324 (Only dependent packages' protocols can be added to module's protocol section.) 3. Fix EDKT325 (Only dependent packages' pcds can be added to module's pcd section.) 4. Fix EDKT326 (Only dependent packages' guids can be added to module's guid section.) 5. Fix EDKT327 (Only dependent packages' library can be added to module's library section.) git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1599 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools')
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java16
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java2
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java2
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java2
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java2
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java2
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java22
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java20
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java27
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java39
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java22
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java101
12 files changed, 217 insertions, 40 deletions
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java
index dc71bbc..44ccfa1 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java
@@ -171,6 +171,22 @@ public class OpeningPackageList {
return null;
}
+ public PackageIdentification getIdByGuidVersion(String guid, String version) {
+ for (int index = 0; index < vOpeningPackageList.size(); index++) {
+ PackageIdentification id = vOpeningPackageList.elementAt(index).getId();
+ if (version != null) {
+ if (id.getGuid().equals(guid) && id.getVersion().equals(version)) {
+ return id;
+ }
+ } else {
+ if (id.getGuid().equals(guid)) {
+ return id;
+ }
+ }
+ }
+ return null;
+ }
+
public void setNew(PackageIdentification id, boolean isNew) {
int index = findIndexOfListById(id);
if (index > -1) {
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java
index 3724525..d55ba0f 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java
@@ -283,7 +283,7 @@ public class ModuleGuids extends IInternalFrame {
}
private void showEdit(int index) {
- GuidsDlg dlg = new GuidsDlg(vid.getGuids(index), new IFrame());
+ GuidsDlg dlg = new GuidsDlg(vid.getGuids(index), new IFrame(), omt.getId());
int result = dlg.showDialog();
if (result == DataType.RETURN_TYPE_OK) {
if (index == -1) {
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java
index 1decd0f..25d6451 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java
@@ -340,7 +340,7 @@ public class ModuleLibraryClassDefinitions extends IInternalFrame {
}
private void showEdit(int index) {
- LibraryClassDefsDlg mcdd = new LibraryClassDefsDlg(vLibraryClass.getLibraryClass(index), new IFrame());
+ LibraryClassDefsDlg mcdd = new LibraryClassDefsDlg(vLibraryClass.getLibraryClass(index), new IFrame(), omt.getId());
int result = mcdd.showDialog();
if (result == DataType.RETURN_TYPE_OK) {
if (index == -1) {
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java
index 3531399..0c3b2fd 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java
@@ -293,7 +293,7 @@ public class ModulePCDs extends IInternalFrame {
}
private void showEdit(int index) {
- PCDsDlg dlg = new PCDsDlg(vid.getPcdCoded(index), new IFrame());
+ PCDsDlg dlg = new PCDsDlg(vid.getPcdCoded(index), new IFrame(), omt.getId());
int result = dlg.showDialog();
if (result == DataType.RETURN_TYPE_OK) {
if (index == -1) {
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java
index 793bf84..ce81764 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java
@@ -308,7 +308,7 @@ public class ModulePpis extends IInternalFrame {
}
private void showEdit(int index) {
- PpisDlg dlg = new PpisDlg(vid.getPpis(index), new IFrame());
+ PpisDlg dlg = new PpisDlg(vid.getPpis(index), new IFrame(), omt.getId());
int result = dlg.showDialog();
if (result == DataType.RETURN_TYPE_OK) {
if (index == -1) {
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
index bf728a5..b0cdc12 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
@@ -309,7 +309,7 @@ public class ModuleProtocols extends IInternalFrame {
}
private void showEdit(int index) {
- ProtocolsDlg dlg = new ProtocolsDlg(vid.getProtocols(index), new IFrame());
+ ProtocolsDlg dlg = new ProtocolsDlg(vid.getProtocols(index), new IFrame(), omt.getId());
int result = dlg.showDialog();
if (result == DataType.RETURN_TYPE_OK) {
if (index == -1) {
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java
index 05f2703..4c6e2a7 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java
@@ -33,7 +33,9 @@ import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
import org.tianocore.frameworkwizard.common.ui.IDialog;
import org.tianocore.frameworkwizard.common.ui.IFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/**
@@ -255,9 +257,17 @@ public class GuidsDlg extends IDialog {
* @param inGuidsId
*
*/
- private void init(GuidsIdentification inGuidsId) {
+ private void init(GuidsIdentification inGuidsId, ModuleIdentification mid) {
init();
this.id = inGuidsId;
+
+ Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
+ if (vpid.size() <= 0) {
+ Log.wrn("Init Guid", "This module hasn't defined any package dependency, so there is no guid can be added");
+ }
+
+ Tools.generateComboBoxByVector(this.jComboBoxCName,
+ wt.getAllGuidDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid)));
if (this.id != null) {
this.jComboBoxCName.setSelectedItem(id.getName());
@@ -275,9 +285,9 @@ public class GuidsDlg extends IDialog {
* @param iFrame
*
*/
- public GuidsDlg(GuidsIdentification inGuidsIdentification, IFrame iFrame) {
+ public GuidsDlg(GuidsIdentification inGuidsIdentification, IFrame iFrame, ModuleIdentification mid) {
super(iFrame, true);
- init(inGuidsIdentification);
+ init(inGuidsIdentification, mid);
}
/**
@@ -356,7 +366,6 @@ public class GuidsDlg extends IDialog {
*
*/
private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllGuidDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVGuidUsage());
}
@@ -398,6 +407,11 @@ public class GuidsDlg extends IDialog {
//
// Check Name
//
+ if (this.jComboBoxCName.getSelectedItem() == null) {
+ Log.wrn("Update Guids", "Please select one Guid Name");
+ return false;
+ }
+
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
Log.wrn("Update Guids", "Incorrect data type for Guid Name");
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java
index 1f82543..87708b8 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java
@@ -35,7 +35,9 @@ import org.tianocore.frameworkwizard.common.ui.IDialog;
import org.tianocore.frameworkwizard.common.ui.IFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/**
@@ -302,9 +304,9 @@ public class LibraryClassDefsDlg extends IDialog {
This is the default constructor
**/
- public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame) {
+ public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame, ModuleIdentification mid) {
super(iFrame, true);
- init(inLibraryClassIdentification);
+ init(inLibraryClassIdentification, mid);
}
/**
@@ -324,9 +326,18 @@ public class LibraryClassDefsDlg extends IDialog {
This method initializes this
**/
- private void init(LibraryClassIdentification inLibraryClassIdentification) {
+ private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) {
init();
this.lcid = inLibraryClassIdentification;
+
+ Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
+ if (vpid.size() <= 0) {
+ Log.wrn("Init Library Class", "This module hasn't defined any package dependency, so there is no library class can be added");
+ }
+
+ Tools.generateComboBoxByVector(this.jComboBoxLibraryClassName,
+ wt.getAllLibraryClassDefinitionsFromPackages(wt.getPackageDependenciesOfModule(mid)));
+
if (lcid != null) {
this.jComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName());
this.jComboBoxUsage.setSelectedItem(lcid.getUsage());
@@ -430,7 +441,6 @@ public class LibraryClassDefsDlg extends IDialog {
**/
private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxLibraryClassName, wt.getAllLibraryClassDefinitionsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVLibraryUsage());
this.iCheckBoxListModule.setAllItems(ed.getVFrameworkModuleTypes());
}
@@ -472,7 +482,7 @@ public class LibraryClassDefsDlg extends IDialog {
// Check LibraryClass
//
if (this.jComboBoxLibraryClassName.getSelectedItem() == null) {
- Log.wrn("Update Library Class Definitions", "No Library Class can be added");
+ Log.wrn("Update Library Class Definitions", "Please select one Library Class");
return false;
}
if (!DataValidation.isLibraryClass(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java
index 81a4dfe..58b983d 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java
@@ -36,8 +36,10 @@ import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
import org.tianocore.frameworkwizard.common.ui.IDialog;
import org.tianocore.frameworkwizard.common.ui.IFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/**
@@ -307,9 +309,19 @@ public class PCDsDlg extends IDialog implements ItemListener {
* @param inPcdCodedId
*
*/
- private void init(PcdCodedIdentification inPcdCodedId) {
+ private void init(PcdCodedIdentification inPcdCodedId, ModuleIdentification mid) {
init();
this.id = inPcdCodedId;
+
+ Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
+ if (vpid.size() <= 0) {
+ Log.wrn("Init Pcd", "This module hasn't defined any package dependency, so there is no pcd can be added");
+ }
+
+ pcd = wt.getAllPcdDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid));
+ for (int index = 0; index < pcd.size(); index++) {
+ jComboBoxCName.addItem(pcd.getPcd(index));
+ }
if (this.id != null) {
for (int index = 0; index < this.jComboBoxCName.getItemCount(); index++) {
@@ -335,9 +347,9 @@ public class PCDsDlg extends IDialog implements ItemListener {
* @param iFrame
*
*/
- public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame) {
+ public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame, ModuleIdentification mid) {
super(iFrame, true);
- init(inPcdCodedId);
+ init(inPcdCodedId, mid);
}
/**
@@ -441,10 +453,6 @@ public class PCDsDlg extends IDialog implements ItemListener {
*
*/
private void initFrame() {
- for (int index = 0; index < pcd.size(); index++) {
- jComboBoxCName.addItem(pcd.getPcd(index));
- }
-
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPcdUsage());
}
@@ -486,6 +494,11 @@ public class PCDsDlg extends IDialog implements ItemListener {
//
// Check C_Name
//
+ if (this.jComboBoxCName.getSelectedItem() == null) {
+ Log.wrn("Update Pcd", "Please select one Pcd Name");
+ return false;
+ }
+
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
Log.wrn("Update PcdCoded", "Incorrect data type for C Name");
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java
index 77d64f4..1d294e0 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java
@@ -36,7 +36,9 @@ import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
import org.tianocore.frameworkwizard.common.ui.IDialog;
import org.tianocore.frameworkwizard.common.ui.IFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/**
@@ -249,10 +251,6 @@ public class PpisDlg extends IDialog implements ItemListener {
return jButtonCancel;
}
- public static void main(String[] args) {
-
- }
-
/**
* This method initializes this
*
@@ -266,16 +264,25 @@ public class PpisDlg extends IDialog implements ItemListener {
}
/**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inProtocolsId
- *
- */
- private void init(PpisIdentification inPpisId) {
+ This method initializes this Fill values to all fields if these values are
+ not empty
+
+ @param inPpisId
+ @param mid
+
+ **/
+ private void init(PpisIdentification inPpisId, ModuleIdentification mid) {
init();
this.id = inPpisId;
+ Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
+ if (vpid.size() <= 0) {
+ Log.wrn("Init Ppi", "This module hasn't defined any package dependency, so there is no ppi can be added");
+ }
+
+ Tools.generateComboBoxByVector(this.jComboBoxCName,
+ wt.getAllPpiDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid)));
+
if (this.id != null) {
this.jComboBoxCName.setSelectedItem(id.getName());
this.jComboBoxPpiType.setSelectedItem(id.getType());
@@ -293,9 +300,9 @@ public class PpisDlg extends IDialog implements ItemListener {
* @param iFrame
*
*/
- public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame) {
+ public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame, ModuleIdentification mid) {
super(iFrame, true);
- init(inPpisIdentification);
+ init(inPpisIdentification, mid);
}
/**
@@ -370,7 +377,6 @@ public class PpisDlg extends IDialog implements ItemListener {
*
*/
private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllPpiDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
}
@@ -413,6 +419,11 @@ public class PpisDlg extends IDialog implements ItemListener {
//
// Check Name
//
+ if (this.jComboBoxCName.getSelectedItem() == null) {
+ Log.wrn("Update Ppis", "Please select one Ppi/PpiNotify Name");
+ return false;
+ }
+
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
Log.wrn("Update Ppis", "Incorrect data type for Ppi/PpiNotify Name");
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java
index 72db128..5108cbc 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java
@@ -37,7 +37,9 @@ import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
import org.tianocore.frameworkwizard.common.ui.IDialog;
import org.tianocore.frameworkwizard.common.ui.IFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/**
@@ -284,9 +286,17 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
* @param inProtocolsId
*
*/
- private void init(ProtocolsIdentification inProtocolsId) {
+ private void init(ProtocolsIdentification inProtocolsId, ModuleIdentification mid) {
init();
this.id = inProtocolsId;
+
+ Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
+ if (vpid.size() <= 0) {
+ Log.wrn("Init Protocol", "This module hasn't defined any package dependency, so there is no protocol can be added");
+ }
+
+ Tools.generateComboBoxByVector(this.jComboBoxCName,
+ wt.getAllProtocolDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid)));
if (this.id != null) {
this.jComboBoxCName.setSelectedItem(id.getName());
@@ -305,9 +315,9 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
* @param iFrame
*
*/
- public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification, IFrame iFrame) {
+ public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification, IFrame iFrame, ModuleIdentification mid) {
super(iFrame, true);
- init(inProtocolsIdentification);
+ init(inProtocolsIdentification, mid);
}
/**
@@ -397,7 +407,6 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType());
- Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllProtocolDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage());
}
@@ -439,6 +448,11 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
//
// Check Name
//
+ if (this.jComboBoxCName.getSelectedItem() == null) {
+ Log.wrn("Update protocols", "Please select one Protocol/ProtocolNotify Name");
+ return false;
+ }
+
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
Log.wrn("Update Protocols", "Incorrect data type for Protocol/ProtocolNotify Name");
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java
index e022eb1..9c62ecd 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java
@@ -25,6 +25,7 @@ import org.tianocore.DbPathAndFilename;
import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes;
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
import org.tianocore.MsaFilesDocument.MsaFiles;
+import org.tianocore.PackageDependenciesDocument.PackageDependencies;
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
import org.tianocore.SourceFilesDocument.SourceFiles;
@@ -327,7 +328,7 @@ public class WorkspaceTools {
}
}
if (!isFind) {
- v.addElement(id);
+ v.addElement(id);
}
}
}
@@ -466,6 +467,20 @@ public class WorkspaceTools {
Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
return vector;
}
+
+ public Vector<String> getAllLibraryClassDefinitionsFromPackages(Vector<PackageIdentification> vpid) {
+ Vector<String> vector = new Vector<String>();
+ for (int index = 0; index < vpid.size(); index++) {
+ Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList
+ .getPackageSurfaceAreaFromId(vpid.get(index)));
+ if (v != null && v.size() > 0) {
+ vector.addAll(v);
+ }
+
+ }
+ Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
+ return vector;
+ }
public Vector<String> getAllProtocolDeclarationsFromWorkspace() {
Vector<String> vector = new Vector<String>();
@@ -481,6 +496,20 @@ public class WorkspaceTools {
return vector;
}
+ public Vector<String> getAllProtocolDeclarationsFromPackages(Vector<PackageIdentification> vpid) {
+ Vector<String> vector = new Vector<String>();
+ for (int index = 0; index < vpid.size(); index++) {
+ Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList
+ .getPackageSurfaceAreaFromId(vpid
+ .get(index)));
+ if (v != null && v.size() > 0) {
+ vector.addAll(v);
+ }
+ }
+ Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
+ return vector;
+ }
+
public Vector<String> getAllPpiDeclarationsFromWorkspace() {
Vector<String> vector = new Vector<String>();
for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
@@ -495,6 +524,20 @@ public class WorkspaceTools {
return vector;
}
+ public Vector<String> getAllPpiDeclarationsFromPackages(Vector<PackageIdentification> vpid) {
+ Vector<String> vector = new Vector<String>();
+ for (int index = 0; index < vpid.size(); index++) {
+ Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList
+ .getPackageSurfaceAreaFromId(vpid
+ .get(index)));
+ if (v != null && v.size() > 0) {
+ vector.addAll(v);
+ }
+ }
+ Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
+ return vector;
+ }
+
public Vector<String> getAllGuidDeclarationsFromWorkspace() {
Vector<String> vector = new Vector<String>();
for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
@@ -510,6 +553,21 @@ public class WorkspaceTools {
return vector;
}
+ public Vector<String> getAllGuidDeclarationsFromPackages(Vector<PackageIdentification> vpid) {
+ Vector<String> vector = new Vector<String>();
+ for (int index = 0; index < vpid.size(); index++) {
+ Vector<String> v = getAllGuidDeclarationsFromPackage(GlobalData.openingPackageList
+ .getPackageSurfaceAreaFromId(vpid
+ .get(index)));
+ if (v != null && v.size() > 0) {
+ vector.addAll(v);
+ }
+
+ }
+ Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
+ return vector;
+ }
+
public PcdVector getAllPcdDeclarationsFromWorkspace() {
PcdVector vector = new PcdVector();
for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {
@@ -525,6 +583,21 @@ public class WorkspaceTools {
return vector;
}
+ public PcdVector getAllPcdDeclarationsFromPackages(Vector<PackageIdentification> vpid) {
+ PcdVector vector = new PcdVector();
+ for (int index = 0; index < vpid.size(); index++) {
+ PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList
+ .getPackageSurfaceAreaFromId(vpid
+ .get(index)));
+ if (v != null && v.size() > 0) {
+ vector.addAll(v);
+ }
+
+ }
+ Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);
+ return vector;
+ }
+
/**
Find a module's package's id
@@ -705,4 +778,30 @@ public class WorkspaceTools {
return v;
}
+
+ /**
+ Get a module's all package dependencies
+
+ @param mid The module id
+ @return A vector of all package dependency ids
+
+ **/
+ public Vector<PackageIdentification> getPackageDependenciesOfModule(ModuleIdentification mid) {
+ Vector<PackageIdentification> vpid = new Vector<PackageIdentification>();
+ ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);
+ if (msa != null) {
+ PackageDependencies pd = msa.getPackageDependencies();
+ if (pd != null) {
+ for (int index = 0; index < pd.getPackageList().size(); index++) {
+ String guid = pd.getPackageList().get(index).getPackageGuid();
+ String version = pd.getPackageList().get(index).getPackageVersion();
+ PackageIdentification pid = GlobalData.openingPackageList.getIdByGuidVersion(guid, version);
+ if (pid != null) {
+ vpid.addElement(pid);
+ }
+ }
+ }
+ }
+ return vpid;
+ }
}