1. PcdUsage is added to PCD entry in schema so wizard tool is also updated to support...
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Jul 2006 08:17:32 +0000 (08:17 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Jul 2006 08:17:32 +0000 (08:17 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1140 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java

index 126bd1d..b347fa8 100644 (file)
@@ -168,6 +168,8 @@ public class EnumerationData {
     // Used by Pcd\r
     //\r
     public Vector<String> vPcdItemTypes = new Vector<String>();\r
+    \r
+    public Vector<String> vPcdUsage = new Vector<String>();\r
 \r
     public EnumerationData() {\r
         init();\r
@@ -280,7 +282,7 @@ public class EnumerationData {
         // Used by Pcd\r
         //\r
         initPcdItemTypes();\r
-        \r
+        initPcdUsage();\r
     }\r
     \r
     private void initEnabled() {\r
@@ -702,6 +704,16 @@ public class EnumerationData {
         vPcdItemTypes.addElement("DYNAMIC_EX");\r
     }\r
     \r
+    private void initPcdUsage() {\r
+        vPcdUsage.removeAllElements();\r
+        vPcdUsage.addElement(DataType.EMPTY_SELECT_ITEM);\r
+        vPcdUsage.addElement("ALWAYS_CONSUMED");\r
+        vPcdUsage.addElement("SOMETIMES_CONSUMED");\r
+        vPcdUsage.addElement("ALWAYS_PRODUCED");\r
+        vPcdUsage.addElement("SOMETIMES_PRODUCED");\r
+        vPcdUsage.addElement("DEFAULT");\r
+    }\r
+    \r
     public Vector<String> getvCompontentType() {\r
         return vCompontentType;\r
     }\r
@@ -1033,4 +1045,12 @@ public class EnumerationData {
     public void setVToolCode(Vector<String> toolCode) {\r
         vToolCode = toolCode;\r
     }\r
+\r
+    public Vector<String> getVPcdUsage() {\r
+        return vPcdUsage;\r
+    }\r
+\r
+    public void setVPcdUsage(Vector<String> pcdUsage) {\r
+        vPcdUsage = pcdUsage;\r
+    }\r
 }\r
index 7f2f377..02ae08d 100644 (file)
@@ -35,8 +35,10 @@ public class PcdCodedIdentification {
     private String help = null;\r
     \r
     private String type = null;\r
+    \r
+    private String usage = null;\r
 \r
-    public PcdCodedIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4, String arg5, String arg6) {\r
+    public PcdCodedIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4, String arg5, String arg6, String arg7) {\r
         this.name = (arg0 == null ? "" : arg0);\r
         this.guid = (arg1 == null ? "" : arg1);\r
         this.featureFlag = (arg2 == null ? "" : arg2);\r
@@ -44,6 +46,7 @@ public class PcdCodedIdentification {
         this.value = (arg4 == null ? "" : arg4);\r
         this.help = (arg5 == null ? "" : arg5);\r
         this.type = (arg6 == null ? "" : arg6);\r
+        this.usage = (arg7 == null ? "" : arg7);\r
     }\r
 \r
     public String getFeatureFlag() {\r
@@ -108,4 +111,12 @@ public class PcdCodedIdentification {
     public void setValue(String value) {\r
         this.value = value;\r
     }\r
+\r
+    public String getUsage() {\r
+        return usage;\r
+    }\r
+\r
+    public void setUsage(String usage) {\r
+        this.usage = usage;\r
+    }\r
 }\r
index e5d6e91..7b35f1a 100644 (file)
@@ -92,6 +92,7 @@ public class PcdCodedVector {
         v.addElement(getPcdCoded(index).getName());\r
         v.addElement(getPcdCoded(index).getType());\r
         v.addElement(getPcdCoded(index).getValue());\r
+        v.addElement(getPcdCoded(index).getUsage());\r
         return v;\r
     }\r
 }\r
index 8d72515..85fe67c 100644 (file)
@@ -29,6 +29,7 @@ import javax.swing.event.ListSelectionEvent;
 \r
 import org.tianocore.PcdCodedDocument;\r
 import org.tianocore.PcdItemTypes;\r
+import org.tianocore.PcdUsage;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
 import org.tianocore.PcdCodedDocument.PcdCoded;\r
 import org.tianocore.PcdCodedDocument.PcdCoded.PcdEntry;\r
@@ -185,6 +186,7 @@ public class ModulePCDs extends IInternalFrame {
             model.addColumn("Name");\r
             model.addColumn("Type");\r
             model.addColumn("Value");\r
+            model.addColumn("Usage");\r
 \r
             jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
             jTable.getSelectionModel().addListSelectionListener(this);\r
@@ -234,8 +236,11 @@ public class ModulePCDs extends IInternalFrame {
                     if (pcds.getPcdEntryList().get(index).getPcdItemType() != null) {\r
                         arg6 = pcds.getPcdEntryList().get(index).getPcdItemType().toString();\r
                     }\r
-\r
-                    id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);\r
+                    String arg7 = null;\r
+                    if (pcds.getPcdEntryList().get(index).getUsage() != null) {\r
+                        arg7 = pcds.getPcdEntryList().get(index).getUsage().toString();\r
+                    }\r
+                    id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);\r
                     vid.addPcdCoded(id);\r
                 }\r
             }\r
@@ -400,6 +405,9 @@ public class ModulePCDs extends IInternalFrame {
                     if (!isEmpty(vid.getPcdCoded(index).getType())) {\r
                         p.setPcdItemType(PcdItemTypes.Enum.forString(vid.getPcdCoded(index).getType()));\r
                     }\r
+                    if (!isEmpty(vid.getPcdCoded(index).getUsage())) {\r
+                        p.setUsage(PcdUsage.Enum.forString(vid.getPcdCoded(index).getUsage()));\r
+                    }\r
                     this.pcds.addNewPcdEntry();\r
                     this.pcds.setPcdEntryArray(pcds.getPcdEntryList().size() - 1, p);\r
                 }\r
index e0a0f34..b2a2f6d 100644 (file)
@@ -29,6 +29,7 @@ import javax.swing.JTextArea;
 \r
 import org.tianocore.frameworkwizard.common.DataType;\r
 import org.tianocore.frameworkwizard.common.DataValidation;\r
+import org.tianocore.frameworkwizard.common.EnumerationData;\r
 import org.tianocore.frameworkwizard.common.Log;\r
 import org.tianocore.frameworkwizard.common.Tools;\r
 import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;\r
@@ -97,11 +98,17 @@ public class PCDsDlg extends IDialog implements ItemListener {
     private JButton jButtonCancel = null;\r
 \r
     private JScrollPane jScrollPaneHelpText = null;\r
+    \r
+    private JLabel jLabelUsage = null;\r
+\r
+    private JComboBox jComboBoxUsage = null;\r
 \r
     //\r
     // Not used by UI\r
     //\r
     private PcdCodedIdentification id = null;\r
+    \r
+    private EnumerationData ed = new EnumerationData();\r
 \r
     private WorkspaceTools wt = new WorkspaceTools();\r
 \r
@@ -179,7 +186,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
             jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
             jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));\r
             jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));\r
-            jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85));\r
+            jScrollPaneHelpText.setLocation(new java.awt.Point(160, 110));\r
             jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());\r
         }\r
         return jScrollPaneHelpText;\r
@@ -221,7 +228,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
     private JTextField getJTextFieldFeatureFlag() {\r
         if (jTextFieldFeatureFlag == null) {\r
             jTextFieldFeatureFlag = new JTextField();\r
-            jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 130, 320, 20));\r
+            jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 155, 320, 20));\r
             jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r
             jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");\r
         }\r
@@ -237,7 +244,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
     private JButton getJButtonOk() {\r
         if (jButtonOk == null) {\r
             jButtonOk = new JButton();\r
-            jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));\r
+            jButtonOk.setBounds(new java.awt.Rectangle(290, 205, 90, 20));\r
             jButtonOk.setText("Ok");\r
             jButtonOk.addActionListener(this);\r
         }\r
@@ -253,13 +260,27 @@ public class PCDsDlg extends IDialog implements ItemListener {
     private JButton getJButtonCancel() {\r
         if (jButtonCancel == null) {\r
             jButtonCancel = new JButton();\r
-            jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));\r
+            jButtonCancel.setBounds(new java.awt.Rectangle(390, 205, 90, 20));\r
             jButtonCancel.setText("Cancel");\r
             jButtonCancel.addActionListener(this);\r
         }\r
         return jButtonCancel;\r
     }\r
 \r
+    /**\r
+     * This method initializes jComboBoxUsage  \r
+     *         \r
+     * @return javax.swing.JComboBox   \r
+     */\r
+    private JComboBox getJComboBoxUsage() {\r
+        if (jComboBoxUsage == null) {\r
+            jComboBoxUsage = new JComboBox();\r
+            jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
+            jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));\r
+        }\r
+        return jComboBoxUsage;\r
+    }\r
+\r
     public static void main(String[] args) {\r
 \r
     }\r
@@ -269,7 +290,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
      * \r
      */\r
     private void init() {\r
-        this.setSize(500, 255);\r
+        this.setSize(500, 270);\r
         this.setContentPane(getJScrollPane());\r
         this.setTitle("Pcd Coded");\r
         initFrame();\r
@@ -292,6 +313,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
             this.jComboBoxCName.setSelectedItem(id.getName());\r
             this.jTextFieldTokenSpaceGuid.setText(id.getGuid());\r
             this.jTextFieldDefaultValue.setText(id.getValue());\r
+            this.jComboBoxUsage.setSelectedItem(id.getUsage());\r
             this.jTextAreaHelpText.setText(id.getHelp());\r
             this.jComboBoxItemType.setSelectedItem(id.getType());\r
             this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());\r
@@ -333,6 +355,9 @@ public class PCDsDlg extends IDialog implements ItemListener {
      */\r
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
+            jLabelUsage = new JLabel();\r
+            jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
+            jLabelUsage.setText("Usge");\r
             jStarLabel1 = new StarLabel();\r
             jStarLabel1.setLocation(new java.awt.Point(2, 10));\r
             jLabelC_Name = new JLabel();\r
@@ -350,14 +375,14 @@ public class PCDsDlg extends IDialog implements ItemListener {
             jLabelDefaultValue.setBounds(new java.awt.Rectangle(15, 60, 145, 20));\r
 \r
             jStarLabel3 = new StarLabel();\r
-            jStarLabel3.setLocation(new java.awt.Point(2, 85));\r
+            jStarLabel3.setLocation(new java.awt.Point(2, 110));\r
             jLabelHelpText = new JLabel();\r
             jLabelHelpText.setText("Help Text");\r
-            jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20));\r
+            jLabelHelpText.setBounds(new java.awt.Rectangle(15, 110, 145, 20));\r
 \r
             jLabelFeatureFlag = new JLabel();\r
             jLabelFeatureFlag.setText("Feature Flag Expression");\r
-            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 140, 20));\r
+            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 155, 140, 20));\r
 \r
             jLabelTokenSpaceGuid = new JLabel();\r
             jLabelTokenSpaceGuid.setText("Token Space C Name");\r
@@ -365,17 +390,17 @@ public class PCDsDlg extends IDialog implements ItemListener {
 \r
             jLabelArch = new JLabel();\r
             jLabelArch.setText("Supported Architectures");\r
-            jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20));\r
+            jLabelArch.setBounds(new java.awt.Rectangle(15, 180, 145, 20));\r
             jArchCheckBox = new ArchCheckBox();\r
             jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));\r
-            jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20));\r
+            jArchCheckBox.setBounds(new java.awt.Rectangle(160, 180, 320, 20));\r
 \r
             // Hidden field\r
             jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
 \r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setPreferredSize(new java.awt.Dimension(485, 210));\r
+            jContentPane.setPreferredSize(new java.awt.Dimension(485, 235));\r
 \r
             jContentPane.add(jStarLabel1, null);\r
             jContentPane.add(jLabelC_Name, null);\r
@@ -397,6 +422,8 @@ public class PCDsDlg extends IDialog implements ItemListener {
             jContentPane.add(jLabelTokenSpaceGuid, null);\r
             jContentPane.add(getJButtonOk(), null);\r
             jContentPane.add(getJButtonCancel(), null);\r
+            jContentPane.add(jLabelUsage, null);\r
+            jContentPane.add(getJComboBoxUsage(), null);\r
         }\r
         return jContentPane;\r
     }\r
@@ -410,7 +437,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
             jComboBoxCName.addItem(pcd.getPcd(index));\r
         }\r
 \r
-        // Tools.generateComboBoxByVector(jComboBoxItemType, ed.getVPcdItemTypes());\r
+        Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPcdUsage());\r
     }\r
 \r
     /*\r
@@ -510,7 +537,12 @@ public class PCDsDlg extends IDialog implements ItemListener {
         String arg4 = this.jTextFieldDefaultValue.getText();\r
         String arg5 = this.jTextAreaHelpText.getText();\r
         String arg6 = this.jComboBoxItemType.getSelectedItem().toString();\r
-        id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);\r
+        String arg7 = this.jComboBoxUsage.getSelectedItem().toString();\r
+        if (arg7.equals(DataType.EMPTY_SELECT_ITEM)) {\r
+            arg7 = "";\r
+        }\r
+\r
+        id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);\r
         return id;\r
     }\r
 \r