From: hche10x Date: Fri, 28 Jul 2006 08:17:32 +0000 (+0000) Subject: 1. PcdUsage is added to PCD entry in schema so wizard tool is also updated to support... X-Git-Tag: edk2-stable201903~24732 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=fd16c6d5d404091051d010fe52a69196c9b89f1e 1. PcdUsage is added to PCD entry in schema so wizard tool is also updated to support this. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1140 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java index 126bd1dcc2..b347fa861c 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java @@ -168,6 +168,8 @@ public class EnumerationData { // Used by Pcd // public Vector vPcdItemTypes = new Vector(); + + public Vector vPcdUsage = new Vector(); public EnumerationData() { init(); @@ -280,7 +282,7 @@ public class EnumerationData { // Used by Pcd // initPcdItemTypes(); - + initPcdUsage(); } private void initEnabled() { @@ -702,6 +704,16 @@ public class EnumerationData { vPcdItemTypes.addElement("DYNAMIC_EX"); } + private void initPcdUsage() { + vPcdUsage.removeAllElements(); + vPcdUsage.addElement(DataType.EMPTY_SELECT_ITEM); + vPcdUsage.addElement("ALWAYS_CONSUMED"); + vPcdUsage.addElement("SOMETIMES_CONSUMED"); + vPcdUsage.addElement("ALWAYS_PRODUCED"); + vPcdUsage.addElement("SOMETIMES_PRODUCED"); + vPcdUsage.addElement("DEFAULT"); + } + public Vector getvCompontentType() { return vCompontentType; } @@ -1033,4 +1045,12 @@ public class EnumerationData { public void setVToolCode(Vector toolCode) { vToolCode = toolCode; } + + public Vector getVPcdUsage() { + return vPcdUsage; + } + + public void setVPcdUsage(Vector pcdUsage) { + vPcdUsage = pcdUsage; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java index 7f2f377757..02ae08d4d7 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java @@ -35,8 +35,10 @@ public class PcdCodedIdentification { private String help = null; private String type = null; + + private String usage = null; - public PcdCodedIdentification(String arg0, String arg1, String arg2, Vector arg3, String arg4, String arg5, String arg6) { + public PcdCodedIdentification(String arg0, String arg1, String arg2, Vector arg3, String arg4, String arg5, String arg6, String arg7) { this.name = (arg0 == null ? "" : arg0); this.guid = (arg1 == null ? "" : arg1); this.featureFlag = (arg2 == null ? "" : arg2); @@ -44,6 +46,7 @@ public class PcdCodedIdentification { this.value = (arg4 == null ? "" : arg4); this.help = (arg5 == null ? "" : arg5); this.type = (arg6 == null ? "" : arg6); + this.usage = (arg7 == null ? "" : arg7); } public String getFeatureFlag() { @@ -108,4 +111,12 @@ public class PcdCodedIdentification { public void setValue(String value) { this.value = value; } + + public String getUsage() { + return usage; + } + + public void setUsage(String usage) { + this.usage = usage; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java index e5d6e9186e..7b35f1a426 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java @@ -92,6 +92,7 @@ public class PcdCodedVector { v.addElement(getPcdCoded(index).getName()); v.addElement(getPcdCoded(index).getType()); v.addElement(getPcdCoded(index).getValue()); + v.addElement(getPcdCoded(index).getUsage()); return v; } } 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 8d72515e84..85fe67ca3a 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 @@ -29,6 +29,7 @@ import javax.swing.event.ListSelectionEvent; import org.tianocore.PcdCodedDocument; import org.tianocore.PcdItemTypes; +import org.tianocore.PcdUsage; import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea; import org.tianocore.PcdCodedDocument.PcdCoded; import org.tianocore.PcdCodedDocument.PcdCoded.PcdEntry; @@ -185,6 +186,7 @@ public class ModulePCDs extends IInternalFrame { model.addColumn("Name"); model.addColumn("Type"); model.addColumn("Value"); + model.addColumn("Usage"); jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable.getSelectionModel().addListSelectionListener(this); @@ -234,8 +236,11 @@ public class ModulePCDs extends IInternalFrame { if (pcds.getPcdEntryList().get(index).getPcdItemType() != null) { arg6 = pcds.getPcdEntryList().get(index).getPcdItemType().toString(); } - - id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + String arg7 = null; + if (pcds.getPcdEntryList().get(index).getUsage() != null) { + arg7 = pcds.getPcdEntryList().get(index).getUsage().toString(); + } + id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); vid.addPcdCoded(id); } } @@ -400,6 +405,9 @@ public class ModulePCDs extends IInternalFrame { if (!isEmpty(vid.getPcdCoded(index).getType())) { p.setPcdItemType(PcdItemTypes.Enum.forString(vid.getPcdCoded(index).getType())); } + if (!isEmpty(vid.getPcdCoded(index).getUsage())) { + p.setUsage(PcdUsage.Enum.forString(vid.getPcdCoded(index).getUsage())); + } this.pcds.addNewPcdEntry(); this.pcds.setPcdEntryArray(pcds.getPcdEntryList().size() - 1, p); } 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 e0a0f34c01..b2a2f6dc6d 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 @@ -29,6 +29,7 @@ import javax.swing.JTextArea; import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataValidation; +import org.tianocore.frameworkwizard.common.EnumerationData; import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.ui.ArchCheckBox; @@ -97,11 +98,17 @@ public class PCDsDlg extends IDialog implements ItemListener { private JButton jButtonCancel = null; private JScrollPane jScrollPaneHelpText = null; + + private JLabel jLabelUsage = null; + + private JComboBox jComboBoxUsage = null; // // Not used by UI // private PcdCodedIdentification id = null; + + private EnumerationData ed = new EnumerationData(); private WorkspaceTools wt = new WorkspaceTools(); @@ -179,7 +186,7 @@ public class PCDsDlg extends IDialog implements ItemListener { 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(160, 85)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 110)); jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); } return jScrollPaneHelpText; @@ -221,7 +228,7 @@ public class PCDsDlg extends IDialog implements ItemListener { private JTextField getJTextFieldFeatureFlag() { if (jTextFieldFeatureFlag == null) { jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); } @@ -237,7 +244,7 @@ public class PCDsDlg extends IDialog implements ItemListener { private JButton getJButtonOk() { if (jButtonOk == null) { jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); + jButtonOk.setBounds(new java.awt.Rectangle(290, 205, 90, 20)); jButtonOk.setText("Ok"); jButtonOk.addActionListener(this); } @@ -253,13 +260,27 @@ public class PCDsDlg extends IDialog implements ItemListener { private JButton getJButtonCancel() { if (jButtonCancel == null) { jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 205, 90, 20)); jButtonCancel.setText("Cancel"); jButtonCancel.addActionListener(this); } return jButtonCancel; } + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBoxUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + } + return jComboBoxUsage; + } + public static void main(String[] args) { } @@ -269,7 +290,7 @@ public class PCDsDlg extends IDialog implements ItemListener { * */ private void init() { - this.setSize(500, 255); + this.setSize(500, 270); this.setContentPane(getJScrollPane()); this.setTitle("Pcd Coded"); initFrame(); @@ -292,6 +313,7 @@ public class PCDsDlg extends IDialog implements ItemListener { this.jComboBoxCName.setSelectedItem(id.getName()); this.jTextFieldTokenSpaceGuid.setText(id.getGuid()); this.jTextFieldDefaultValue.setText(id.getValue()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); this.jTextAreaHelpText.setText(id.getHelp()); this.jComboBoxItemType.setSelectedItem(id.getType()); this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); @@ -333,6 +355,9 @@ public class PCDsDlg extends IDialog implements ItemListener { */ private JPanel getJContentPane() { if (jContentPane == null) { + jLabelUsage = new JLabel(); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); + jLabelUsage.setText("Usge"); jStarLabel1 = new StarLabel(); jStarLabel1.setLocation(new java.awt.Point(2, 10)); jLabelC_Name = new JLabel(); @@ -350,14 +375,14 @@ public class PCDsDlg extends IDialog implements ItemListener { jLabelDefaultValue.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(2, 85)); + jStarLabel3.setLocation(new java.awt.Point(2, 110)); jLabelHelpText = new JLabel(); jLabelHelpText.setText("Help Text"); - jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); + jLabelHelpText.setBounds(new java.awt.Rectangle(15, 110, 145, 20)); jLabelFeatureFlag = new JLabel(); jLabelFeatureFlag.setText("Feature Flag Expression"); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 140, 20)); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 155, 140, 20)); jLabelTokenSpaceGuid = new JLabel(); jLabelTokenSpaceGuid.setText("Token Space C Name"); @@ -365,17 +390,17 @@ public class PCDsDlg extends IDialog implements ItemListener { jLabelArch = new JLabel(); jLabelArch.setText("Supported Architectures"); - jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); + jLabelArch.setBounds(new java.awt.Rectangle(15, 180, 145, 20)); jArchCheckBox = new ArchCheckBox(); jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 180, 320, 20)); // Hidden field jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); jContentPane = new JPanel(); jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 235)); jContentPane.add(jStarLabel1, null); jContentPane.add(jLabelC_Name, null); @@ -397,6 +422,8 @@ public class PCDsDlg extends IDialog implements ItemListener { jContentPane.add(jLabelTokenSpaceGuid, null); jContentPane.add(getJButtonOk(), null); jContentPane.add(getJButtonCancel(), null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxUsage(), null); } return jContentPane; } @@ -410,7 +437,7 @@ public class PCDsDlg extends IDialog implements ItemListener { jComboBoxCName.addItem(pcd.getPcd(index)); } - // Tools.generateComboBoxByVector(jComboBoxItemType, ed.getVPcdItemTypes()); + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPcdUsage()); } /* @@ -510,7 +537,12 @@ public class PCDsDlg extends IDialog implements ItemListener { String arg4 = this.jTextFieldDefaultValue.getText(); String arg5 = this.jTextAreaHelpText.getText(); String arg6 = this.jComboBoxItemType.getSelectedItem().toString(); - id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + String arg7 = this.jComboBoxUsage.getSelectedItem().toString(); + if (arg7.equals(DataType.EMPTY_SELECT_ITEM)) { + arg7 = ""; + } + + id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); return id; }