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
This commit is contained in:
hche10x 2006-07-28 08:17:32 +00:00
parent eb227e96bd
commit fd16c6d5d4
5 changed files with 89 additions and 17 deletions

View File

@ -169,6 +169,8 @@ public class EnumerationData {
// //
public Vector<String> vPcdItemTypes = new Vector<String>(); public Vector<String> vPcdItemTypes = new Vector<String>();
public Vector<String> vPcdUsage = new Vector<String>();
public EnumerationData() { public EnumerationData() {
init(); init();
} }
@ -280,7 +282,7 @@ public class EnumerationData {
// Used by Pcd // Used by Pcd
// //
initPcdItemTypes(); initPcdItemTypes();
initPcdUsage();
} }
private void initEnabled() { private void initEnabled() {
@ -702,6 +704,16 @@ public class EnumerationData {
vPcdItemTypes.addElement("DYNAMIC_EX"); 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<String> getvCompontentType() { public Vector<String> getvCompontentType() {
return vCompontentType; return vCompontentType;
} }
@ -1033,4 +1045,12 @@ public class EnumerationData {
public void setVToolCode(Vector<String> toolCode) { public void setVToolCode(Vector<String> toolCode) {
vToolCode = toolCode; vToolCode = toolCode;
} }
public Vector<String> getVPcdUsage() {
return vPcdUsage;
}
public void setVPcdUsage(Vector<String> pcdUsage) {
vPcdUsage = pcdUsage;
}
} }

View File

@ -36,7 +36,9 @@ public class PcdCodedIdentification {
private String type = null; private String type = null;
public PcdCodedIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4, String arg5, String arg6) { private String usage = null;
public PcdCodedIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4, String arg5, String arg6, String arg7) {
this.name = (arg0 == null ? "" : arg0); this.name = (arg0 == null ? "" : arg0);
this.guid = (arg1 == null ? "" : arg1); this.guid = (arg1 == null ? "" : arg1);
this.featureFlag = (arg2 == null ? "" : arg2); this.featureFlag = (arg2 == null ? "" : arg2);
@ -44,6 +46,7 @@ public class PcdCodedIdentification {
this.value = (arg4 == null ? "" : arg4); this.value = (arg4 == null ? "" : arg4);
this.help = (arg5 == null ? "" : arg5); this.help = (arg5 == null ? "" : arg5);
this.type = (arg6 == null ? "" : arg6); this.type = (arg6 == null ? "" : arg6);
this.usage = (arg7 == null ? "" : arg7);
} }
public String getFeatureFlag() { public String getFeatureFlag() {
@ -108,4 +111,12 @@ public class PcdCodedIdentification {
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
} }
public String getUsage() {
return usage;
}
public void setUsage(String usage) {
this.usage = usage;
}
} }

View File

@ -92,6 +92,7 @@ public class PcdCodedVector {
v.addElement(getPcdCoded(index).getName()); v.addElement(getPcdCoded(index).getName());
v.addElement(getPcdCoded(index).getType()); v.addElement(getPcdCoded(index).getType());
v.addElement(getPcdCoded(index).getValue()); v.addElement(getPcdCoded(index).getValue());
v.addElement(getPcdCoded(index).getUsage());
return v; return v;
} }
} }

View File

@ -29,6 +29,7 @@ import javax.swing.event.ListSelectionEvent;
import org.tianocore.PcdCodedDocument; import org.tianocore.PcdCodedDocument;
import org.tianocore.PcdItemTypes; import org.tianocore.PcdItemTypes;
import org.tianocore.PcdUsage;
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea; import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
import org.tianocore.PcdCodedDocument.PcdCoded; import org.tianocore.PcdCodedDocument.PcdCoded;
import org.tianocore.PcdCodedDocument.PcdCoded.PcdEntry; import org.tianocore.PcdCodedDocument.PcdCoded.PcdEntry;
@ -185,6 +186,7 @@ public class ModulePCDs extends IInternalFrame {
model.addColumn("Name"); model.addColumn("Name");
model.addColumn("Type"); model.addColumn("Type");
model.addColumn("Value"); model.addColumn("Value");
model.addColumn("Usage");
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTable.getSelectionModel().addListSelectionListener(this); jTable.getSelectionModel().addListSelectionListener(this);
@ -234,8 +236,11 @@ public class ModulePCDs extends IInternalFrame {
if (pcds.getPcdEntryList().get(index).getPcdItemType() != null) { if (pcds.getPcdEntryList().get(index).getPcdItemType() != null) {
arg6 = pcds.getPcdEntryList().get(index).getPcdItemType().toString(); arg6 = pcds.getPcdEntryList().get(index).getPcdItemType().toString();
} }
String arg7 = null;
id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6); 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); vid.addPcdCoded(id);
} }
} }
@ -400,6 +405,9 @@ public class ModulePCDs extends IInternalFrame {
if (!isEmpty(vid.getPcdCoded(index).getType())) { if (!isEmpty(vid.getPcdCoded(index).getType())) {
p.setPcdItemType(PcdItemTypes.Enum.forString(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.addNewPcdEntry();
this.pcds.setPcdEntryArray(pcds.getPcdEntryList().size() - 1, p); this.pcds.setPcdEntryArray(pcds.getPcdEntryList().size() - 1, p);
} }

View File

@ -29,6 +29,7 @@ import javax.swing.JTextArea;
import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.EnumerationData;
import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Log;
import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.ui.ArchCheckBox; import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
@ -98,11 +99,17 @@ public class PCDsDlg extends IDialog implements ItemListener {
private JScrollPane jScrollPaneHelpText = null; private JScrollPane jScrollPaneHelpText = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
// //
// Not used by UI // Not used by UI
// //
private PcdCodedIdentification id = null; private PcdCodedIdentification id = null;
private EnumerationData ed = new EnumerationData();
private WorkspaceTools wt = new WorkspaceTools(); private WorkspaceTools wt = new WorkspaceTools();
private PcdVector pcd = wt.getAllPcdDeclarationsFromWorkspace(); private PcdVector pcd = wt.getAllPcdDeclarationsFromWorkspace();
@ -179,7 +186,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
jScrollPaneHelpText.setPreferredSize(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()); jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
} }
return jScrollPaneHelpText; return jScrollPaneHelpText;
@ -221,7 +228,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
private JTextField getJTextFieldFeatureFlag() { private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) { if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField(); 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.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); 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() { private JButton getJButtonOk() {
if (jButtonOk == null) { if (jButtonOk == null) {
jButtonOk = new JButton(); 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.setText("Ok");
jButtonOk.addActionListener(this); jButtonOk.addActionListener(this);
} }
@ -253,13 +260,27 @@ public class PCDsDlg extends IDialog implements ItemListener {
private JButton getJButtonCancel() { private JButton getJButtonCancel() {
if (jButtonCancel == null) { if (jButtonCancel == null) {
jButtonCancel = new JButton(); 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.setText("Cancel");
jButtonCancel.addActionListener(this); jButtonCancel.addActionListener(this);
} }
return jButtonCancel; 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) { public static void main(String[] args) {
} }
@ -269,7 +290,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
* *
*/ */
private void init() { private void init() {
this.setSize(500, 255); this.setSize(500, 270);
this.setContentPane(getJScrollPane()); this.setContentPane(getJScrollPane());
this.setTitle("Pcd Coded"); this.setTitle("Pcd Coded");
initFrame(); initFrame();
@ -292,6 +313,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
this.jComboBoxCName.setSelectedItem(id.getName()); this.jComboBoxCName.setSelectedItem(id.getName());
this.jTextFieldTokenSpaceGuid.setText(id.getGuid()); this.jTextFieldTokenSpaceGuid.setText(id.getGuid());
this.jTextFieldDefaultValue.setText(id.getValue()); this.jTextFieldDefaultValue.setText(id.getValue());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp()); this.jTextAreaHelpText.setText(id.getHelp());
this.jComboBoxItemType.setSelectedItem(id.getType()); this.jComboBoxItemType.setSelectedItem(id.getType());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
@ -333,6 +355,9 @@ public class PCDsDlg extends IDialog implements ItemListener {
*/ */
private JPanel getJContentPane() { private JPanel getJContentPane() {
if (jContentPane == null) { if (jContentPane == null) {
jLabelUsage = new JLabel();
jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
jLabelUsage.setText("Usge");
jStarLabel1 = new StarLabel(); jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10)); jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelC_Name = new JLabel(); 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)); jLabelDefaultValue.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jStarLabel3 = new StarLabel(); jStarLabel3 = new StarLabel();
jStarLabel3.setLocation(new java.awt.Point(2, 85)); jStarLabel3.setLocation(new java.awt.Point(2, 110));
jLabelHelpText = new JLabel(); jLabelHelpText = new JLabel();
jLabelHelpText.setText("Help Text"); 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 = new JLabel();
jLabelFeatureFlag.setText("Feature Flag Expression"); 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 = new JLabel();
jLabelTokenSpaceGuid.setText("Token Space C Name"); jLabelTokenSpaceGuid.setText("Token Space C Name");
@ -365,17 +390,17 @@ public class PCDsDlg extends IDialog implements ItemListener {
jLabelArch = new JLabel(); jLabelArch = new JLabel();
jLabelArch.setText("Supported Architectures"); 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 = new ArchCheckBox();
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); 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 // Hidden field
jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
jContentPane = new JPanel(); jContentPane = new JPanel();
jContentPane.setLayout(null); 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(jStarLabel1, null);
jContentPane.add(jLabelC_Name, null); jContentPane.add(jLabelC_Name, null);
@ -397,6 +422,8 @@ public class PCDsDlg extends IDialog implements ItemListener {
jContentPane.add(jLabelTokenSpaceGuid, null); jContentPane.add(jLabelTokenSpaceGuid, null);
jContentPane.add(getJButtonOk(), null); jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null); jContentPane.add(getJButtonCancel(), null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
} }
return jContentPane; return jContentPane;
} }
@ -410,7 +437,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
jComboBoxCName.addItem(pcd.getPcd(index)); 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 arg4 = this.jTextFieldDefaultValue.getText();
String arg5 = this.jTextAreaHelpText.getText(); String arg5 = this.jTextAreaHelpText.getText();
String arg6 = this.jComboBoxItemType.getSelectedItem().toString(); 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; return id;
} }