3 The file is used to create, update Externs section of the MSA file
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.module
.ui
.dialog
;
17 import java
.awt
.event
.ActionEvent
;
18 import java
.awt
.event
.ItemEvent
;
19 import java
.awt
.event
.ItemListener
;
20 import java
.util
.Vector
;
22 import javax
.swing
.JButton
;
23 import javax
.swing
.JComboBox
;
24 import javax
.swing
.JLabel
;
25 import javax
.swing
.JPanel
;
26 import javax
.swing
.JScrollPane
;
27 import javax
.swing
.JTextField
;
29 import org
.tianocore
.frameworkwizard
.common
.DataType
;
30 import org
.tianocore
.frameworkwizard
.common
.DataValidation
;
31 import org
.tianocore
.frameworkwizard
.common
.EnumerationData
;
32 import org
.tianocore
.frameworkwizard
.common
.Log
;
33 import org
.tianocore
.frameworkwizard
.common
.Tools
;
34 import org
.tianocore
.frameworkwizard
.common
.ui
.ArchCheckBox
;
35 import org
.tianocore
.frameworkwizard
.common
.ui
.IDialog
;
36 import org
.tianocore
.frameworkwizard
.common
.ui
.IFrame
;
37 import org
.tianocore
.frameworkwizard
.common
.ui
.StarLabel
;
38 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
39 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Externs
.ExternsIdentification
;
40 import org
.tianocore
.frameworkwizard
.workspace
.WorkspaceTools
;
43 * The class is used to create, update Externs section of the MSA file
48 public class ExternsDlg
extends IDialog
implements ItemListener
{
51 /// Define class Serial Version UID
53 private static final long serialVersionUID
= -7382008402932047191L;
56 //Define class members
58 private JPanel jContentPane
= null;
60 private JLabel jLabelName
= null;
62 private JComboBox jComboBoxType
= null;
64 private JScrollPane jScrollPane
= null;
66 private JLabel jLabelSpecification
= null;
68 private JTextField jTextFieldSpecification
= null;
70 private JLabel jLabelFeatureFlag
= null;
72 private JLabel jLabelArch
= null;
74 private JTextField jTextFieldFeatureFlag
= null;
76 private ArchCheckBox jArchCheckBox
= null;
78 private JButton jButtonOk
= null;
80 private JButton jButtonCancel
= null;
82 private StarLabel jStarLabel1
= null;
84 private JPanel jPanelSpecification
= null;
86 private JPanel jPanelImage
= null;
88 private JPanel jPanelDriver
= null;
90 private JPanel jPanelLibrary
= null;
92 private JPanel jPanelCallBack
= null;
94 private JLabel jLabelModuleEntryPoint
= null;
96 private JTextField jTextFieldModuleEntryPoint
= null;
98 private JLabel jLabelModuleUnloadImage
= null;
100 private JTextField jTextFieldModuleUnloadImage
= null;
102 private JLabel jLabelDriverBinding
= null;
104 private JTextField jTextFieldDriverBinding
= null;
106 private JLabel jLabelComponentName
= null;
108 private JTextField jTextFieldComponentName
= null;
110 private JLabel jLabelDriverConfig
= null;
112 private JTextField jTextFieldDriverConfig
= null;
114 private JLabel jLabelDriverDiagnostic
= null;
116 private JTextField jTextFieldDriverDiagnostic
= null;
118 private JLabel jLabelConstructor
= null;
120 private JTextField jTextFieldConstructor
= null;
122 private JLabel jLabelDestructor
= null;
124 private JTextField jTextFieldDestructor
= null;
126 private JLabel jLabelVirtualAddressMap
= null;
128 private JTextField jTextFieldVirtualAddressMap
= null;
130 private JLabel jLabelExitBootServices
= null;
132 private JTextField jTextFieldExitBootServices
= null;
137 private ExternsIdentification id
= null;
139 private EnumerationData ed
= new EnumerationData();
141 private WorkspaceTools wt
= new WorkspaceTools();
143 private Vector
<String
> vArchList
= new Vector
<String
>();
146 This method initializes jComboBoxType
148 @return javax.swing.JComboBox jComboBoxType
151 private JComboBox
getJComboBoxType() {
152 if (jComboBoxType
== null) {
153 jComboBoxType
= new JComboBox();
154 jComboBoxType
.setBounds(new java
.awt
.Rectangle(168, 12, 320, 20));
155 jComboBoxType
.setPreferredSize(new java
.awt
.Dimension(320, 20));
156 jComboBoxType
.addItemListener(this);
158 return jComboBoxType
;
162 This method initializes jScrollPane
164 @return javax.swing.JScrollPane
166 private JScrollPane
getJScrollPane() {
167 if (jScrollPane
== null) {
168 jScrollPane
= new JScrollPane();
169 jScrollPane
.setViewportView(getJContentPane());
175 This method initializes jTextFieldC_Name
177 @return javax.swing.JTextField
180 private JTextField
getJTextFieldSpecification() {
181 if (jTextFieldSpecification
== null) {
182 jTextFieldSpecification
= new JTextField();
183 jTextFieldSpecification
.setPreferredSize(new java
.awt
.Dimension(320, 20));
184 jTextFieldSpecification
.setBounds(new java
.awt
.Rectangle(168, 0, 320, 20));
186 return jTextFieldSpecification
;
190 This method initializes jTextFieldFeatureFlag
192 @return javax.swing.JTextField
195 private JTextField
getJTextFieldFeatureFlag() {
196 if (jTextFieldFeatureFlag
== null) {
197 jTextFieldFeatureFlag
= new JTextField();
198 jTextFieldFeatureFlag
.setBounds(new java
.awt
.Rectangle(168, 87, 320, 20));
199 jTextFieldFeatureFlag
.setPreferredSize(new java
.awt
.Dimension(320, 20));
200 jTextFieldFeatureFlag
.setEnabled(false);
202 return jTextFieldFeatureFlag
;
206 This method initializes jButtonOk
208 @return javax.swing.JButton
211 private JButton
getJButtonOk() {
212 if (jButtonOk
== null) {
213 jButtonOk
= new JButton();
214 jButtonOk
.setBounds(new java
.awt
.Rectangle(300, 187, 90, 20));
215 jButtonOk
.setText("Ok");
216 jButtonOk
.addActionListener(this);
222 This method initializes jButtonCancel
224 @return javax.swing.JButton
227 private JButton
getJButtonCancel() {
228 if (jButtonCancel
== null) {
229 jButtonCancel
= new JButton();
230 jButtonCancel
.setBounds(new java
.awt
.Rectangle(400, 187, 90, 20));
231 jButtonCancel
.setText("Cancel");
232 jButtonCancel
.addActionListener(this);
234 return jButtonCancel
;
238 * This method initializes jPanelSpecification
240 * @return javax.swing.JPanel
242 private JPanel
getJPanelSpecification() {
243 if (jPanelSpecification
== null) {
244 jPanelSpecification
= new JPanel();
245 jPanelSpecification
.setBounds(new java
.awt
.Rectangle(0, 37, 505, 20));
246 jPanelSpecification
.setLayout(null);
248 jLabelSpecification
= new JLabel();
249 jLabelSpecification
.setBounds(new java
.awt
.Rectangle(12, 0, 140, 20));
250 jLabelSpecification
.setText("Specification Name");
252 jPanelSpecification
.add(jLabelSpecification
, null);
253 jPanelSpecification
.add(getJTextFieldSpecification(), null);
255 return jPanelSpecification
;
259 * This method initializes jPanelImage
261 * @return javax.swing.JPanel
263 private JPanel
getJPanelImage() {
264 if (jPanelImage
== null) {
265 jLabelModuleUnloadImage
= new JLabel();
266 jLabelModuleUnloadImage
.setBounds(new java
.awt
.Rectangle(12, 25, 140, 20));
267 jLabelModuleUnloadImage
.setText("Module Unload Image");
268 jLabelModuleEntryPoint
= new JLabel();
269 jLabelModuleEntryPoint
.setBounds(new java
.awt
.Rectangle(12, 0, 140, 20));
270 jLabelModuleEntryPoint
.setText("Module Entry Point");
271 jPanelImage
= new JPanel();
272 jPanelImage
.setBounds(new java
.awt
.Rectangle(0, 37, 505, 45));
273 jPanelImage
.setLayout(null);
274 jPanelImage
.add(jLabelModuleEntryPoint
, null);
275 jPanelImage
.add(getJTextFieldModuleEntryPoint(), null);
276 jPanelImage
.add(jLabelModuleUnloadImage
, null);
277 jPanelImage
.add(getJTextFieldModuleUnloadImage(), null);
283 * This method initializes jPanelDriver
285 * @return javax.swing.JPanel
287 private JPanel
getJPanelDriver() {
288 if (jPanelDriver
== null) {
289 jStarLabel1
= new StarLabel();
290 jStarLabel1
.setLocation(new java
.awt
.Point(0, 0));
291 jLabelDriverDiagnostic
= new JLabel();
292 jLabelDriverDiagnostic
.setBounds(new java
.awt
.Rectangle(12, 75, 140, 20));
293 jLabelDriverDiagnostic
.setText("Driver Diagnostic");
294 jLabelDriverConfig
= new JLabel();
295 jLabelDriverConfig
.setBounds(new java
.awt
.Rectangle(12, 50, 140, 20));
296 jLabelDriverConfig
.setText("Driver Config");
297 jLabelComponentName
= new JLabel();
298 jLabelComponentName
.setBounds(new java
.awt
.Rectangle(12, 25, 140, 20));
299 jLabelComponentName
.setText("Component Name");
300 jLabelDriverBinding
= new JLabel();
301 jLabelDriverBinding
.setBounds(new java
.awt
.Rectangle(12, 0, 140, 20));
302 jLabelDriverBinding
.setText("Driver Binding");
303 jPanelDriver
= new JPanel();
304 jPanelDriver
.setBounds(new java
.awt
.Rectangle(0, 37, 505, 95));
305 jPanelDriver
.setLayout(null);
306 jPanelDriver
.add(jStarLabel1
, null);
307 jPanelDriver
.add(jLabelDriverBinding
, null);
308 jPanelDriver
.add(getJTextFieldDriverBinding(), null);
309 jPanelDriver
.add(jLabelComponentName
, null);
310 jPanelDriver
.add(getJTextFieldComponentName(), null);
311 jPanelDriver
.add(jLabelDriverConfig
, null);
312 jPanelDriver
.add(getJTextFieldDriverConfig(), null);
313 jPanelDriver
.add(jLabelDriverDiagnostic
, null);
314 jPanelDriver
.add(getJTextFieldDriverDiagnostic(), null);
320 * This method initializes jPanelLibrary
322 * @return javax.swing.JPanel
324 private JPanel
getJPanelLibrary() {
325 if (jPanelLibrary
== null) {
326 jLabelDestructor
= new JLabel();
327 jLabelDestructor
.setBounds(new java
.awt
.Rectangle(12, 25, 140, 20));
328 jLabelDestructor
.setText("Destructor");
329 jLabelConstructor
= new JLabel();
330 jLabelConstructor
.setBounds(new java
.awt
.Rectangle(12, 0, 140, 20));
331 jLabelConstructor
.setText("Constructor");
332 jPanelLibrary
= new JPanel();
333 jPanelLibrary
.setBounds(new java
.awt
.Rectangle(0, 37, 505, 45));
334 jPanelLibrary
.setLayout(null);
335 jPanelLibrary
.add(jLabelConstructor
, null);
336 jPanelLibrary
.add(getJTextFieldConstructor(), null);
337 jPanelLibrary
.add(jLabelDestructor
, null);
338 jPanelLibrary
.add(getJTextFieldDestructor(), null);
340 return jPanelLibrary
;
344 * This method initializes jPanelCallBack
346 * @return javax.swing.JPanel
348 private JPanel
getJPanelCallBack() {
349 if (jPanelCallBack
== null) {
350 jLabelExitBootServices
= new JLabel();
351 jLabelExitBootServices
.setBounds(new java
.awt
.Rectangle(12, 25, 140, 20));
352 jLabelExitBootServices
.setText("Exit Boot Services");
353 jLabelVirtualAddressMap
= new JLabel();
354 jLabelVirtualAddressMap
.setBounds(new java
.awt
.Rectangle(12, 0, 140, 20));
355 jLabelVirtualAddressMap
.setText("Virtual Address Map");
356 jPanelCallBack
= new JPanel();
357 jPanelCallBack
.setBounds(new java
.awt
.Rectangle(0, 37, 505, 45));
358 jPanelCallBack
.setLayout(null);
359 jPanelCallBack
.add(jLabelVirtualAddressMap
, null);
360 jPanelCallBack
.add(getJTextFieldVirtualAddressMap(), null);
361 jPanelCallBack
.add(jLabelExitBootServices
, null);
362 jPanelCallBack
.add(getJTextFieldExitBootServices(), null);
364 return jPanelCallBack
;
368 * This method initializes jTextFieldModuleEntryPoint
370 * @return javax.swing.JTextField
372 private JTextField
getJTextFieldModuleEntryPoint() {
373 if (jTextFieldModuleEntryPoint
== null) {
374 jTextFieldModuleEntryPoint
= new JTextField();
375 jTextFieldModuleEntryPoint
.setBounds(new java
.awt
.Rectangle(168, 0, 320, 20));
377 return jTextFieldModuleEntryPoint
;
381 * This method initializes jTextFieldModuleUnloadImage
383 * @return javax.swing.JTextField
385 private JTextField
getJTextFieldModuleUnloadImage() {
386 if (jTextFieldModuleUnloadImage
== null) {
387 jTextFieldModuleUnloadImage
= new JTextField();
388 jTextFieldModuleUnloadImage
.setBounds(new java
.awt
.Rectangle(168, 25, 320, 20));
390 return jTextFieldModuleUnloadImage
;
394 * This method initializes jTextFieldDriverBinding
396 * @return javax.swing.JTextField
398 private JTextField
getJTextFieldDriverBinding() {
399 if (jTextFieldDriverBinding
== null) {
400 jTextFieldDriverBinding
= new JTextField();
401 jTextFieldDriverBinding
.setBounds(new java
.awt
.Rectangle(168, 0, 320, 20));
403 return jTextFieldDriverBinding
;
407 * This method initializes jTextFieldComponentName
409 * @return javax.swing.JTextField
411 private JTextField
getJTextFieldComponentName() {
412 if (jTextFieldComponentName
== null) {
413 jTextFieldComponentName
= new JTextField();
414 jTextFieldComponentName
.setBounds(new java
.awt
.Rectangle(168, 25, 320, 20));
416 return jTextFieldComponentName
;
420 * This method initializes jTextFieldDriverConfig
422 * @return javax.swing.JTextField
424 private JTextField
getJTextFieldDriverConfig() {
425 if (jTextFieldDriverConfig
== null) {
426 jTextFieldDriverConfig
= new JTextField();
427 jTextFieldDriverConfig
.setBounds(new java
.awt
.Rectangle(168, 50, 320, 20));
429 return jTextFieldDriverConfig
;
433 * This method initializes jTextFieldDriverDiagnostic
435 * @return javax.swing.JTextField
437 private JTextField
getJTextFieldDriverDiagnostic() {
438 if (jTextFieldDriverDiagnostic
== null) {
439 jTextFieldDriverDiagnostic
= new JTextField();
440 jTextFieldDriverDiagnostic
.setBounds(new java
.awt
.Rectangle(168, 75, 320, 20));
442 return jTextFieldDriverDiagnostic
;
446 * This method initializes jTextFieldConstructor
448 * @return javax.swing.JTextField
450 private JTextField
getJTextFieldConstructor() {
451 if (jTextFieldConstructor
== null) {
452 jTextFieldConstructor
= new JTextField();
453 jTextFieldConstructor
.setBounds(new java
.awt
.Rectangle(168, 0, 320, 20));
455 return jTextFieldConstructor
;
459 * This method initializes jTextFieldDestructor
461 * @return javax.swing.JTextField
463 private JTextField
getJTextFieldDestructor() {
464 if (jTextFieldDestructor
== null) {
465 jTextFieldDestructor
= new JTextField();
466 jTextFieldDestructor
.setBounds(new java
.awt
.Rectangle(168, 25, 320, 20));
468 return jTextFieldDestructor
;
472 * This method initializes jTextFieldVirtualAddressMap
474 * @return javax.swing.JTextField
476 private JTextField
getJTextFieldVirtualAddressMap() {
477 if (jTextFieldVirtualAddressMap
== null) {
478 jTextFieldVirtualAddressMap
= new JTextField();
479 jTextFieldVirtualAddressMap
.setBounds(new java
.awt
.Rectangle(168, 0, 320, 20));
481 return jTextFieldVirtualAddressMap
;
485 * This method initializes jTextFieldExitBootServices
487 * @return javax.swing.JTextField
489 private JTextField
getJTextFieldExitBootServices() {
490 if (jTextFieldExitBootServices
== null) {
491 jTextFieldExitBootServices
= new JTextField();
492 jTextFieldExitBootServices
.setBounds(new java
.awt
.Rectangle(168, 25, 320, 20));
494 return jTextFieldExitBootServices
;
497 public static void main(String
[] args
) {
502 This method initializes this
505 private void init() {
506 this.setSize(515, 250);
507 this.setContentPane(getJScrollPane());
508 this.setTitle("Externs");
514 This method initializes this
515 Fill values to all fields if these values are not empty
520 private void init(ExternsIdentification inExternsId
, ModuleIdentification mid
) {
522 this.id
= inExternsId
;
525 // Init arch with module's arch
527 this.vArchList
= wt
.getModuleArch(mid
);
529 if (this.id
!= null) {
530 String type
= id
.getType();
532 // Filter the type to lock down the type
534 this.jComboBoxType
.removeAllItems();
535 this.jComboBoxType
.addItem(type
);
537 this.jTextFieldFeatureFlag
.setText(id
.getFeatureFlag());
538 this.jArchCheckBox
.setSelectedItems(id
.getSupArchList());
541 // Init specification
543 if (type
.equals(EnumerationData
.EXTERNS_SPECIFICATION
)) {
544 this.jTextFieldSpecification
.setText(id
.getName0());
550 if (type
.equals(EnumerationData
.EXTERNS_IMAGE
)) {
551 this.jTextFieldModuleEntryPoint
.setText(id
.getName0());
552 this.jTextFieldModuleUnloadImage
.setText(id
.getName1());
558 if (type
.equals(EnumerationData
.EXTERNS_LIBRARY
)) {
559 this.jTextFieldConstructor
.setText(id
.getName0());
560 this.jTextFieldDestructor
.setText(id
.getName1());
566 if (type
.equals(EnumerationData
.EXTERNS_DRIVER
)) {
567 this.jTextFieldDriverBinding
.setText(id
.getName0());
568 this.jTextFieldComponentName
.setText(id
.getName1());
569 this.jTextFieldDriverConfig
.setText(id
.getName2());
570 this.jTextFieldDriverDiagnostic
.setText(id
.getName3());
576 if (type
.equals(EnumerationData
.EXTERNS_CALL_BACK
)) {
577 this.jTextFieldVirtualAddressMap
.setText(id
.getName0());
578 this.jTextFieldExitBootServices
.setText(id
.getName1());
584 This is the override edit constructor
586 @param inBootModesIdentification
590 public ExternsDlg(ExternsIdentification inExternsIdentification
, IFrame iFrame
, ModuleIdentification mid
) {
592 init(inExternsIdentification
, mid
);
596 This method initializes jContentPane
598 @return javax.swing.JPanel jContentPane
601 private JPanel
getJContentPane() {
602 if (jContentPane
== null) {
603 jArchCheckBox
= new ArchCheckBox();
604 jArchCheckBox
.setBounds(new java
.awt
.Rectangle(168, 62, 320, 20));
605 jArchCheckBox
.setPreferredSize(new java
.awt
.Dimension(320, 20));
607 jLabelName
= new JLabel();
608 jLabelName
.setText("Choose Extern Type");
609 jLabelName
.setBounds(new java
.awt
.Rectangle(12, 12, 155, 20));
610 jLabelArch
= new JLabel();
611 jLabelArch
.setBounds(new java
.awt
.Rectangle(12, 62, 155, 20));
612 jLabelArch
.setText("Supported Architectures");
613 jLabelFeatureFlag
= new JLabel();
614 jLabelFeatureFlag
.setBounds(new java
.awt
.Rectangle(12, 87, 155, 20));
615 jLabelFeatureFlag
.setText("Feature Flag Expression");
616 jLabelFeatureFlag
.setEnabled(false);
618 jContentPane
= new JPanel();
619 jContentPane
.setLayout(null);
620 jContentPane
.setPreferredSize(new java
.awt
.Dimension(505, 200));
622 jContentPane
.add(jLabelName
, null);
623 jContentPane
.add(getJComboBoxType(), null);
624 jContentPane
.add(jLabelFeatureFlag
, null);
625 jContentPane
.add(jLabelArch
, null);
626 jContentPane
.add(getJTextFieldFeatureFlag(), null);
628 jContentPane
.add(jArchCheckBox
, null);
629 jContentPane
.add(getJButtonOk(), null);
630 jContentPane
.add(getJButtonCancel(), null);
632 jContentPane
.add(getJPanelSpecification(), null);
633 jContentPane
.add(getJPanelImage(), null);
634 jContentPane
.add(getJPanelDriver(), null);
635 jContentPane
.add(getJPanelLibrary(), null);
636 jContentPane
.add(getJPanelCallBack(), null);
642 This method initializes Usage type and Externs type
645 private void initFrame() {
646 Tools
.generateComboBoxByVector(this.jComboBoxType
, ed
.getVExternTypes());
647 this.jPanelSpecification
.setVisible(true);
648 this.jPanelImage
.setVisible(false);
649 this.jPanelLibrary
.setVisible(false);
650 this.jPanelDriver
.setVisible(false);
651 this.jPanelCallBack
.setVisible(false);
655 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
657 * Override actionPerformed to listen all actions
660 public void actionPerformed(ActionEvent arg0
) {
661 if (arg0
.getSource() == jButtonOk
) {
663 this.getCurrentExterns();
664 this.returnType
= DataType
.RETURN_TYPE_OK
;
665 this.setVisible(false);
669 if (arg0
.getSource() == jButtonCancel
) {
670 this.returnType
= DataType
.RETURN_TYPE_CANCEL
;
671 this.setVisible(false);
676 Data validation for all fields
678 @retval true - All datas are valid
679 @retval false - At least one data is invalid
682 public boolean checkAdd() {
684 // Check if all fields have correct data types
688 // Check specification
690 if (this.jComboBoxType
.getSelectedItem().toString().equals(EnumerationData
.EXTERNS_SPECIFICATION
)) {
691 if (isEmpty(this.jTextFieldSpecification
.getText())) {
692 Log
.wrn("Update Externs", "Please type specification's name");
695 if (!DataValidation
.isSentence(this.jTextFieldSpecification
.getText())) {
696 Log
.wrn("Update Externs", "Incorrect data type for Specification");
701 // No need to check feature flag, return true directly here.
709 if (this.jComboBoxType
.getSelectedItem().toString().equals(EnumerationData
.EXTERNS_IMAGE
)) {
710 if (isEmpty(this.jTextFieldModuleEntryPoint
.getText())
711 && isEmpty(this.jTextFieldModuleUnloadImage
.getText())) {
712 Log
.wrn("Update Externs", "At least one of ModuleEntryPoint or ModuleUnloadImage should have a value");
715 if (!isEmpty(this.jTextFieldModuleEntryPoint
.getText())) {
716 if (!DataValidation
.isC_NameType(this.jTextFieldModuleEntryPoint
.getText())) {
717 Log
.wrn("Update Externs", "Incorrect data type for Module Entry Point");
721 if (!isEmpty(this.jTextFieldModuleUnloadImage
.getText())) {
722 if (!DataValidation
.isC_NameType(this.jTextFieldModuleUnloadImage
.getText())) {
723 Log
.wrn("Update Externs", "Incorrect data type for Module Unload Image");
732 if (this.jComboBoxType
.getSelectedItem().toString().equals(EnumerationData
.EXTERNS_LIBRARY
)) {
733 if (isEmpty(this.jTextFieldConstructor
.getText()) && isEmpty(this.jTextFieldDestructor
.getText())) {
734 Log
.wrn("Update Externs", "At least one of Constructor or Destructor should have a value");
737 if (!isEmpty(this.jTextFieldConstructor
.getText())) {
738 if (!DataValidation
.isC_NameType(this.jTextFieldConstructor
.getText())) {
739 Log
.wrn("Update Externs", "Incorrect data type for Constructor");
743 if (!isEmpty(this.jTextFieldDestructor
.getText())) {
744 if (!DataValidation
.isC_NameType(this.jTextFieldDestructor
.getText())) {
745 Log
.wrn("Update Externs", "Incorrect data type for Destructor");
754 if (this.jComboBoxType
.getSelectedItem().toString().equals(EnumerationData
.EXTERNS_DRIVER
)) {
755 if (isEmpty(this.jTextFieldDriverBinding
.getText())) {
756 Log
.wrn("Update Externs", "DriverBinding must have a value");
759 if (!isEmpty(this.jTextFieldDriverBinding
.getText())) {
760 if (!DataValidation
.isC_NameType(this.jTextFieldDriverBinding
.getText())) {
761 Log
.wrn("Update Externs", "Incorrect data type for DriverBinding");
765 if (!isEmpty(this.jTextFieldComponentName
.getText())) {
766 if (!DataValidation
.isC_NameType(this.jTextFieldComponentName
.getText())) {
767 Log
.wrn("Update Externs", "Incorrect data type for ComponentName");
771 if (!isEmpty(this.jTextFieldDriverConfig
.getText())) {
772 if (!DataValidation
.isC_NameType(this.jTextFieldDriverConfig
.getText())) {
773 Log
.wrn("Update Externs", "Incorrect data type for DriverConfig");
777 if (!isEmpty(this.jTextFieldDriverDiagnostic
.getText())) {
778 if (!DataValidation
.isC_NameType(this.jTextFieldDriverDiagnostic
.getText())) {
779 Log
.wrn("Update Externs", "Incorrect data type for DriverDiagnostic");
788 if (this.jComboBoxType
.getSelectedItem().toString().equals(EnumerationData
.EXTERNS_CALL_BACK
)) {
789 if (isEmpty(this.jTextFieldVirtualAddressMap
.getText())
790 && isEmpty(this.jTextFieldExitBootServices
.getText())) {
791 Log
.wrn("Update Externs", "At least one of VirtualAddressMap or ExitBootServices should have a value");
794 if (!isEmpty(this.jTextFieldVirtualAddressMap
.getText())) {
795 if (!DataValidation
.isC_NameType(this.jTextFieldVirtualAddressMap
.getText())) {
796 Log
.wrn("Update Externs", "Incorrect data type for Virtual Address Map");
800 if (!isEmpty(this.jTextFieldExitBootServices
.getText())) {
801 if (!DataValidation
.isC_NameType(this.jTextFieldExitBootServices
.getText())) {
802 Log
.wrn("Update Externs", "Incorrect data type for Exit Boot Services");
811 if (!isEmpty(this.jTextFieldFeatureFlag
.getText())) {
812 if (!DataValidation
.isFeatureFlag(this.jTextFieldFeatureFlag
.getText())) {
813 Log
.wrn("Update Externs", "Incorrect data type for Feature Flag");
821 private ExternsIdentification
getCurrentExterns() {
827 String type
= this.jComboBoxType
.getSelectedItem().toString();
828 String featureFlag
= this.jTextFieldFeatureFlag
.getText();
829 Vector
<String
> arch
= this.jArchCheckBox
.getSelectedItemsVector();
831 if (type
.equals(EnumerationData
.EXTERNS_SPECIFICATION
)) {
832 arg0
= this.jTextFieldSpecification
.getText();
833 id
= new ExternsIdentification(arg0
, type
);
836 if (type
.equals(EnumerationData
.EXTERNS_IMAGE
)) {
837 arg0
= this.jTextFieldModuleEntryPoint
.getText();
838 arg1
= this.jTextFieldModuleUnloadImage
.getText();
839 id
= new ExternsIdentification(arg0
, arg1
, type
, featureFlag
, arch
);
842 if (type
.equals(EnumerationData
.EXTERNS_LIBRARY
)) {
843 arg0
= this.jTextFieldConstructor
.getText();
844 arg1
= this.jTextFieldDestructor
.getText();
845 id
= new ExternsIdentification(arg0
, arg1
, type
, featureFlag
, arch
);
848 if (type
.equals(EnumerationData
.EXTERNS_DRIVER
)) {
849 arg0
= this.jTextFieldDriverBinding
.getText();
850 arg1
= this.jTextFieldComponentName
.getText();
851 arg2
= this.jTextFieldDriverConfig
.getText();
852 arg3
= this.jTextFieldDriverDiagnostic
.getText();
853 id
= new ExternsIdentification(arg0
, arg1
, arg2
, arg3
, type
, featureFlag
, arch
);
856 if (type
.equals(EnumerationData
.EXTERNS_CALL_BACK
)) {
857 arg0
= this.jTextFieldVirtualAddressMap
.getText();
858 arg1
= this.jTextFieldExitBootServices
.getText();
859 id
= new ExternsIdentification(arg0
, arg1
, type
, featureFlag
, arch
);
866 * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
868 * Reflesh the frame when selected item changed
871 public void itemStateChanged(ItemEvent arg0
) {
872 if (arg0
.getSource() == jComboBoxType
&& arg0
.getStateChange() == ItemEvent
.SELECTED
) {
873 if (jComboBoxType
.getSelectedItem().toString().equals(EnumerationData
.EXTERNS_SPECIFICATION
)) {
874 this.jPanelSpecification
.setVisible(true);
875 this.jPanelImage
.setVisible(false);
876 this.jPanelLibrary
.setVisible(false);
877 this.jPanelDriver
.setVisible(false);
878 this.jPanelCallBack
.setVisible(false);
879 this.jLabelArch
.setEnabled(false);
880 this.jArchCheckBox
.setAllItemsEnabled(false);
881 this.jLabelArch
.setLocation(12, 62);
882 this.jArchCheckBox
.setLocation(168, 62);
883 this.jLabelFeatureFlag
.setLocation(12, 87);
884 this.jTextFieldFeatureFlag
.setLocation(168, 87);
885 } else if (jComboBoxType
.getSelectedItem().toString().equals(EnumerationData
.EXTERNS_IMAGE
)) {
886 this.jPanelSpecification
.setVisible(false);
887 this.jPanelImage
.setVisible(true);
888 this.jPanelLibrary
.setVisible(false);
889 this.jPanelDriver
.setVisible(false);
890 this.jPanelCallBack
.setVisible(false);
891 this.jLabelArch
.setEnabled(true);
892 this.jArchCheckBox
.setEnabledItems(this.vArchList
);
893 this.jLabelArch
.setLocation(12, 87);
894 this.jArchCheckBox
.setLocation(168, 87);
895 this.jLabelFeatureFlag
.setLocation(12, 112);
896 this.jTextFieldFeatureFlag
.setLocation(168, 112);
897 } else if (jComboBoxType
.getSelectedItem().toString().equals(EnumerationData
.EXTERNS_LIBRARY
)) {
898 this.jPanelSpecification
.setVisible(false);
899 this.jPanelImage
.setVisible(false);
900 this.jPanelLibrary
.setVisible(true);
901 this.jPanelDriver
.setVisible(false);
902 this.jPanelCallBack
.setVisible(false);
903 this.jLabelArch
.setEnabled(true);
904 this.jArchCheckBox
.setEnabledItems(this.vArchList
);
905 this.jLabelArch
.setLocation(12, 87);
906 this.jArchCheckBox
.setLocation(168, 87);
907 this.jLabelFeatureFlag
.setLocation(12, 112);
908 this.jTextFieldFeatureFlag
.setLocation(168, 112);
909 } else if (jComboBoxType
.getSelectedItem().toString().equals(EnumerationData
.EXTERNS_DRIVER
)) {
910 this.jPanelSpecification
.setVisible(false);
911 this.jPanelImage
.setVisible(false);
912 this.jPanelLibrary
.setVisible(false);
913 this.jPanelDriver
.setVisible(true);
914 this.jPanelCallBack
.setVisible(false);
915 this.jLabelArch
.setEnabled(true);
916 this.jArchCheckBox
.setEnabledItems(this.vArchList
);
917 this.jLabelArch
.setLocation(12, 137);
918 this.jArchCheckBox
.setLocation(168, 137);
919 this.jLabelFeatureFlag
.setLocation(12, 162);
920 this.jTextFieldFeatureFlag
.setLocation(168, 162);
921 } else if (jComboBoxType
.getSelectedItem().toString().equals(EnumerationData
.EXTERNS_CALL_BACK
)) {
922 this.jPanelSpecification
.setVisible(false);
923 this.jPanelImage
.setVisible(false);
924 this.jPanelLibrary
.setVisible(false);
925 this.jPanelDriver
.setVisible(false);
926 this.jPanelCallBack
.setVisible(true);
927 this.jLabelArch
.setEnabled(true);
928 this.jArchCheckBox
.setEnabledItems(this.vArchList
);
929 this.jLabelArch
.setLocation(12, 87);
930 this.jArchCheckBox
.setLocation(168, 87);
931 this.jLabelFeatureFlag
.setLocation(12, 112);
932 this.jTextFieldFeatureFlag
.setLocation(168, 112);
937 public ExternsIdentification
getId() {
941 public void setId(ExternsIdentification id
) {