X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fmodule%2Fui%2Fdialog%2FPpisDlg.java;h=2a24158ef53e74db4db2cde500739291fbc09384;hp=4ad12ee76ea953802edf693fe29c948cacf982fd;hb=214b0d1914b48d651b25e58f321ddb77a46903b8;hpb=f51ee52bcedf9294034930c89342458d91721251
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 4ad12ee76e..2a24158ef5 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
@@ -1,6 +1,6 @@
/** @file
- The file is used to create, update Ppi of MSA/MBD file
+ The file is used to create, update Ppi section of the MSA file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
@@ -25,6 +25,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
+import javax.swing.JTextArea;
import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.DataValidation;
@@ -35,23 +36,26 @@ 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;
/**
- The class is used to create, update Ppi of MSA/MBD file
- It extends IInternalFrame
-
- **/
+ * The class is used to create, update Ppi section of the MSA file
+ *
+ * It extends IDialog
+ *
+ */
public class PpisDlg extends IDialog implements ItemListener {
- ///
- /// Define class Serial Version UID
- ///
+ // /
+ // / Define class Serial Version UID
+ // /
private static final long serialVersionUID = -4284901202357037724L;
//
- //Define class members
+ // Define class members
//
private JPanel jContentPane = null;
@@ -73,6 +77,8 @@ public class PpisDlg extends IDialog implements ItemListener {
private StarLabel jStarLabel2 = null;
+ private StarLabel jStarLabel3 = null;
+
private JComboBox jComboBoxPpiType = null;
private JLabel jLabelArch = null;
@@ -81,7 +87,9 @@ public class PpisDlg extends IDialog implements ItemListener {
private JLabel jLabelHelpText = null;
- private JTextField jTextFieldHelpText = null;
+ private JTextArea jTextAreaHelpText = null;
+
+ private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
@@ -99,69 +107,76 @@ public class PpisDlg extends IDialog implements ItemListener {
private EnumerationData ed = new EnumerationData();
/**
- This method initializes jTextFieldC_Name
-
- @return javax.swing.JTextField jTextFieldC_Name
-
- **/
+ * This method initializes jComboBoxPpiType
+ *
+ * @return javax.swing.JComboBox
+ */
+ private JComboBox getJComboBoxPpiType() {
+ if (jComboBoxPpiType == null) {
+ jComboBoxPpiType = new JComboBox();
+ jComboBoxPpiType.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
+ jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxPpiType.addItemListener(this);
+ jComboBoxPpiType
+ .setToolTipText("PPIs are named by GUID.
PPI Notify is consumed via a register PPI Notify mechanism");
+ }
+ return jComboBoxPpiType;
+ }
+
+ /**
+ * This method initializes jTextFieldC_Name
+ *
+ * @return javax.swing.JTextField jTextFieldC_Name
+ *
+ */
private JComboBox getJComboBoxCName() {
if (jComboBoxCName == null) {
jComboBoxCName = new JComboBox();
- jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxCName.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxCName.setToolTipText("Select Guid C Name of PPI");
}
return jComboBoxCName;
}
/**
- This method initializes jTextFieldFeatureFlag
-
- @return javax.swing.JTextField jTextFieldFeatureFlag
-
- **/
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 110, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- This method initializes jComboBox
-
- @return javax.swing.JComboBox jComboBoxUsage
-
- **/
- private JComboBox getJComboBox() {
+ * This method initializes jComboBoxUsage
+ *
+ * @return javax.swing.JComboBox jComboBoxUsage
+ *
+ */
+ private JComboBox getJComboBoxUsage() {
if (jComboBoxUsage == null) {
jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxUsage
+ .setToolTipText("
PPI |
ALWAYS_CONSUMED | Module always consumes the PPI |
SOMETIMES_CONSUMED | Module sometimes consumes the PPI |
ALWAYS_PRODUCED | Module always produces the PPI |
SOMETIMES_PRODUCED | Module sometimes produces the PPI |
PPI Notify |
SOMETIMES_CONSUMED | Module will consume the PPI if it is produced. Consumption is defined by executing the PPI notify function |
");
}
return jComboBoxUsage;
}
/**
- * This method initializes jComboBoxPpiType
- *
- * @return javax.swing.JComboBox
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField jTextFieldFeatureFlag
+ *
*/
- private JComboBox getJComboBoxPpiType() {
- if (jComboBoxPpiType == null) {
- jComboBoxPpiType = new JComboBox();
- jComboBoxPpiType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
- jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxPpiType.addItemListener(this);
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
+ jTextFieldFeatureFlag.setEnabled(false);
}
- return jComboBoxPpiType;
+ return jTextFieldFeatureFlag;
}
/**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
+ * This method initializes jScrollPane
+ *
+ * @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
@@ -172,30 +187,48 @@ public class PpisDlg extends IDialog implements ItemListener {
}
/**
- This method initializes jTextFieldHelpText
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldHelpText() {
- if (jTextFieldHelpText == null) {
- jTextFieldHelpText = new JTextField();
- jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
- jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ * This method initializes jTextAreaHelpText
+ *
+ * @return javax.swing.JTextArea
+ *
+ */
+ private JTextArea getJTextAreaHelpText() {
+ if (jTextAreaHelpText == null) {
+ jTextAreaHelpText = new JTextArea();
+ jTextAreaHelpText.setLineWrap(true);
+ jTextAreaHelpText.setWrapStyleWord(true);
}
- return jTextFieldHelpText;
+ return jTextAreaHelpText;
}
/**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
-
- **/
+ * This method initializes jScrollPaneHelpText
+ *
+ * @return javax.swing.JScrollPane
+ *
+ */
+ private JScrollPane getJScrollPaneHelpText() {
+ if (jScrollPaneHelpText == null) {
+ jScrollPaneHelpText = new JScrollPane();
+ jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
+ jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
+ jScrollPaneHelpText.setLocation(new java.awt.Point(168, 87));
+ jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
+ }
+ return jScrollPaneHelpText;
+ }
+
+ /**
+ * This method initializes jButtonOk
+ *
+ * @return javax.swing.JButton
+ *
+ */
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 165, 90, 20));
+ jButtonOk.setBounds(new java.awt.Rectangle(290, 187, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
@@ -203,123 +236,143 @@ public class PpisDlg extends IDialog implements ItemListener {
}
/**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
-
- **/
+ * This method initializes jButtonCancel
+ *
+ * @return javax.swing.JButton
+ *
+ */
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 165, 90, 20));
+ jButtonCancel.setBounds(new java.awt.Rectangle(390, 187, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
- public static void main(String[] args) {
-
- }
-
/**
- This method initializes this
-
- **/
+ * This method initializes this
+ *
+ */
private void init() {
- this.setSize(510, 240);
+ this.setSize(505, 260);
this.setContentPane(getJScrollPane());
- this.setTitle("Ppis");
+ this.setTitle("PPI Definitions");
initFrame();
this.centerWindow();
}
/**
- This method initializes this
- Fill values to all fields if these values are not empty
+ This method initializes this Fill values to all fields if these values are
+ not empty
+
+ @param inPpisId
+ @param mid
- @param inProtocolsId
-
**/
- private void init(PpisIdentification inPpisId) {
+ private void init(PpisIdentification inPpisId, ModuleIdentification mid) {
init();
this.id = inPpisId;
+
+ //
+ // Init arch with module's arch
+ //
+ this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
+
+ //
+ // Get defined ppis from dependent packages
+ //
+ Vector 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());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextFieldHelpText.setText(id.getHelp());
+ this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
- This is the override edit constructor
-
- @param inProtocolsIdentification
- @param iFrame
-
- **/
- public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame) {
+ * This is the override edit constructor
+ *
+ * @param inProtocolsIdentification
+ * @param iFrame
+ *
+ */
+ public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame, ModuleIdentification mid) {
super(iFrame, true);
- init(inPpisIdentification);
+ init(inPpisIdentification, mid);
}
/**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
+ * This method initializes jContentPane
+ *
+ * @return javax.swing.JPanel jContentPane
+ *
+ */
private JPanel getJContentPane() {
if (jContentPane == null) {
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(160, 135, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
- jLabelArch.setText("Arch");
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(2, 12));
jLabelPpiType = new JLabel();
- jLabelPpiType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
- jLabelPpiType.setText("Ppi Type");
+ jLabelPpiType.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
+ jLabelPpiType.setText("Select Ppi Type");
+
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(2, 37));
+ jLabelC_Name = new JLabel();
+ jLabelC_Name.setText("PPI GUID C Name");
+ jLabelC_Name.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
+
+ jStarLabel3 = new StarLabel();
+ jStarLabel3.setLocation(new java.awt.Point(2, 62));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setText("Feature Flag");
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("C Name Type");
- jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
+
jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 87, 168, 20));
jLabelHelpText.setText("Help Text");
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setText("Feature Flag Expression");
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 168, 20));
+ jLabelFeatureFlag.setEnabled(false);
+
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 168, 20));
+ jLabelArch.setText("Supported Architectures");
+ jArchCheckBox = new ArchCheckBox();
+ jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
+ jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
+
jContentPane = new JPanel();
jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 190));
+ jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jLabelPpiType, null);
+ jContentPane.add(getJComboBoxPpiType(), null);
+ jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxCName(), null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(jStarLabel3, null);
jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBox(), null);
- jContentPane.add(getJComboBoxPpiType(), null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jLabelPpiType, null);
- jStarLabel1 = new StarLabel();
- jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
-
+ jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJTextFieldHelpText(), null);
+ jContentPane.add(getJScrollPaneHelpText(), null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
@@ -328,18 +381,19 @@ public class PpisDlg extends IDialog implements ItemListener {
}
/**
- This method initializes Usage type
-
- **/
+ * This method initializes Usage type
+ *
+ */
private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllPpiDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
+ *
* Override actionPerformed to listen all actions
*
*/
@@ -359,20 +413,25 @@ public class PpisDlg extends IDialog implements ItemListener {
}
/**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
+ * Data validation for all fields
+ *
+ * @retval true - All datas are valid
+ * @retval false - At least one data is invalid
+ *
+ */
public boolean checkAdd() {
//
- // Check if all fields have correct data types
+ // Check if all fields have correct data types
//
//
- // Check Name
+ // 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");
@@ -400,18 +459,19 @@ public class PpisDlg extends IDialog implements ItemListener {
String arg3 = this.jTextFieldFeatureFlag.getText();
Vector arg4 = this.jArchCheckBox.getSelectedItemsVector();
- String arg5 = this.jTextFieldHelpText.getText();
+ String arg5 = this.jTextAreaHelpText.getText();
id = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
return id;
- }
-
- /* (non-Javadoc)
+ } /*
+ * (non-Javadoc)
+ *
* @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
- *
+ *
* Reflesh the frame when selected item changed
*
*/
+
public void itemStateChanged(ItemEvent arg0) {
if (arg0.getSource() == this.jComboBoxPpiType && arg0.getStateChange() == ItemEvent.SELECTED) {
if (this.jComboBoxPpiType.getSelectedItem().toString().equals(ed.getVPpiType().get(0))) {