Fixed grammar in messages.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / ui / dialog / PCDsDlg.java
CommitLineData
06a19cee 1/** @file\r
2 \r
9e857952 3 The file is used to create, update PcdCode section of the MSA file\r
06a19cee 4 \r
5 Copyright (c) 2006, Intel Corporation\r
6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10 \r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13 \r
14 **/\r
15package org.tianocore.frameworkwizard.module.ui.dialog;\r
16\r
17import java.awt.event.ActionEvent;\r
9a8d6d9f 18import java.awt.event.ItemEvent;\r
19import java.awt.event.ItemListener;\r
06a19cee 20import java.util.Vector;\r
21\r
22import javax.swing.JButton;\r
23import javax.swing.JComboBox;\r
24import javax.swing.JLabel;\r
25import javax.swing.JPanel;\r
26import javax.swing.JScrollPane;\r
27import javax.swing.JTextField;\r
747e1504 28import javax.swing.JTextArea;\r
06a19cee 29\r
30import org.tianocore.frameworkwizard.common.DataType;\r
31import org.tianocore.frameworkwizard.common.DataValidation;\r
fd16c6d5 32import org.tianocore.frameworkwizard.common.EnumerationData;\r
06a19cee 33import org.tianocore.frameworkwizard.common.Log;\r
34import org.tianocore.frameworkwizard.common.Tools;\r
35import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;\r
36import org.tianocore.frameworkwizard.common.ui.IDialog;\r
37import org.tianocore.frameworkwizard.common.ui.IFrame;\r
38import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
39import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;\r
9a8d6d9f 40import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;\r
06a19cee 41import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
42\r
43/**\r
9e857952 44 * The class is used to create, update PcdCoded section of the MSA file\r
45 * \r
46 * It extends IDialog\r
5101eff9 47 * \r
48 */\r
9a8d6d9f 49public class PCDsDlg extends IDialog implements ItemListener {\r
06a19cee 50\r
a929458e 51 // /\r
52 // / Define class Serial Version UID\r
53 // /\r
54 private static final long serialVersionUID = 2227717658188438696L;\r
06a19cee 55\r
a929458e 56 //\r
57 // Define class members\r
58 //\r
59 private JPanel jContentPane = null;\r
06a19cee 60\r
a929458e 61 private JLabel jLabelItemType = null;\r
06a19cee 62\r
a929458e 63 private JLabel jLabelC_Name = null;\r
06a19cee 64\r
a929458e 65 private JComboBox jComboBoxItemType = null;\r
06a19cee 66\r
a929458e 67 private JComboBox jComboBoxCName = null;\r
06a19cee 68\r
a929458e 69 private JLabel jLabelDefaultValue = null;\r
06a19cee 70\r
a929458e 71 private JTextField jTextFieldDefaultValue = null;\r
06a19cee 72\r
a929458e 73 private StarLabel jStarLabel1 = null;\r
06a19cee 74\r
a929458e 75 private StarLabel jStarLabel2 = null;\r
06a19cee 76\r
a929458e 77 private StarLabel jStarLabel3 = null;\r
06a19cee 78\r
a929458e 79 private JLabel jLabelHelpText = null;\r
06a19cee 80\r
a929458e 81 private JTextArea jTextAreaHelpText = null;\r
06a19cee 82\r
a929458e 83 private JScrollPane jScrollPane = null;\r
06a19cee 84\r
a929458e 85 private JLabel jLabelTokenSpaceGuid = null;\r
06a19cee 86\r
a929458e 87 private JTextField jTextFieldTokenSpaceGuid = null;\r
06a19cee 88\r
a929458e 89 private JLabel jLabelFeatureFlag = null;\r
06a19cee 90\r
a929458e 91 private JTextField jTextFieldFeatureFlag = null;\r
06a19cee 92\r
a929458e 93 private JLabel jLabelArch = null;\r
06a19cee 94\r
a929458e 95 private ArchCheckBox jArchCheckBox = null;\r
06a19cee 96\r
a929458e 97 private JButton jButtonOk = null;\r
06a19cee 98\r
a929458e 99 private JButton jButtonCancel = null;\r
06a19cee 100\r
a929458e 101 private JScrollPane jScrollPaneHelpText = null;\r
9e857952 102\r
fd16c6d5 103 private JLabel jLabelUsage = null;\r
104\r
105 private JComboBox jComboBoxUsage = null;\r
06a19cee 106\r
a929458e 107 //\r
108 // Not used by UI\r
109 //\r
110 private PcdCodedIdentification id = null;\r
9e857952 111\r
fd16c6d5 112 private EnumerationData ed = new EnumerationData();\r
a929458e 113\r
114 private WorkspaceTools wt = new WorkspaceTools();\r
115\r
116 private PcdVector pcd = wt.getAllPcdDeclarationsFromWorkspace();\r
117\r
118 /**\r
119 * This method initializes jComboBoxItemType\r
120 * \r
121 * @return javax.swing.JComboBox jComboBoxItemType\r
122 * \r
123 */\r
124 private JComboBox getJComboBoxItemType() {\r
125 if (jComboBoxItemType == null) {\r
126 jComboBoxItemType = new JComboBox();\r
3f62225f 127 jComboBoxItemType.setBounds(new java.awt.Rectangle(168, 37, 320, 20));\r
a929458e 128 jComboBoxItemType.setPreferredSize(new java.awt.Dimension(320, 20));\r
129 }\r
130 return jComboBoxItemType;\r
131 }\r
747e1504 132\r
a929458e 133 /**\r
134 * This method initializes jTextFieldC_Name\r
135 * \r
136 * @return javax.swing.JTextField jTextFieldC_Name\r
137 * \r
138 */\r
139 private JComboBox getJComboBoxCName() {\r
140 if (jComboBoxCName == null) {\r
141 jComboBoxCName = new JComboBox();\r
3f62225f 142 jComboBoxCName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));\r
a929458e 143 jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));\r
144 jComboBoxCName.addItemListener(this);\r
145 }\r
146 return jComboBoxCName;\r
06a19cee 147 }\r
a929458e 148\r
149 /**\r
150 * This method initializes jTextFieldDefaultValue\r
151 * \r
152 * @return javax.swing.JTextField jTextFieldDefaultValue\r
153 * \r
154 */\r
155 private JTextField getJTextFieldDefaultValue() {\r
156 if (jTextFieldDefaultValue == null) {\r
157 jTextFieldDefaultValue = new JTextField();\r
3f62225f 158 jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(168, 62, 320, 20));\r
a929458e 159 jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(320, 20));\r
160 }\r
161 return jTextFieldDefaultValue;\r
06a19cee 162 }\r
a929458e 163\r
164 /**\r
165 * This method initializes jTextAreaHelpText\r
166 * \r
167 * @return javax.swing.JTextArea\r
168 */\r
169 private JTextArea getJTextAreaHelpText() {\r
170 if (jTextAreaHelpText == null) {\r
171 jTextAreaHelpText = new JTextArea();\r
172 jTextAreaHelpText.setLineWrap(true);\r
173 jTextAreaHelpText.setWrapStyleWord(true);\r
174 }\r
175 return jTextAreaHelpText;\r
06a19cee 176 }\r
a929458e 177\r
178 /**\r
179 * This method initializes jScrollPaneHelpText\r
180 * \r
181 * @return javax.swing.JScrollPane\r
182 * \r
183 */\r
184 private JScrollPane getJScrollPaneHelpText() {\r
185 if (jScrollPaneHelpText == null) {\r
186 jScrollPaneHelpText = new JScrollPane();\r
187 jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
188 jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));\r
189 jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));\r
3f62225f 190 jScrollPaneHelpText.setLocation(new java.awt.Point(168, 112));\r
a929458e 191 jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());\r
192 }\r
193 return jScrollPaneHelpText;\r
06a19cee 194 }\r
a929458e 195\r
196 /**\r
197 * This method initializes jScrollPane\r
198 * \r
199 * @return javax.swing.JScrollPane\r
200 */\r
201 private JScrollPane getJScrollPane() {\r
202 if (jScrollPane == null) {\r
203 jScrollPane = new JScrollPane();\r
204 jScrollPane.setViewportView(getJContentPane());\r
205 }\r
206 return jScrollPane;\r
06a19cee 207 }\r
a929458e 208\r
209 /**\r
210 * This method initializes jTextFieldTokenSpaceGuid\r
211 * \r
212 * @return javax.swing.JTextField\r
213 */\r
214 private JTextField getJTextFieldTokenSpaceGuid() {\r
215 if (jTextFieldTokenSpaceGuid == null) {\r
216 jTextFieldTokenSpaceGuid = new JTextField();\r
3f62225f 217 jTextFieldTokenSpaceGuid.setBounds(new java.awt.Rectangle(168, 62, 320, 20));\r
a929458e 218 jTextFieldTokenSpaceGuid.setPreferredSize(new java.awt.Dimension(320, 20));\r
219 jTextFieldTokenSpaceGuid.setVisible(false);\r
220 }\r
221 return jTextFieldTokenSpaceGuid;\r
06a19cee 222 }\r
a929458e 223\r
224 /**\r
225 * This method initializes jTextFieldFeatureFlag\r
226 * \r
227 * @return javax.swing.JTextField\r
228 */\r
229 private JTextField getJTextFieldFeatureFlag() {\r
230 if (jTextFieldFeatureFlag == null) {\r
231 jTextFieldFeatureFlag = new JTextField();\r
21b42c66 232 jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 182, 320, 20));\r
a929458e 233 jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r
234 jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");\r
21b42c66 235 jTextFieldFeatureFlag.setEnabled(false);\r
a929458e 236 }\r
237 return jTextFieldFeatureFlag;\r
06a19cee 238 }\r
a929458e 239\r
240 /**\r
241 * This method initializes jButtonOk\r
242 * \r
243 * @return javax.swing.JButton\r
244 * \r
245 */\r
246 private JButton getJButtonOk() {\r
247 if (jButtonOk == null) {\r
248 jButtonOk = new JButton();\r
3f62225f 249 jButtonOk.setBounds(new java.awt.Rectangle(290, 212, 90, 20));\r
a929458e 250 jButtonOk.setText("Ok");\r
251 jButtonOk.addActionListener(this);\r
252 }\r
253 return jButtonOk;\r
06a19cee 254 }\r
a929458e 255\r
256 /**\r
257 * This method initializes jButtonCancel\r
258 * \r
259 * @return javax.swing.JButton\r
260 * \r
261 */\r
262 private JButton getJButtonCancel() {\r
263 if (jButtonCancel == null) {\r
264 jButtonCancel = new JButton();\r
3f62225f 265 jButtonCancel.setBounds(new java.awt.Rectangle(390, 212, 90, 20));\r
a929458e 266 jButtonCancel.setText("Cancel");\r
267 jButtonCancel.addActionListener(this);\r
268 }\r
269 return jButtonCancel;\r
06a19cee 270 }\r
a929458e 271\r
fd16c6d5 272 /**\r
273 * This method initializes jComboBoxUsage \r
274 * \r
275 * @return javax.swing.JComboBox \r
276 */\r
277 private JComboBox getJComboBoxUsage() {\r
278 if (jComboBoxUsage == null) {\r
279 jComboBoxUsage = new JComboBox();\r
3f62225f 280 jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 87, 320, 20));\r
fd16c6d5 281 jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));\r
282 }\r
283 return jComboBoxUsage;\r
284 }\r
285\r
a929458e 286 public static void main(String[] args) {\r
287\r
06a19cee 288 }\r
a929458e 289\r
290 /**\r
291 * This method initializes this\r
292 * \r
293 */\r
294 private void init() {\r
3f62225f 295 this.setSize(505, 280);\r
a929458e 296 this.setContentPane(getJScrollPane());\r
297 this.setTitle("Pcd Coded");\r
298 initFrame();\r
299 this.setViewMode(false);\r
300 this.centerWindow();\r
06a19cee 301 }\r
a929458e 302\r
303 /**\r
304 * This method initializes this Fill values to all fields if these values are\r
305 * not empty\r
306 * \r
307 * @param inPcdCodedId\r
308 * \r
309 */\r
310 private void init(PcdCodedIdentification inPcdCodedId) {\r
311 init();\r
312 this.id = inPcdCodedId;\r
313\r
314 if (this.id != null) {\r
74c0c087 315 for (int index = 0; index < this.jComboBoxCName.getItemCount(); index++) {\r
316 if (this.jComboBoxCName.getItemAt(index).toString().equals(id.getName())) {\r
317 this.jComboBoxCName.setSelectedIndex(index);\r
318 break;\r
319 }\r
320 }\r
a929458e 321 this.jTextFieldTokenSpaceGuid.setText(id.getGuid());\r
322 this.jTextFieldDefaultValue.setText(id.getValue());\r
fd16c6d5 323 this.jComboBoxUsage.setSelectedItem(id.getUsage());\r
a929458e 324 this.jTextAreaHelpText.setText(id.getHelp());\r
325 this.jComboBoxItemType.setSelectedItem(id.getType());\r
326 this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());\r
327 this.jArchCheckBox.setSelectedItems(id.getSupArchList());\r
328 }\r
06a19cee 329 }\r
a929458e 330\r
331 /**\r
332 * This is the override edit constructor\r
333 * \r
334 * @param inPcdCodedId\r
335 * @param iFrame\r
336 * \r
337 */\r
338 public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame) {\r
339 super(iFrame, true);\r
340 init(inPcdCodedId);\r
5101eff9 341 }\r
a929458e 342\r
343 /**\r
344 * Disable all components when the mode is view\r
345 * \r
346 * @param isView\r
347 * true - The view mode; false - The non-view mode\r
348 * \r
349 */\r
350 public void setViewMode(boolean isView) {\r
351 if (isView) {\r
352 this.jTextFieldDefaultValue.setEnabled(!isView);\r
353 this.jComboBoxItemType.setEnabled(!isView);\r
354 }\r
06a19cee 355 }\r
356\r
a929458e 357 /**\r
358 * This method initializes jContentPane\r
359 * \r
360 * @return javax.swing.JPanel jContentPane\r
361 * \r
362 */\r
363 private JPanel getJContentPane() {\r
364 if (jContentPane == null) {\r
fd16c6d5 365 jLabelUsage = new JLabel();\r
3f62225f 366 jLabelUsage.setBounds(new java.awt.Rectangle(12, 87, 168, 20));\r
fd16c6d5 367 jLabelUsage.setText("Usge");\r
a929458e 368 jStarLabel1 = new StarLabel();\r
3f62225f 369 jStarLabel1.setLocation(new java.awt.Point(2, 12));\r
a929458e 370 jLabelC_Name = new JLabel();\r
371 jLabelC_Name.setText("PCD C Name");\r
3f62225f 372 jLabelC_Name.setBounds(new java.awt.Rectangle(12, 12, 168, 20));\r
a929458e 373\r
374 jStarLabel2 = new StarLabel();\r
3f62225f 375 jStarLabel2.setLocation(new java.awt.Point(2, 37));\r
a929458e 376 jLabelItemType = new JLabel();\r
377 jLabelItemType.setText("PCD Item Type");\r
3f62225f 378 jLabelItemType.setBounds(new java.awt.Rectangle(12, 37, 168, 20));\r
a929458e 379\r
380 jLabelDefaultValue = new JLabel();\r
381 jLabelDefaultValue.setText("Default Value");\r
3f62225f 382 jLabelDefaultValue.setBounds(new java.awt.Rectangle(12, 62, 168, 20));\r
a929458e 383\r
384 jStarLabel3 = new StarLabel();\r
3f62225f 385 jStarLabel3.setLocation(new java.awt.Point(2, 112));\r
a929458e 386 jLabelHelpText = new JLabel();\r
387 jLabelHelpText.setText("Help Text");\r
3f62225f 388 jLabelHelpText.setBounds(new java.awt.Rectangle(12, 112, 168, 20));\r
a929458e 389\r
390 jLabelFeatureFlag = new JLabel();\r
391 jLabelFeatureFlag.setText("Feature Flag Expression");\r
21b42c66 392 jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 182, 168, 20));\r
393 jLabelFeatureFlag.setEnabled(false);\r
a929458e 394\r
395 jLabelTokenSpaceGuid = new JLabel();\r
396 jLabelTokenSpaceGuid.setText("Token Space C Name");\r
397 jLabelTokenSpaceGuid.setVisible(false);\r
398\r
399 jLabelArch = new JLabel();\r
400 jLabelArch.setText("Supported Architectures");\r
21b42c66 401 jLabelArch.setBounds(new java.awt.Rectangle(12, 157, 168, 20));\r
a929458e 402 jArchCheckBox = new ArchCheckBox();\r
403 jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));\r
21b42c66 404 jArchCheckBox.setBounds(new java.awt.Rectangle(168, 157, 320, 20));\r
a929458e 405\r
406 // Hidden field\r
3f62225f 407 jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(12, 62, 140, 20));\r
a929458e 408\r
409 jContentPane = new JPanel();\r
410 jContentPane.setLayout(null);\r
fd16c6d5 411 jContentPane.setPreferredSize(new java.awt.Dimension(485, 235));\r
a929458e 412\r
413 jContentPane.add(jStarLabel1, null);\r
414 jContentPane.add(jLabelC_Name, null);\r
415 jContentPane.add(getJComboBoxCName(), null);\r
416 jContentPane.add(jStarLabel2, null);\r
417 jContentPane.add(jLabelItemType, null);\r
418 jContentPane.add(getJComboBoxItemType(), null);\r
419 jContentPane.add(jLabelDefaultValue, null);\r
420 jContentPane.add(getJTextFieldDefaultValue(), null);\r
421 jContentPane.add(jStarLabel3, null);\r
422 jContentPane.add(jLabelHelpText, null);\r
423 jContentPane.add(getJScrollPaneHelpText(), null);\r
424 jContentPane.add(jLabelFeatureFlag, null);\r
425 jContentPane.add(getJTextFieldFeatureFlag(), null);\r
426 jContentPane.add(jLabelArch, null);\r
427 jContentPane.add(jArchCheckBox, null);\r
428 // Hidden\r
429 jContentPane.add(getJTextFieldTokenSpaceGuid(), null);\r
430 jContentPane.add(jLabelTokenSpaceGuid, null);\r
431 jContentPane.add(getJButtonOk(), null);\r
432 jContentPane.add(getJButtonCancel(), null);\r
fd16c6d5 433 jContentPane.add(jLabelUsage, null);\r
434 jContentPane.add(getJComboBoxUsage(), null);\r
a929458e 435 }\r
436 return jContentPane;\r
06a19cee 437 }\r
438\r
a929458e 439 /**\r
440 * This method initializes Usage type, Item type and Datum type\r
441 * \r
442 */\r
443 private void initFrame() {\r
444 for (int index = 0; index < pcd.size(); index++) {\r
445 jComboBoxCName.addItem(pcd.getPcd(index));\r
446 }\r
447\r
fd16c6d5 448 Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPcdUsage());\r
06a19cee 449 }\r
450\r
a929458e 451 /*\r
452 * (non-Javadoc)\r
453 * \r
454 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
455 * \r
456 * Override actionPerformed to listen all actions\r
457 * \r
458 */\r
459 public void actionPerformed(ActionEvent arg0) {\r
460 if (arg0.getSource() == jButtonOk) {\r
461 if (checkAdd()) {\r
462 getCurrentPcdCoded();\r
463 this.returnType = DataType.RETURN_TYPE_OK;\r
464 this.setVisible(false);\r
465 }\r
466 }\r
467\r
468 if (arg0.getSource() == jButtonCancel) {\r
469 this.returnType = DataType.RETURN_TYPE_CANCEL;\r
470 this.setVisible(false);\r
471 }\r
5101eff9 472 }\r
06a19cee 473\r
a929458e 474 /**\r
475 * Data validation for all fields\r
476 * \r
477 * @retval true - All datas are valid\r
478 * @retval false - At least one data is invalid\r
479 * \r
480 */\r
481 public boolean checkAdd() {\r
482 //\r
483 // Check if all fields have correct data types\r
484 //\r
485\r
486 //\r
487 // Check C_Name\r
488 //\r
489 if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {\r
490 if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {\r
491 Log.wrn("Update PcdCoded", "Incorrect data type for C Name");\r
492 return false;\r
493 }\r
494 }\r
495\r
496 //\r
497 // Check TokenSpaceGuid\r
498 //\r
499 if (!isEmpty(this.jTextFieldTokenSpaceGuid.getText())) {\r
500 if (!DataValidation.isC_NameType(this.jTextFieldTokenSpaceGuid.getText())) {\r
501 Log.wrn("Update PcdCoded",\r
623db5ca 502 "Incorrect data type for the selected pcd entry, please check the datatype specified in the spd file");\r
a929458e 503 return false;\r
504 }\r
505 }\r
506\r
507 //\r
508 // Check DefaultValue\r
509 //\r
510 if (!isEmpty(this.jTextFieldDefaultValue.getText())) {\r
511 if (!DataValidation.isDefaultValueType(this.jTextFieldDefaultValue.getText())) {\r
512 Log.wrn("Update PcdCoded", "Incorrect data type for Default Value");\r
513 return false;\r
514 }\r
515 }\r
516\r
517 //\r
518 // Check HelpText\r
519 //\r
520 if (isEmpty(this.jTextAreaHelpText.getText())) {\r
521 Log.wrn("Update PcdCoded", "Help Text should not be empty");\r
522 return false;\r
523 }\r
524\r
525 //\r
526 // Check FeatureFlag\r
527 //\r
528 if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {\r
529 if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {\r
530 Log.wrn("Update PcdCoded", "Incorrect data type for Feature Flag");\r
531 return false;\r
532 }\r
533 }\r
534\r
535 return true;\r
5101eff9 536 }\r
06a19cee 537\r
a929458e 538 private PcdCodedIdentification getCurrentPcdCoded() {\r
539 String arg0 = this.jComboBoxCName.getSelectedItem().toString();\r
540 String arg1 = this.jTextFieldTokenSpaceGuid.getText();\r
541\r
542 String arg2 = this.jTextFieldFeatureFlag.getText();\r
543 Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();\r
544\r
545 String arg4 = this.jTextFieldDefaultValue.getText();\r
546 String arg5 = this.jTextAreaHelpText.getText();\r
547 String arg6 = this.jComboBoxItemType.getSelectedItem().toString();\r
fd16c6d5 548 String arg7 = this.jComboBoxUsage.getSelectedItem().toString();\r
549 if (arg7.equals(DataType.EMPTY_SELECT_ITEM)) {\r
550 arg7 = "";\r
551 }\r
552\r
553 id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);\r
a929458e 554 return id;\r
06a19cee 555 }\r
556\r
a929458e 557 public PcdCodedIdentification getId() {\r
558 return id;\r
06a19cee 559 }\r
560\r
a929458e 561 public void setId(PcdCodedIdentification id) {\r
562 this.id = id;\r
06a19cee 563 }\r
9a8d6d9f 564\r
a929458e 565 /*\r
566 * (non-Javadoc)\r
567 * \r
568 * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)\r
569 * \r
570 * Reflesh the frame when selected item changed\r
571 * \r
572 */\r
573 public void itemStateChanged(ItemEvent arg0) {\r
574 int index = this.jComboBoxCName.getSelectedIndex();\r
575 if (arg0.getSource() == this.jComboBoxCName && arg0.getStateChange() == ItemEvent.SELECTED) {\r
576 if (pcd.getPcd(index).getGuidCName() == null || isEmpty(pcd.getPcd(index).getGuidCName())\r
577 || pcd.getPcd(index).getType() == null || pcd.getPcd(index).getHelp() == null\r
578 || isEmpty(pcd.getPcd(index).getHelp())) {\r
579 Log.wrn("select pcd entry when editing msa",\r
623db5ca 580 "The selected value is defined incorrectly.\r\nPlease check it in the spd file");\r
a929458e 581 } else {\r
582 this.jTextFieldTokenSpaceGuid.setText(pcd.getPcd(index).getGuidCName());\r
583 Tools.generateComboBoxByVector(this.jComboBoxItemType, pcd.getPcd(index).getType());\r
584 this.jTextAreaHelpText.setText(pcd.getPcd(index).getHelp());\r
585 this.jTextAreaHelpText.setSelectionStart(0);\r
586 this.jTextAreaHelpText.setSelectionEnd(0);\r
587 }\r
588 }\r
9a8d6d9f 589 }\r
06a19cee 590}\r