2 Java class SpdLibClassDecls is GUI for create library definition elements of spd file.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 package org
.tianocore
.frameworkwizard
.packaging
.ui
;
15 import java
.awt
.Dimension
;
16 import java
.awt
.event
.ActionEvent
;
17 import java
.awt
.event
.ComponentEvent
;
19 import java
.util
.HashMap
;
20 import java
.util
.Iterator
;
23 import java
.util
.Vector
;
25 import javax
.swing
.AbstractAction
;
26 import javax
.swing
.JFileChooser
;
27 import javax
.swing
.JOptionPane
;
28 import javax
.swing
.JPanel
;
29 import javax
.swing
.JTable
;
30 import javax
.swing
.JTextField
;
31 import javax
.swing
.JComboBox
;
32 import javax
.swing
.JLabel
;
33 import javax
.swing
.JScrollPane
;
34 import javax
.swing
.JButton
;
35 import javax
.swing
.JFrame
;
36 import javax
.swing
.ListSelectionModel
;
37 import javax
.swing
.event
.InternalFrameAdapter
;
38 import javax
.swing
.event
.InternalFrameEvent
;
39 import javax
.swing
.event
.ListSelectionEvent
;
40 import javax
.swing
.event
.ListSelectionListener
;
41 import javax
.swing
.event
.TableModelEvent
;
42 import javax
.swing
.event
.TableModelListener
;
43 import javax
.swing
.table
.DefaultTableModel
;
44 import javax
.swing
.table
.TableModel
;
46 import org
.apache
.xmlbeans
.XmlObject
;
47 import org
.tianocore
.PackageSurfaceAreaDocument
;
48 import org
.tianocore
.frameworkwizard
.common
.DataValidation
;
49 import org
.tianocore
.frameworkwizard
.common
.Tools
;
50 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageType
;
51 import org
.tianocore
.frameworkwizard
.common
.ui
.IInternalFrame
;
52 import org
.tianocore
.frameworkwizard
.common
.ui
.StarLabel
;
53 import org
.tianocore
.frameworkwizard
.common
.ui
.iCheckBoxList
.ICheckBoxList
;
54 import org
.tianocore
.frameworkwizard
.platform
.ui
.ListEditor
;
55 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.GlobalData
;
56 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.SurfaceAreaQuery
;
57 import org
.tianocore
.frameworkwizard
.platform
.ui
.id
.ModuleIdentification
;
58 import org
.tianocore
.frameworkwizard
.platform
.ui
.id
.PackageIdentification
;
62 GUI for create library definition elements of spd file.
64 @since PackageEditor 1.0
66 public class SpdLibClassDecls
extends IInternalFrame
implements TableModelListener
{
70 private static final long serialVersionUID
= 1L;
74 private JTable jTable
= null;
76 private DefaultTableModel model
= null;
78 private JPanel jContentPane
= null;
80 private JTextField jTextFieldAdd
= null;
82 private JComboBox jComboBoxSelect
= null;
84 private JScrollPane jScrollPane
= null;
86 private JButton jButtonAdd
= null;
88 private JButton jButtonRemove
= null;
90 private JButton jButtonClearAll
= null;
92 private JLabel jLabel
= null;
94 private JTextField jTextField
= null;
96 private JButton jButtonBrowse
= null;
98 private StarLabel jStarLabel1
= null;
100 private StarLabel jStarLabel2
= null;
102 private SpdFileContents sfc
= null;
104 private OpeningPackageType docConsole
= null;
106 private JLabel jLabel1
= null;
108 private JScrollPane topScrollPane
= null; // @jve:decl-index=0:visual-constraint="10,53"
110 private int selectedRow
= -1;
112 private StarLabel starLabel
= null;
114 private JLabel jLabel2
= null;
116 private JTextField jTextFieldHelp
= null;
118 private JLabel jLabel3
= null;
120 private JTextField jTextField1
= null;
122 private JLabel jLabel4
= null;
124 private JTextField jTextField2
= null;
126 private JLabel jLabel5
= null;
128 private JLabel jLabel6
= null;
130 private JScrollPane jScrollPaneArch
= null;
132 private JScrollPane jScrollPane1
= null;
134 private ICheckBoxList iCheckBoxListArch
= null;
136 private ICheckBoxList iCheckBoxList
= null;
138 private JComboBox jComboBox
= null;
140 HashMap
<String
, String
> libNameGuidMap
= new HashMap
<String
, String
>();
144 This method initializes this
147 private void initialize() {
149 this.setDefaultCloseOperation(javax
.swing
.WindowConstants
.DISPOSE_ON_CLOSE
);
154 This method initializes jTextFieldAdd
156 @return javax.swing.JTextField
158 private JTextField
getJTextFieldAdd() {
159 if (jTextFieldAdd
== null) {
160 jTextFieldAdd
= new JTextField();
161 jTextFieldAdd
.setBounds(new java
.awt
.Rectangle(122,6,390,20));
162 jTextFieldAdd
.setPreferredSize(new java
.awt
.Dimension(260,20));
163 jTextFieldAdd
.setEnabled(true);
165 return jTextFieldAdd
;
169 This method initializes jComboBoxSelect
171 @return javax.swing.JComboBox
173 private JComboBox
getJComboBoxSelect() {
174 if (jComboBoxSelect
== null) {
175 jComboBoxSelect
= new JComboBox();
176 jComboBoxSelect
.setBounds(new java
.awt
.Rectangle(220, 10, 260, 20));
177 jComboBoxSelect
.setPreferredSize(new java
.awt
.Dimension(260,22));
178 jComboBoxSelect
.setEnabled(true);
179 jComboBoxSelect
.setVisible(false);
181 return jComboBoxSelect
;
185 This method initializes jScrollPane
187 @return javax.swing.JScrollPane
189 private JScrollPane
getJScrollPane() {
190 if (jScrollPane
== null) {
191 jScrollPane
= new JScrollPane();
192 jScrollPane
.setBounds(new java
.awt
.Rectangle(12,351,608,253));
193 jScrollPane
.setPreferredSize(new java
.awt
.Dimension(330,150));
194 jScrollPane
.setViewportView(getJTable());
200 This method initializes jTable
202 @return javax.swing.JTable
204 private JTable
getJTable() {
205 if (jTable
== null) {
206 model
= new DefaultTableModel();
207 jTable
= new JTable(model
);
208 jTable
.setRowHeight(20);
209 jTable
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_OFF
);
210 model
.addColumn("LibraryClass");
211 model
.addColumn("IncludeHeader");
212 model
.addColumn("HelpText");
213 model
.addColumn("RecommendedInstance");
214 model
.addColumn("InstanceVersion");
215 model
.addColumn("SupportedArch");
216 model
.addColumn("SupportedModule");
218 Vector
<String
> vArch
= new Vector
<String
>();
225 jTable
.getColumnModel().getColumn(5).setCellEditor(new ListEditor(vArch
));
227 Vector
<String
> vModule
= new Vector
<String
>();
230 vModule
.add("PEI_CORE");
232 vModule
.add("DXE_CORE");
233 vModule
.add("DXE_DRIVER");
234 vModule
.add("DXE_RUNTIME_DRIVER");
235 vModule
.add("DXE_SAL_DRIVER");
236 vModule
.add("DXE_SMM_DRIVER");
237 vModule
.add("UEFI_DRIVER");
238 vModule
.add("UEFI_APPLICATION");
239 vModule
.add("USER_DEFINED");
240 jTable
.getColumnModel().getColumn(6).setCellEditor(new ListEditor(vModule
));
242 jTable
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
243 jTable
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
244 public void valueChanged(ListSelectionEvent e
) {
245 if (e
.getValueIsAdjusting()){
248 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
249 if (lsm
.isSelectionEmpty()) {
253 selectedRow
= lsm
.getMinSelectionIndex();
258 jTable
.getModel().addTableModelListener(this);
265 public void tableChanged(TableModelEvent arg0
) {
266 // TODO Auto-generated method stub
267 int row
= arg0
.getFirstRow();
268 TableModel m
= (TableModel
)arg0
.getSource();
269 if (arg0
.getType() == TableModelEvent
.UPDATE
){
270 String lib
= m
.getValueAt(row
, 0) + "";
271 String hdr
= m
.getValueAt(row
, 1) + "";
272 String hlp
= m
.getValueAt(row
, 2) + "";
273 String guid
= m
.getValueAt(row
, 3) + "";
274 String ver
= m
.getValueAt(row
, 4) + "";
276 if (m
.getValueAt(row
, 5) != null) {
277 arch
= m
.getValueAt(row
, 5).toString();
279 String module
= null;
280 if (m
.getValueAt(row
, 6) != null) {
281 module
= m
.getValueAt(row
, 6).toString();
283 String
[] rowData
= {lib
, hdr
, hlp
};
284 if (!dataValidation(rowData
)) {
287 docConsole
.setSaved(false);
288 sfc
.updateSpdLibClass(row
, lib
, hdr
, hlp
, guid
, ver
, arch
, module
);
293 This method initializes jButtonAdd
295 @return javax.swing.JButton
297 private JButton
getJButtonAdd() {
298 if (jButtonAdd
== null) {
299 jButtonAdd
= new JButton();
300 jButtonAdd
.setText("Add");
301 jButtonAdd
.setSize(new java
.awt
.Dimension(80,20));
302 jButtonAdd
.setLocation(new java
.awt
.Point(359,326));
303 jButtonAdd
.addActionListener(this);
309 This method initializes jButtonRemove
311 @return javax.swing.JButton
313 private JButton
getJButtonRemove() {
314 if (jButtonRemove
== null) {
315 jButtonRemove
= new JButton();
316 jButtonRemove
.setText("Remove");
317 jButtonRemove
.setSize(new java
.awt
.Dimension(80,20));
318 jButtonRemove
.setLocation(new java
.awt
.Point(443,326));
319 jButtonRemove
.addActionListener(this);
321 return jButtonRemove
;
325 This method initializes jButtonRemoveAll
327 @return javax.swing.JButton
329 private JButton
getJButtonClearAll() {
330 if (jButtonClearAll
== null) {
331 jButtonClearAll
= new JButton();
332 jButtonClearAll
.setText("Clear All");
333 jButtonClearAll
.setSize(new java
.awt
.Dimension(86,20));
334 jButtonClearAll
.setLocation(new java
.awt
.Point(530,326));
335 jButtonClearAll
.addActionListener(this);
337 return jButtonClearAll
;
341 This is the default constructor
343 public SpdLibClassDecls() {
350 public SpdLibClassDecls(PackageSurfaceAreaDocument
.PackageSurfaceArea inPsa
){
352 sfc
= new SpdFileContents(inPsa
);
356 public SpdLibClassDecls(OpeningPackageType opt
) {
357 this(opt
.getXmlSpd());
361 This method initializes this
365 private void init() {
367 this.setContentPane(getJContentPane());
368 this.setTitle("Library Class Declarations");
369 this.setBounds(new java
.awt
.Rectangle(0, 0, 500, 370));
370 this.setVisible(true);
371 this.addInternalFrameListener(new InternalFrameAdapter(){
372 public void internalFrameDeactivated(InternalFrameEvent e
){
373 if (jTable
.isEditing()) {
374 jTable
.getCellEditor().stopCellEditing();
381 private void init(SpdFileContents sfc
) {
382 if (sfc
.getSpdLibClassDeclarationCount() == 0) {
386 // initialize table using SpdFileContents object
388 String
[][] saa
= new String
[sfc
.getSpdLibClassDeclarationCount()][7];
389 sfc
.getSpdLibClassDeclarations(saa
);
391 while (i
< saa
.length
) {
392 model
.addRow(saa
[i
]);
396 private JScrollPane
getJContentPane(){
397 if (topScrollPane
== null){
398 topScrollPane
= new JScrollPane();
399 topScrollPane
.setSize(new java
.awt
.Dimension(634,500));
400 topScrollPane
.setViewportView(getJContentPane1());
402 return topScrollPane
;
405 This method initializes jContentPane
407 @return javax.swing.JPanel
409 private JPanel
getJContentPane1() {
410 if (jContentPane
== null) {
411 jLabel6
= new JLabel();
412 jLabel6
.setBounds(new java
.awt
.Rectangle(16,252,108,16));
413 jLabel6
.setText("Supported Module");
414 jLabel6
.setEnabled(true);
415 jLabel5
= new JLabel();
416 jLabel5
.setBounds(new java
.awt
.Rectangle(15,169,93,16));
417 jLabel5
.setText("Supported Arch");
418 jLabel5
.setEnabled(true);
419 jLabel4
= new JLabel();
420 jLabel4
.setBounds(new java
.awt
.Rectangle(16,138,196,16));
421 jLabel4
.setEnabled(true);
422 jLabel4
.setText("Recommended Instance Version");
423 jLabel3
= new JLabel();
424 jLabel3
.setBounds(new java
.awt
.Rectangle(17,112,195,16));
425 jLabel3
.setEnabled(true);
426 jLabel3
.setText("Recommended Instance Name");
427 jLabel2
= new JLabel();
428 jLabel2
.setBounds(new java
.awt
.Rectangle(16,33,82,20));
429 jLabel2
.setText("Help Text");
430 starLabel
= new StarLabel();
431 starLabel
.setBounds(new java
.awt
.Rectangle(1,33,10,20));
432 jLabel1
= new JLabel();
433 jLabel1
.setBounds(new java
.awt
.Rectangle(16,6,82,20));
434 jLabel1
.setText("Library Class");
435 jStarLabel1
= new StarLabel();
436 jStarLabel1
.setLocation(new java
.awt
.Point(1,7));
437 jStarLabel2
= new StarLabel();
438 jStarLabel2
.setLocation(new java
.awt
.Point(-1,74));
439 jLabel
= new JLabel();
440 jLabel
.setBounds(new java
.awt
.Rectangle(14,74,199,22));
441 jLabel
.setText("Include Header for Specified Class");
443 jContentPane
= new JPanel();
444 jContentPane
.setPreferredSize(new Dimension(480, 400));
445 jContentPane
.setLayout(null);
446 jContentPane
.add(jLabel
, null);
447 jContentPane
.add(jStarLabel1
, null);
448 jContentPane
.add(jStarLabel2
, null);
449 jContentPane
.add(getJTextFieldAdd(), null);
450 jContentPane
.add(getJComboBoxSelect(), null);
451 jContentPane
.add(getJScrollPane(), null);
452 jContentPane
.add(getJButtonAdd(), null);
453 jContentPane
.add(getJButtonRemove(), null);
454 jContentPane
.add(getJButtonClearAll(), null);
456 jContentPane
.add(getJTextField(), null);
457 jContentPane
.add(getJButtonBrowse(), null);
458 jContentPane
.add(jLabel1
, null);
459 jContentPane
.add(starLabel
, null);
460 jContentPane
.add(jLabel2
, null);
461 jContentPane
.add(getJTextFieldHelp(), null);
462 jContentPane
.add(jLabel3
, null);
463 jContentPane
.add(getJTextField1(), null);
464 jContentPane
.add(jLabel4
, null);
465 jContentPane
.add(getJTextField2(), null);
466 jContentPane
.add(jLabel5
, null);
467 jContentPane
.add(jLabel6
, null);
469 jContentPane
.add(getJScrollPaneArch(), null);
470 jContentPane
.add(getJScrollPane1(), null);
471 jContentPane
.add(getJComboBox(), null);
479 fill ComboBoxes with pre-defined contents
481 private void initFrame() {
482 jComboBoxSelect
.addItem("BaseCpuICacheFlush");
483 jComboBoxSelect
.addItem("BaseDebugLibNull");
484 jComboBoxSelect
.addItem("BaseDebugLibReportStatusCode");
485 jComboBoxSelect
.addItem("BaseIoLibIntrinsic");
486 jComboBoxSelect
.addItem("BaseLib");
487 jComboBoxSelect
.addItem("BaseMemoryLib");
488 jComboBoxSelect
.addItem("BaseMemoryLibMmx");
489 jComboBoxSelect
.addItem("BaseMemoryLibSse2");
490 jComboBoxSelect
.addItem("BasePeCoffGetEntryPointLib");
491 jComboBoxSelect
.addItem("BasePeCoffLib");
492 jComboBoxSelect
.addItem("BasePrintLib");
493 jComboBoxSelect
.addItem("BaseReportStatusCodeLibNull");
494 jComboBoxSelect
.addItem("CommonPciCf8Lib");
495 jComboBoxSelect
.addItem("CommonPciExpressLib");
496 jComboBoxSelect
.addItem("CommonPciLibCf8");
497 jComboBoxSelect
.addItem("CommonPciLibPciExpress");
498 jComboBoxSelect
.addItem("DxeCoreEntryPoint");
499 jComboBoxSelect
.addItem("DxeHobLib");
500 jComboBoxSelect
.addItem("DxeIoLibCpuIo");
501 jComboBoxSelect
.addItem("DxeLib");
502 jComboBoxSelect
.addItem("DxePcdLib");
503 jComboBoxSelect
.addItem("DxeReportStatusCodeLib");
504 jComboBoxSelect
.addItem("DxeServicesTableLib");
505 jComboBoxSelect
.addItem("PeiCoreEntryPoint");
506 jComboBoxSelect
.addItem("PeiMemoryLib");
507 jComboBoxSelect
.addItem("PeimEntryPoint");
508 jComboBoxSelect
.addItem("PeiReportStatusCodeLib");
509 jComboBoxSelect
.addItem("PeiServicesTablePointerLib");
510 jComboBoxSelect
.addItem("PeiServicesTablePointerLibMm7");
511 jComboBoxSelect
.addItem("UefiDebugLibConOut");
512 jComboBoxSelect
.addItem("UefiDebugLibStdErr");
513 jComboBoxSelect
.addItem("UefiDriverEntryPointMultiple");
514 jComboBoxSelect
.addItem("UefiDriverEntryPointSingle");
515 jComboBoxSelect
.addItem("UefiDriverEntryPointSingleUnload");
516 jComboBoxSelect
.addItem("UefiDriverModelLib");
517 jComboBoxSelect
.addItem("UefiDriverModelLibNoConfigNoDiag");
518 jComboBoxSelect
.addItem("UefiLib");
519 jComboBoxSelect
.addItem("UefiMemoryLib");
524 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
526 public void actionPerformed(ActionEvent arg0
) {
528 if (arg0
.getSource() == jButtonAdd
) {
530 //ToDo: check before add
531 String
[] row
= {null, null, null, jTextField1
.getText(), jTextField2
.getText(), null, null};
532 row
[0] = jTextFieldAdd
.getText();
533 row
[1] = jTextField
.getText().replace('\\', '/');
534 row
[2] = jTextFieldHelp
.getText();
535 row
[5] = vectorToString(iCheckBoxList
.getAllCheckedItemsString());
536 if (row
[5].length() == 0){
539 row
[6] = vectorToString(iCheckBoxListArch
.getAllCheckedItemsString());
540 if (row
[6].length() == 0){
543 if (!dataValidation(row
)) {
547 jTable
.changeSelection(model
.getRowCount()-1, 0, false, false);
548 docConsole
.setSaved(false);
549 sfc
.genSpdLibClassDeclarations(row
[0], row
[3], row
[1], row
[2], row
[5], null, null, row
[4], null, row
[6]);
553 // remove selected line
555 if (arg0
.getSource() == jButtonRemove
) {
556 if (jTable
.isEditing()){
557 jTable
.getCellEditor().stopCellEditing();
559 int rowSelected
= selectedRow
;
560 if (rowSelected
>= 0) {
561 model
.removeRow(rowSelected
);
562 sfc
.removeSpdLibClass(rowSelected
);
566 if (arg0
.getSource() == jButtonClearAll
) {
567 if (model
.getRowCount() == 0) {
571 model
.setRowCount(0);
572 sfc
.removeSpdLibClass();
576 private boolean dataValidation(String
[] row
) {
577 if (!DataValidation
.isKeywordType(row
[0])) {
578 JOptionPane
.showMessageDialog(frame
, "Library Class is NOT KeyWord Type.");
581 if (!DataValidation
.isPathAndFilename(row
[1])) {
582 JOptionPane
.showMessageDialog(frame
, "Include Header is NOT PathAndFilename Type.");
584 if (row
[2].length() == 0) {
585 JOptionPane
.showMessageDialog(frame
, "HelpText could NOT be empty.");
590 Add contents in list to sfc
592 protected void save() {
597 This method initializes jTextField
599 @return javax.swing.JTextField
601 private JTextField
getJTextField() {
602 if (jTextField
== null) {
603 jTextField
= new JTextField();
604 jTextField
.setBounds(new java
.awt
.Rectangle(218,75,290,21));
605 jTextField
.setPreferredSize(new java
.awt
.Dimension(260,20));
611 This method initializes jButtonBrowse
613 @return javax.swing.JButton
615 private JButton
getJButtonBrowse() {
616 if (jButtonBrowse
== null) {
617 jButtonBrowse
= new JButton();
618 jButtonBrowse
.setBounds(new java
.awt
.Rectangle(528,75,90,20));
619 jButtonBrowse
.setText("Browse");
620 jButtonBrowse
.setPreferredSize(new java
.awt
.Dimension(80,20));
621 jButtonBrowse
.addActionListener(new AbstractAction() {
626 private static final long serialVersionUID
= 1L;
628 public void actionPerformed(ActionEvent arg0
) {
630 // Select files from current pkg
632 String dirPrefix
= Tools
.dirForNewSpd
.substring(0, Tools
.dirForNewSpd
.lastIndexOf(File
.separator
));
633 JFileChooser chooser
= new JFileChooser(dirPrefix
);
635 String headerDest
= null;
637 chooser
.setMultiSelectionEnabled(false);
638 chooser
.setFileSelectionMode(JFileChooser
.FILES_AND_DIRECTORIES
);
639 int retval
= chooser
.showOpenDialog(frame
);
640 if (retval
== JFileChooser
.APPROVE_OPTION
) {
642 theFile
= chooser
.getSelectedFile();
643 String file
= theFile
.getPath();
644 if (!file
.startsWith(dirPrefix
)) {
645 JOptionPane
.showMessageDialog(frame
, "You can only select files in current package!");
655 headerDest
= theFile
.getPath();
656 int fileIndex
= headerDest
.indexOf(System
.getProperty("file.separator"), dirPrefix
.length());
657 jTextField
.setText(headerDest
.substring(fileIndex
+ 1).replace('\\', '/'));
663 return jButtonBrowse
;
666 public void componentResized(ComponentEvent arg0
) {
667 int intPreferredWidth
= 500;
669 resizeComponentWidth(this.jTextFieldAdd
, this.getWidth(), intPreferredWidth
);
670 resizeComponentWidth(this.jTextFieldHelp
, this.getWidth(), intPreferredWidth
);
671 resizeComponentWidth(this.jScrollPane
, this.getWidth(), intPreferredWidth
);
675 * This method initializes jTextFieldHelp
677 * @return javax.swing.JTextField
679 private JTextField
getJTextFieldHelp() {
680 if (jTextFieldHelp
== null) {
681 jTextFieldHelp
= new JTextField();
682 jTextFieldHelp
.setBounds(new java
.awt
.Rectangle(122,33,390,20));
683 jTextFieldHelp
.setPreferredSize(new java
.awt
.Dimension(260,20));
685 return jTextFieldHelp
;
689 * This method initializes jTextField1
691 * @return javax.swing.JTextField
693 private JTextField
getJTextField1() {
694 if (jTextField1
== null) {
695 jTextField1
= new JTextField();
696 jTextField1
.setBounds(new java
.awt
.Rectangle(218,110,291,20));
697 jTextField1
.setEnabled(true);
698 jTextField1
.setVisible(false);
704 * This method initializes jTextField2
706 * @return javax.swing.JTextField
708 private JTextField
getJTextField2() {
709 if (jTextField2
== null) {
710 jTextField2
= new JTextField();
711 jTextField2
.setBounds(new java
.awt
.Rectangle(218,135,292,20));
712 jTextField2
.setEnabled(true);
717 private JScrollPane
getJScrollPaneArch() {
718 if (jScrollPaneArch
== null) {
719 jScrollPaneArch
= new JScrollPane();
720 jScrollPaneArch
.setBounds(new java
.awt
.Rectangle(218,245,293,73));
721 jScrollPaneArch
.setPreferredSize(new java
.awt
.Dimension(320, 80));
722 jScrollPaneArch
.setViewportView(getICheckBoxListSupportedArchitectures());
724 return jScrollPaneArch
;
727 private ICheckBoxList
getICheckBoxListSupportedArchitectures() {
728 if (iCheckBoxListArch
== null) {
729 iCheckBoxListArch
= new ICheckBoxList();
730 iCheckBoxListArch
.setBounds(new java
.awt
.Rectangle(218,246,292,73));
731 Vector
<String
> v
= new Vector
<String
>();
738 v
.add("DXE_RUNTIME_DRIVER");
739 v
.add("DXE_SAL_DRIVER");
740 v
.add("DXE_SMM_DRIVER");
741 v
.add("UEFI_DRIVER");
742 v
.add("UEFI_APPLICATION");
743 v
.add("USER_DEFINED");
744 iCheckBoxListArch
.setAllItems(v
);
746 return iCheckBoxListArch
;
749 private String
vectorToString(Vector
<String
> v
) {
751 for (int i
= 0; i
< v
.size(); ++i
) {
758 private JScrollPane
getJScrollPane1() {
759 if (jScrollPane1
== null) {
760 jScrollPane1
= new JScrollPane();
761 jScrollPane1
.setBounds(new java
.awt
.Rectangle(218,170,293,73));
762 jScrollPane1
.setPreferredSize(new java
.awt
.Dimension(320, 80));
763 jScrollPane1
.setViewportView(getICheckBoxList());
768 * This method initializes iCheckBoxList
770 * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
772 private ICheckBoxList
getICheckBoxList() {
773 if (iCheckBoxList
== null) {
774 iCheckBoxList
= new ICheckBoxList();
775 iCheckBoxList
.setBounds(new java
.awt
.Rectangle(218,171,292,66));
776 Vector
<String
> v
= new Vector
<String
>();
783 iCheckBoxList
.setAllItems(v
);
785 return iCheckBoxList
;
789 * This method initializes jComboBox
791 * @return javax.swing.JComboBox
793 private JComboBox
getJComboBox() {
794 if (jComboBox
== null) {
795 jComboBox
= new JComboBox();
796 jComboBox
.setPreferredSize(new java
.awt
.Dimension(31,20));
797 jComboBox
.setSize(new java
.awt
.Dimension(290,20));
798 jComboBox
.setLocation(new java
.awt
.Point(218,111));
799 jComboBox
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
800 public void focusGained(java
.awt
.event
.FocusEvent e
) {
801 if (jTextFieldAdd
.getText().length() == 0) {
804 jComboBox
.removeAllItems();
805 getLibInstances(jTextFieldAdd
.getText());
806 Set
<String
> libNames
= libNameGuidMap
.keySet();
807 Iterator
<String
> si
= libNames
.iterator();
808 while(si
.hasNext()) {
809 jComboBox
.addItem(si
.next());
818 private void getLibInstances(String libClass
){
819 libNameGuidMap
.clear();
821 GlobalData
.initInfo("Tools" + File
.separator
+ "Conf" + File
.separator
+ "FrameworkDatabase.db", System
.getenv("WORKSPACE"));
823 Set
<PackageIdentification
> spi
= GlobalData
.getPackageList();
824 Iterator ispi
= spi
.iterator();
826 while (ispi
.hasNext()) {
827 PackageIdentification pi
= (PackageIdentification
) ispi
.next();
829 Set
<ModuleIdentification
> smi
= GlobalData
.getModules(pi
);
830 Iterator ismi
= smi
.iterator();
831 while (ismi
.hasNext()) {
832 ModuleIdentification mi
= (ModuleIdentification
) ismi
.next();
833 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
834 SurfaceAreaQuery
.setDoc(m
);
835 String
[] classProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED");
836 for (int i
= 0; i
< classProduced
.length
; ++i
) {
837 if (classProduced
[i
].equals(libClass
)) {
838 libNameGuidMap
.put(mi
.getName(), mi
.getGuid());
845 JOptionPane
.showMessageDialog(frame
, "Search Instances Fail.");