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.Ppis.PpisIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
\r
/**\r
- * The class is used to create, update Ppi of MSA/MBD file It extends\r
- * IInternalFrame\r
+ * The class is used to create, update Ppi section of the MSA file\r
+ * \r
+ * It extends IDialog\r
* \r
*/\r
public class PpisDlg extends IDialog implements ItemListener {\r
private JTextField getJTextFieldFeatureFlag() {\r
if (jTextFieldFeatureFlag == null) {\r
jTextFieldFeatureFlag = new JTextField();\r
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 132, 320, 20));\r
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 157, 320, 20));\r
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");\r
+ jTextFieldFeatureFlag.setEnabled(false);\r
}\r
return jTextFieldFeatureFlag;\r
}\r
return jButtonCancel;\r
}\r
\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
/**\r
* This method initializes this\r
* \r
}\r
\r
/**\r
- * This method initializes this Fill values to all fields if these values are\r
- * not empty\r
- * \r
- * @param inProtocolsId\r
- * \r
- */\r
- private void init(PpisIdentification inPpisId) {\r
+ This method initializes this Fill values to all fields if these values are\r
+ not empty\r
+ \r
+ @param inPpisId\r
+ @param mid\r
+ \r
+ **/\r
+ private void init(PpisIdentification inPpisId, ModuleIdentification mid) {\r
init();\r
this.id = inPpisId;\r
\r
+ Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);\r
+ if (vpid.size() <= 0) {\r
+ Log.wrn("Init Ppi", "This module hasn't defined any package dependency, so there is no ppi can be added");\r
+ }\r
+\r
+ Tools.generateComboBoxByVector(this.jComboBoxCName,\r
+ wt.getAllPpiDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid)));\r
+\r
if (this.id != null) {\r
this.jComboBoxCName.setSelectedItem(id.getName());\r
this.jComboBoxPpiType.setSelectedItem(id.getType());\r
* @param iFrame\r
* \r
*/\r
- public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame) {\r
+ public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame, ModuleIdentification mid) {\r
super(iFrame, true);\r
- init(inPpisIdentification);\r
+ init(inPpisIdentification, mid);\r
}\r
\r
/**\r
\r
jLabelFeatureFlag = new JLabel();\r
jLabelFeatureFlag.setText("Feature Flag Expression");\r
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 168, 20));\r
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 168, 20));\r
+ jLabelFeatureFlag.setEnabled(false);\r
\r
jLabelArch = new JLabel();\r
- jLabelArch.setBounds(new java.awt.Rectangle(12, 157, 168, 20));\r
+ jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 168, 20));\r
jLabelArch.setText("Supported Architectures");\r
jArchCheckBox = new ArchCheckBox();\r
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 157, 320, 20));\r
+ jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));\r
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));\r
\r
jContentPane = new JPanel();\r
* \r
*/\r
private void initFrame() {\r
- Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllPpiDeclarationsFromWorkspace());\r
Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType());\r
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());\r
}\r
//\r
// Check Name\r
//\r
+ if (this.jComboBoxCName.getSelectedItem() == null) {\r
+ Log.wrn("Update Ppis", "Please select one Ppi/PpiNotify 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 Ppis", "Incorrect data type for Ppi/PpiNotify Name");\r