]>
Commit | Line | Data |
---|---|---|
a13899c5 | 1 | /** @file\r |
2 | Java class SpdLibClassDecls is GUI for create library definition elements of spd file.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | **/\r | |
13 | package org.tianocore.frameworkwizard.packaging.ui;\r | |
14 | \r | |
a13899c5 | 15 | import java.awt.Dimension;\r |
c777d1d4 | 16 | import java.awt.FontMetrics;\r |
a13899c5 | 17 | import java.awt.event.ActionEvent;\r |
a13899c5 | 18 | import java.awt.event.ComponentEvent;\r |
a13899c5 | 19 | import java.io.File;\r |
af25df16 | 20 | import java.util.HashMap;\r |
5a502bd4 | 21 | //import java.util.Iterator;\r |
22 | //import java.util.Set;\r | |
a13899c5 | 23 | import java.util.Vector;\r |
24 | \r | |
25 | import javax.swing.AbstractAction;\r | |
a13899c5 | 26 | import javax.swing.JFileChooser;\r |
27 | import javax.swing.JOptionPane;\r | |
28 | import javax.swing.JPanel;\r | |
a13899c5 | 29 | import javax.swing.JTable;\r |
30 | import javax.swing.JTextField;\r | |
0a35c6e2 | 31 | import javax.swing.JTextArea;\r |
a13899c5 | 32 | import javax.swing.JComboBox;\r |
33 | import javax.swing.JLabel;\r | |
a13899c5 | 34 | import javax.swing.JScrollPane;\r |
35 | import javax.swing.JButton;\r | |
36 | import javax.swing.JFrame;\r | |
37 | import javax.swing.ListSelectionModel;\r | |
38 | import javax.swing.event.InternalFrameAdapter;\r | |
39 | import javax.swing.event.InternalFrameEvent;\r | |
40 | import javax.swing.event.ListSelectionEvent;\r | |
41 | import javax.swing.event.ListSelectionListener;\r | |
42 | import javax.swing.event.TableModelEvent;\r | |
43 | import javax.swing.event.TableModelListener;\r | |
44 | import javax.swing.table.DefaultTableModel;\r | |
5a502bd4 | 45 | import javax.swing.table.TableColumn;\r |
a13899c5 | 46 | import javax.swing.table.TableModel;\r |
a13899c5 | 47 | import org.tianocore.PackageSurfaceAreaDocument;\r |
0a35c6e2 | 48 | import org.tianocore.frameworkwizard.common.DataType;\r |
ce73a791 | 49 | import org.tianocore.frameworkwizard.common.DataValidation;\r |
5a502bd4 | 50 | //import org.tianocore.frameworkwizard.common.GlobalData;\r |
a13899c5 | 51 | import org.tianocore.frameworkwizard.common.Tools;\r |
d6d24759 | 52 | import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;\r |
a13899c5 | 53 | import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r |
54 | import org.tianocore.frameworkwizard.common.ui.StarLabel;\r | |
55 | import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r | |
ce73a791 | 56 | import org.tianocore.frameworkwizard.platform.ui.ListEditor;\r |
fbf730ff | 57 | import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;\r |
5a502bd4 | 58 | //import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r |
59 | //import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r | |
a13899c5 | 60 | \r |
a13899c5 | 61 | \r |
62 | /**\r | |
63 | GUI for create library definition elements of spd file.\r | |
64 | \r | |
65 | @since PackageEditor 1.0\r | |
66 | **/\r | |
67 | public class SpdLibClassDecls extends IInternalFrame implements TableModelListener{\r | |
ce73a791 | 68 | /**\r |
69 | * \r | |
70 | */\r | |
71 | private static final long serialVersionUID = 1L;\r | |
72 | \r | |
a13899c5 | 73 | static JFrame frame;\r |
74 | \r | |
75 | private JTable jTable = null;\r | |
76 | \r | |
77 | private DefaultTableModel model = null;\r | |
78 | \r | |
79 | private JPanel jContentPane = null;\r | |
80 | \r | |
0a35c6e2 | 81 | private JTextField jTextFieldAddClass = null;\r |
a13899c5 | 82 | \r |
83 | private JComboBox jComboBoxSelect = null;\r | |
84 | \r | |
0a35c6e2 | 85 | private JScrollPane jScrollPaneTable = null;\r |
a13899c5 | 86 | \r |
87 | private JButton jButtonAdd = null;\r | |
88 | \r | |
89 | private JButton jButtonRemove = null;\r | |
90 | \r | |
97796eaa | 91 | private JButton jButtonRemoveAll = null;\r |
a13899c5 | 92 | \r |
97796eaa | 93 | private JLabel jLabelHdr = null;\r |
a13899c5 | 94 | \r |
97796eaa | 95 | private JTextField jTextFieldHdr = null;\r |
a13899c5 | 96 | \r |
97 | private JButton jButtonBrowse = null;\r | |
98 | \r | |
0a35c6e2 | 99 | private StarLabel starLabel1 = null;\r |
a13899c5 | 100 | \r |
0a35c6e2 | 101 | private StarLabel starLabel3 = null;\r |
a13899c5 | 102 | \r |
103 | private SpdFileContents sfc = null;\r | |
d6d24759 | 104 | \r |
105 | private OpeningPackageType docConsole = null;\r | |
a13899c5 | 106 | \r |
2f8a7517 | 107 | private JLabel jLabel1ClassName = null;\r |
a13899c5 | 108 | \r |
109 | private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="10,53"\r | |
110 | \r | |
111 | private int selectedRow = -1;\r | |
112 | \r | |
0a35c6e2 | 113 | private StarLabel starLabel2 = null;\r |
a13899c5 | 114 | \r |
2f8a7517 | 115 | private JLabel jLabel2HelpText = null;\r |
a13899c5 | 116 | \r |
0a35c6e2 | 117 | private JTextArea jTextAreaHelp = null;\r |
118 | \r | |
119 | private JScrollPane jHelpTextScrollPane = null;\r | |
a13899c5 | 120 | \r |
2f8a7517 | 121 | private JLabel jLabel5SupArchList = null;\r |
a13899c5 | 122 | \r |
2f8a7517 | 123 | private JLabel jLabel6SupModList = null;\r |
a13899c5 | 124 | \r |
97796eaa | 125 | private JScrollPane jScrollPaneModules = null;\r |
a13899c5 | 126 | \r |
97796eaa | 127 | private JScrollPane jScrollPane1Arch = null;\r |
af25df16 | 128 | \r |
97796eaa | 129 | private ICheckBoxList iCheckBoxListModules = null;\r |
a13899c5 | 130 | \r |
4da2e625 | 131 | private ICheckBoxList iCheckBoxListArch = null;\r |
af25df16 | 132 | \r |
97796eaa | 133 | private int cnClassName = 0;\r |
134 | private int cnHdrFile = 1;\r | |
135 | private int cnHelpText = 2;\r | |
5a502bd4 | 136 | // private int cnRecInstName = 3;\r |
137 | // private int cnRecInstVer = 4;\r | |
97796eaa | 138 | private int cnSupArch = 5;\r |
139 | private int cnSupMod = 6;\r | |
5a502bd4 | 140 | \r |
141 | private final int classNameMinWidth = 200;\r | |
142 | private final int hdrFileMinWidth = 300;\r | |
143 | private final int helpTextMinWidth = 300;\r | |
144 | private final int supArchMinWidth = 200;\r | |
145 | private final int supModMinWidth = 200;\r | |
0a35c6e2 | 146 | \r |
147 | private final int shortLabel = 90;\r | |
148 | private final int longLabel = 220;\r | |
149 | private final int labelCol = 12;\r | |
150 | private final int shortValueCol = labelCol + shortLabel + 6;\r | |
151 | private final int longValueCol = labelCol + longLabel + 6;\r | |
152 | private final int longValueWidth = 347;\r | |
153 | private final int shortWidth = 140;\r | |
154 | private final int medWidth = 240;\r | |
155 | \r | |
156 | private final int buttonWidth = 99;\r | |
157 | \r | |
158 | private final int addButtonCol = shortValueCol + 10;\r | |
159 | private final int removeButtonCol = addButtonCol + buttonWidth + 10;\r | |
160 | private final int removeAllButtonCol = removeButtonCol + buttonWidth + 10;\r | |
161 | \r | |
162 | private final int rowOne = 12;\r | |
163 | private final int rowTwo = rowOne + 25;\r | |
164 | private final int rowThree = rowTwo + 60 + 25;\r | |
165 | private final int rowFour = rowThree + 25;\r | |
166 | private final int rowFive = rowFour + 40 + 25;\r | |
167 | private final int rowSix = rowFive + 40 + 25;\r | |
168 | private final int rowSeven = rowSix;\r | |
169 | private final int rowEight = rowSeven + 30;\r | |
170 | \r | |
af25df16 | 171 | HashMap<String, String> libNameGuidMap = new HashMap<String, String>();\r |
ce73a791 | 172 | \r |
ce73a791 | 173 | \r |
a13899c5 | 174 | /**\r |
175 | This method initializes this\r | |
176 | \r | |
177 | **/\r | |
178 | private void initialize() {\r | |
179 | \r | |
180 | this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r | |
181 | \r | |
182 | }\r | |
183 | \r | |
a13899c5 | 184 | /**\r |
0a35c6e2 | 185 | This method initializes jTextFieldAddClass \r |
a13899c5 | 186 | \r |
187 | @return javax.swing.JTextField \r | |
188 | **/\r | |
0a35c6e2 | 189 | private JTextField getJTextFieldAddClass() {\r |
190 | if (jTextFieldAddClass == null) {\r | |
191 | jTextFieldAddClass = new JTextField();\r | |
192 | jTextFieldAddClass.setBounds(new java.awt.Rectangle(shortValueCol,rowOne,longValueWidth,20));\r | |
193 | jTextFieldAddClass.setPreferredSize(new java.awt.Dimension(longValueWidth,20));\r | |
194 | jTextFieldAddClass.setEnabled(true);\r | |
a13899c5 | 195 | }\r |
0a35c6e2 | 196 | return jTextFieldAddClass;\r |
a13899c5 | 197 | }\r |
198 | \r | |
199 | /**\r | |
200 | This method initializes jComboBoxSelect \r | |
201 | \r | |
202 | @return javax.swing.JComboBox \r | |
203 | **/\r | |
204 | private JComboBox getJComboBoxSelect() {\r | |
205 | if (jComboBoxSelect == null) {\r | |
206 | jComboBoxSelect = new JComboBox();\r | |
207 | jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20));\r | |
208 | jComboBoxSelect.setPreferredSize(new java.awt.Dimension(260,22));\r | |
209 | jComboBoxSelect.setEnabled(true);\r | |
210 | jComboBoxSelect.setVisible(false);\r | |
211 | }\r | |
212 | return jComboBoxSelect;\r | |
213 | }\r | |
214 | \r | |
215 | /**\r | |
0a35c6e2 | 216 | This method initializes jScrollPaneTable \r |
a13899c5 | 217 | \r |
218 | @return javax.swing.JScrollPane \r | |
97796eaa | 219 | \r |
220 | Used for the Table of Library Classes that are provided by this package\r | |
221 | \r | |
a13899c5 | 222 | **/\r |
0a35c6e2 | 223 | private JScrollPane getJScrollPaneTable() {\r |
224 | if (jScrollPaneTable == null) {\r | |
225 | jScrollPaneTable = new JScrollPane();\r | |
226 | jScrollPaneTable.setBounds(new java.awt.Rectangle(labelCol,rowEight,400,253));\r | |
227 | jScrollPaneTable.setViewportView(getJTable());\r | |
a13899c5 | 228 | }\r |
0a35c6e2 | 229 | return jScrollPaneTable;\r |
a13899c5 | 230 | }\r |
231 | \r | |
232 | /**\r | |
233 | This method initializes jTable \r | |
234 | \r | |
235 | @return javax.swing.JTable \r | |
236 | **/\r | |
237 | private JTable getJTable() {\r | |
238 | if (jTable == null) {\r | |
239 | model = new DefaultTableModel();\r | |
240 | jTable = new JTable(model);\r | |
241 | jTable.setRowHeight(20);\r | |
d129bd96 | 242 | jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r |
97796eaa | 243 | jTable.setColumnSelectionAllowed(false);\r |
244 | model.addColumn("Class Name");\r | |
245 | model.addColumn("Header");\r | |
246 | model.addColumn("Help Text");\r | |
d129bd96 | 247 | model.addColumn("Recommended Instance");\r |
248 | model.addColumn("Version");\r | |
816ea437 | 249 | model.addColumn("Supported Architectures");\r |
250 | model.addColumn("Supported Module Types");\r | |
ce73a791 | 251 | \r |
fbf730ff | 252 | jTable.getColumnModel().getColumn(cnHelpText).setCellEditor(new LongTextEditor());\r |
253 | \r | |
5a502bd4 | 254 | jTable.removeColumn(jTable.getColumnModel().getColumn(3));\r |
255 | jTable.removeColumn(jTable.getColumnModel().getColumn(3));\r | |
256 | \r | |
ce73a791 | 257 | Vector<String> vArch = new Vector<String>();\r |
258 | vArch.add("IA32");\r | |
259 | vArch.add("X64");\r | |
260 | vArch.add("IPF");\r | |
261 | vArch.add("EBC");\r | |
262 | vArch.add("ARM");\r | |
263 | vArch.add("PPC");\r | |
5a502bd4 | 264 | jTable.getColumnModel().getColumn(cnSupArch - 2).setCellEditor(new ListEditor(vArch));\r |
ce73a791 | 265 | \r |
266 | Vector<String> vModule = new Vector<String>();\r | |
267 | vModule.add("BASE");\r | |
268 | vModule.add("SEC");\r | |
269 | vModule.add("PEI_CORE");\r | |
270 | vModule.add("PEIM");\r | |
271 | vModule.add("DXE_CORE");\r | |
272 | vModule.add("DXE_DRIVER");\r | |
273 | vModule.add("DXE_RUNTIME_DRIVER");\r | |
274 | vModule.add("DXE_SAL_DRIVER");\r | |
275 | vModule.add("DXE_SMM_DRIVER");\r | |
276 | vModule.add("UEFI_DRIVER");\r | |
277 | vModule.add("UEFI_APPLICATION");\r | |
278 | vModule.add("USER_DEFINED");\r | |
97796eaa | 279 | \r |
5a502bd4 | 280 | jTable.getColumnModel().getColumn(cnSupMod - 2).setCellEditor(new ListEditor(vModule));\r |
281 | \r | |
282 | TableColumn column = jTable.getColumnModel().getColumn(this.cnClassName);\r | |
283 | column.setMinWidth(this.classNameMinWidth);\r | |
284 | column = jTable.getColumnModel().getColumn(this.cnHdrFile);\r | |
285 | column.setMinWidth(this.hdrFileMinWidth);\r | |
286 | column = jTable.getColumnModel().getColumn(this.cnHelpText);\r | |
287 | column.setMinWidth(this.helpTextMinWidth);\r | |
288 | column = jTable.getColumnModel().getColumn(this.cnSupArch - 2);\r | |
289 | column.setMinWidth(this.supArchMinWidth);\r | |
290 | column = jTable.getColumnModel().getColumn(this.cnSupMod - 2);\r | |
291 | column.setMinWidth(this.supModMinWidth);\r | |
292 | \r | |
a13899c5 | 293 | jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r |
294 | jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){\r | |
295 | public void valueChanged(ListSelectionEvent e) {\r | |
296 | if (e.getValueIsAdjusting()){\r | |
297 | return;\r | |
298 | }\r | |
299 | ListSelectionModel lsm = (ListSelectionModel)e.getSource();\r | |
300 | if (lsm.isSelectionEmpty()) {\r | |
301 | return;\r | |
302 | }\r | |
303 | else{\r | |
304 | selectedRow = lsm.getMinSelectionIndex();\r | |
305 | }\r | |
306 | }\r | |
307 | });\r | |
308 | \r | |
309 | jTable.getModel().addTableModelListener(this);\r | |
310 | \r | |
311 | }\r | |
312 | return jTable;\r | |
313 | }\r | |
314 | \r | |
315 | \r | |
316 | public void tableChanged(TableModelEvent arg0) {\r | |
317 | // TODO Auto-generated method stub\r | |
318 | int row = arg0.getFirstRow();\r | |
a490bca8 | 319 | int column = arg0.getColumn();\r |
a13899c5 | 320 | TableModel m = (TableModel)arg0.getSource();\r |
321 | if (arg0.getType() == TableModelEvent.UPDATE){\r | |
a490bca8 | 322 | \r |
97796eaa | 323 | String lib = m.getValueAt(row, cnClassName) + "";\r |
324 | String hdr = m.getValueAt(row, cnHdrFile) + "";\r | |
325 | String hlp = m.getValueAt(row, cnHelpText) + "";\r | |
a490bca8 | 326 | String name = null;\r |
5a502bd4 | 327 | // if (m.getValueAt(row, cnRecInstName) != null) {\r |
328 | // name = m.getValueAt(row, cnRecInstName).toString();\r | |
329 | // } \r | |
330 | // String ver = null;\r | |
331 | // if (m.getValueAt(row, cnRecInstVer) != null){\r | |
332 | // ver = m.getValueAt(row, cnRecInstVer).toString();\r | |
333 | // }\r | |
a13899c5 | 334 | String arch = null;\r |
97796eaa | 335 | if (m.getValueAt(row, cnSupArch) != null) {\r |
336 | arch = m.getValueAt(row, cnSupArch).toString();\r | |
a13899c5 | 337 | }\r |
338 | String module = null;\r | |
97796eaa | 339 | if (m.getValueAt(row, cnSupMod) != null) {\r |
340 | module = m.getValueAt(row, cnSupMod).toString();\r | |
a13899c5 | 341 | }\r |
5a502bd4 | 342 | String[] rowData = {lib, hdr, hlp, name};\r |
ce73a791 | 343 | if (!dataValidation(rowData)) {\r |
344 | return;\r | |
345 | }\r | |
12e17a0a | 346 | \r |
a490bca8 | 347 | String guid = null;\r |
5a502bd4 | 348 | // if (name != null && name.length() > 0) {\r |
349 | // getLibInstances(lib);\r | |
350 | // guid = nameToGuid(name);\r | |
351 | // if (guid == null){\r | |
352 | // JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");\r | |
353 | // return;\r | |
354 | // }\r | |
355 | // }\r | |
12e17a0a | 356 | \r |
a490bca8 | 357 | String[] sa = new String[7];\r |
358 | sfc.getSpdLibClassDeclaration(sa, row);\r | |
359 | Object cellData = m.getValueAt(row, column);\r | |
360 | if (cellData == null) {\r | |
361 | cellData = "";\r | |
362 | }\r | |
5a502bd4 | 363 | // if (column == cnRecInstName) {\r |
364 | // if (guid == null) {\r | |
365 | // if (sa[cnRecInstName] == null) {\r | |
366 | // return;\r | |
367 | // }\r | |
368 | // }\r | |
369 | // else {\r | |
370 | // if (guid.equals(sa[cnRecInstName])) {\r | |
371 | // return;\r | |
372 | // }\r | |
373 | // }\r | |
374 | // }\r | |
375 | if (cellData.equals(sa[column])) {\r | |
376 | return;\r | |
a490bca8 | 377 | }\r |
5a502bd4 | 378 | if (cellData.toString().length() == 0 && sa[column] == null) {\r |
379 | return;\r | |
a490bca8 | 380 | }\r |
381 | docConsole.setSaved(false);\r | |
5a502bd4 | 382 | sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, null, arch, module);\r |
a13899c5 | 383 | }\r |
384 | }\r | |
385 | \r | |
386 | /**\r | |
387 | This method initializes jButtonAdd \r | |
388 | \r | |
389 | @return javax.swing.JButton \r | |
390 | **/\r | |
391 | private JButton getJButtonAdd() {\r | |
392 | if (jButtonAdd == null) {\r | |
393 | jButtonAdd = new JButton();\r | |
a13899c5 | 394 | jButtonAdd.setText("Add");\r |
0a35c6e2 | 395 | jButtonAdd.setSize(new java.awt.Dimension(buttonWidth,20));\r |
396 | jButtonAdd.setBounds(new java.awt.Rectangle(addButtonCol,rowSeven,buttonWidth,20));\r | |
a13899c5 | 397 | jButtonAdd.addActionListener(this);\r |
398 | }\r | |
399 | return jButtonAdd;\r | |
400 | }\r | |
401 | \r | |
402 | /**\r | |
403 | This method initializes jButtonRemove \r | |
404 | \r | |
405 | @return javax.swing.JButton \r | |
406 | **/\r | |
407 | private JButton getJButtonRemove() {\r | |
408 | if (jButtonRemove == null) {\r | |
409 | jButtonRemove = new JButton();\r | |
62df8efa | 410 | jButtonRemove.setText("Delete");\r |
0a35c6e2 | 411 | jButtonRemove.setSize(new java.awt.Dimension(buttonWidth,20));\r |
412 | jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowSeven,buttonWidth,20));\r | |
a13899c5 | 413 | jButtonRemove.addActionListener(this);\r |
414 | }\r | |
415 | return jButtonRemove;\r | |
416 | }\r | |
417 | \r | |
418 | /**\r | |
419 | This method initializes jButtonRemoveAll \r | |
420 | \r | |
421 | @return javax.swing.JButton \r | |
422 | **/\r | |
97796eaa | 423 | private JButton getJButtonRemoveAll() {\r |
424 | if (jButtonRemoveAll == null) {\r | |
425 | jButtonRemoveAll = new JButton();\r | |
62df8efa | 426 | jButtonRemoveAll.setText("Clear All");\r |
c777d1d4 | 427 | jButtonRemoveAll.setLocation(removeAllButtonCol,rowSeven);\r |
428 | FontMetrics fm = jButtonRemoveAll.getFontMetrics(jButtonRemoveAll.getFont());\r | |
429 | jButtonRemoveAll.setSize(fm.stringWidth(jButtonRemoveAll.getText()) + 50, 20);\r | |
97796eaa | 430 | jButtonRemoveAll.addActionListener(this);\r |
a13899c5 | 431 | }\r |
97796eaa | 432 | return jButtonRemoveAll;\r |
a13899c5 | 433 | }\r |
434 | \r | |
a13899c5 | 435 | /**\r |
436 | This is the default constructor\r | |
437 | **/\r | |
438 | public SpdLibClassDecls() {\r | |
439 | super();\r | |
440 | initialize();\r | |
441 | init();\r | |
442 | \r | |
443 | }\r | |
444 | \r | |
445 | public SpdLibClassDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa){\r | |
446 | this();\r | |
447 | sfc = new SpdFileContents(inPsa);\r | |
448 | init(sfc);\r | |
449 | }\r | |
d6d24759 | 450 | \r |
451 | public SpdLibClassDecls(OpeningPackageType opt) {\r | |
452 | this(opt.getXmlSpd());\r | |
453 | docConsole = opt;\r | |
454 | }\r | |
a13899c5 | 455 | /**\r |
456 | This method initializes this\r | |
457 | \r | |
458 | @return void\r | |
459 | **/\r | |
460 | private void init() {\r | |
461 | \r | |
462 | this.setContentPane(getJContentPane());\r | |
463 | this.setTitle("Library Class Declarations");\r | |
464 | this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));\r | |
465 | this.setVisible(true);\r | |
466 | this.addInternalFrameListener(new InternalFrameAdapter(){\r | |
467 | public void internalFrameDeactivated(InternalFrameEvent e){\r | |
468 | if (jTable.isEditing()) {\r | |
469 | jTable.getCellEditor().stopCellEditing();\r | |
470 | }\r | |
471 | }\r | |
472 | });\r | |
a13899c5 | 473 | }\r |
474 | \r | |
475 | private void init(SpdFileContents sfc) {\r | |
62df8efa | 476 | \r |
477 | if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r | |
478 | JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");\r | |
479 | }\r | |
480 | initFrame();\r | |
481 | \r | |
a13899c5 | 482 | if (sfc.getSpdLibClassDeclarationCount() == 0) {\r |
483 | return ;\r | |
484 | }\r | |
485 | //\r | |
486 | // initialize table using SpdFileContents object\r | |
487 | //\r | |
488 | String[][] saa = new String[sfc.getSpdLibClassDeclarationCount()][7];\r | |
489 | sfc.getSpdLibClassDeclarations(saa);\r | |
490 | int i = 0;\r | |
491 | while (i < saa.length) {\r | |
5a502bd4 | 492 | // if (saa[i][3] != null && saa[i][3].length() > 0) {\r |
493 | // getLibInstances(saa[i][0]);\r | |
494 | // saa[i][3] = guidToName(saa[i][3]);\r | |
495 | // }\r | |
12e17a0a | 496 | \r |
a13899c5 | 497 | model.addRow(saa[i]);\r |
498 | i++;\r | |
499 | }\r | |
62df8efa | 500 | \r |
a13899c5 | 501 | }\r |
62df8efa | 502 | \r |
503 | private void initFrame() {\r | |
504 | boolean editable = true;\r | |
505 | if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r | |
506 | editable = false;\r | |
507 | }\r | |
508 | \r | |
509 | jButtonAdd.setEnabled(editable);\r | |
510 | jButtonRemove.setEnabled(editable);\r | |
511 | jButtonRemoveAll.setEnabled(editable);\r | |
512 | jTable.setEnabled(editable);\r | |
513 | }\r | |
514 | \r | |
a13899c5 | 515 | private JScrollPane getJContentPane(){\r |
516 | if (topScrollPane == null){\r | |
517 | topScrollPane = new JScrollPane();\r | |
a13899c5 | 518 | topScrollPane.setViewportView(getJContentPane1());\r |
519 | }\r | |
520 | return topScrollPane;\r | |
521 | }\r | |
522 | /**\r | |
523 | This method initializes jContentPane\r | |
524 | \r | |
525 | @return javax.swing.JPanel\r | |
526 | **/\r | |
527 | private JPanel getJContentPane1() {\r | |
528 | if (jContentPane == null) {\r | |
97796eaa | 529 | // Library Class\r |
0a35c6e2 | 530 | starLabel1 = new StarLabel();\r |
531 | starLabel1.setLocation(new java.awt.Point(1,rowOne));\r | |
97796eaa | 532 | jLabel1ClassName = new JLabel();\r |
0a35c6e2 | 533 | jLabel1ClassName.setBounds(new java.awt.Rectangle(labelCol,rowOne,shortLabel,20));\r |
97796eaa | 534 | jLabel1ClassName.setText("Library Class");\r |
535 | \r | |
536 | // Help Text\r | |
0a35c6e2 | 537 | starLabel2 = new StarLabel();\r |
538 | starLabel2.setBounds(new java.awt.Rectangle(1,rowTwo,10,20));\r | |
97796eaa | 539 | jLabel2HelpText = new JLabel();\r |
0a35c6e2 | 540 | jLabel2HelpText.setBounds(new java.awt.Rectangle(labelCol,rowTwo,shortLabel,20));\r |
97796eaa | 541 | jLabel2HelpText.setText("Help Text");\r |
542 | \r | |
543 | // Header File\r | |
0a35c6e2 | 544 | starLabel3 = new StarLabel();\r |
545 | starLabel3.setLocation(new java.awt.Point(1,rowThree));\r | |
97796eaa | 546 | jLabelHdr = new JLabel();\r |
0a35c6e2 | 547 | jLabelHdr.setBounds(new java.awt.Rectangle(labelCol,rowThree,longLabel,20));\r |
97796eaa | 548 | jLabelHdr.setText("Include Header for Specified Class");\r |
549 | \r | |
2f8a7517 | 550 | jLabel6SupModList = new JLabel();\r |
0a35c6e2 | 551 | jLabel6SupModList.setBounds(new java.awt.Rectangle(labelCol,rowFive,longLabel,20));\r |
552 | jLabel6SupModList.setText("Supported Module Types");\r | |
2f8a7517 | 553 | jLabel6SupModList.setEnabled(true);\r |
97796eaa | 554 | \r |
2f8a7517 | 555 | jLabel5SupArchList = new JLabel();\r |
0a35c6e2 | 556 | jLabel5SupArchList.setBounds(new java.awt.Rectangle(labelCol,rowFour,longLabel,20));\r |
557 | jLabel5SupArchList.setText("Supported Architectures");\r | |
2f8a7517 | 558 | jLabel5SupArchList.setEnabled(true);\r |
0a35c6e2 | 559 | \r |
a13899c5 | 560 | jContentPane = new JPanel();\r |
1be13d3f | 561 | jContentPane.setPreferredSize(new Dimension(680, 600));\r |
a13899c5 | 562 | jContentPane.setLayout(null);\r |
97796eaa | 563 | jContentPane.add(jLabelHdr, null);\r |
0a35c6e2 | 564 | jContentPane.add(starLabel1, null);\r |
565 | jContentPane.add(starLabel3, null);\r | |
566 | jContentPane.add(getJTextFieldAddClass(), null);\r | |
a13899c5 | 567 | jContentPane.add(getJComboBoxSelect(), null);\r |
0a35c6e2 | 568 | jContentPane.add(getJScrollPaneTable(), null);\r |
a13899c5 | 569 | jContentPane.add(getJButtonAdd(), null);\r |
570 | jContentPane.add(getJButtonRemove(), null);\r | |
97796eaa | 571 | jContentPane.add(getJButtonRemoveAll(), null);\r |
a13899c5 | 572 | \r |
97796eaa | 573 | jContentPane.add(getJTextFieldHdr(), null);\r |
a13899c5 | 574 | jContentPane.add(getJButtonBrowse(), null);\r |
2f8a7517 | 575 | jContentPane.add(jLabel1ClassName, null);\r |
0a35c6e2 | 576 | jContentPane.add(starLabel2, null);\r |
2f8a7517 | 577 | jContentPane.add(jLabel2HelpText, null);\r |
0a35c6e2 | 578 | jContentPane.add(getJHelpTextScrollPane(), null);\r |
d129bd96 | 579 | \r |
2f8a7517 | 580 | jContentPane.add(jLabel5SupArchList, null);\r |
581 | jContentPane.add(jLabel6SupModList, null);\r | |
a13899c5 | 582 | \r |
97796eaa | 583 | jContentPane.add(getJScrollPaneModules(), null);\r |
584 | jContentPane.add(getJScrollPane1Arch(), null);\r | |
af25df16 | 585 | \r |
a13899c5 | 586 | }\r |
587 | \r | |
588 | return jContentPane;\r | |
589 | }\r | |
590 | \r | |
a13899c5 | 591 | \r |
592 | /* (non-Javadoc)\r | |
593 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
594 | */\r | |
595 | public void actionPerformed(ActionEvent arg0) {\r | |
d6d24759 | 596 | \r |
a13899c5 | 597 | if (arg0.getSource() == jButtonAdd) {\r |
598 | \r | |
599 | //ToDo: check before add\r | |
2f8a7517 | 600 | // LAH WAS String[] row = {null, null, null, jComboBox.getSelectedItem()+"", jTextField2RecInstVer.getText(), null, null};\r |
601 | String[] row = {null, null, null, null, null, null, null};\r | |
0a35c6e2 | 602 | row[cnClassName] = jTextFieldAddClass.getText();\r |
97796eaa | 603 | row[cnHdrFile] = jTextFieldHdr.getText().replace('\\', '/');\r |
0a35c6e2 | 604 | row[cnHelpText] = jTextAreaHelp.getText();\r |
5a502bd4 | 605 | // row[cnRecInstName] = jComboBox.getSelectedItem()+"";\r |
606 | // row[cnRecInstVer] = jTextField2RecInstVer.getText();\r | |
4da2e625 | 607 | row[cnSupArch] = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());\r |
97796eaa | 608 | if (row[cnSupArch].length() == 0) {\r |
609 | row[cnSupArch] = null;\r | |
a13899c5 | 610 | }\r |
97796eaa | 611 | row[cnSupMod] = vectorToString(iCheckBoxListModules.getAllCheckedItemsString());\r |
612 | if (row[cnSupMod].length() == 0){\r | |
613 | row[cnSupMod] = null;\r | |
a13899c5 | 614 | }\r |
ce73a791 | 615 | if (!dataValidation(row)) {\r |
616 | return;\r | |
617 | }\r | |
12e17a0a | 618 | //\r |
619 | //convert to GUID before storing recommended lib instance.\r | |
620 | //\r | |
5a502bd4 | 621 | // getLibInstances(row[cnClassName]);\r |
622 | // String recommendGuid = nameToGuid(row[cnRecInstName]);\r | |
623 | // if (row[cnRecInstName].equals("null")) {\r | |
624 | // row[cnRecInstName] = null;\r | |
625 | // }\r | |
626 | // else{\r | |
627 | // if (recommendGuid == null) {\r | |
628 | // JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");\r | |
629 | // return;\r | |
630 | // }\r | |
631 | // }\r | |
632 | \r | |
633 | sfc.genSpdLibClassDeclarations(row[cnClassName], null, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, null, null, row[cnSupMod]);\r | |
a490bca8 | 634 | model.addRow(row);\r |
635 | jTable.changeSelection(model.getRowCount()-1, 0, false, false);\r | |
636 | docConsole.setSaved(false);\r | |
a13899c5 | 637 | }\r |
638 | //\r | |
639 | // remove selected line\r | |
640 | //\r | |
641 | if (arg0.getSource() == jButtonRemove) {\r | |
642 | if (jTable.isEditing()){\r | |
643 | jTable.getCellEditor().stopCellEditing();\r | |
644 | }\r | |
645 | int rowSelected = selectedRow;\r | |
646 | if (rowSelected >= 0) {\r | |
647 | model.removeRow(rowSelected);\r | |
d129bd96 | 648 | docConsole.setSaved(false);\r |
a13899c5 | 649 | sfc.removeSpdLibClass(rowSelected);\r |
650 | }\r | |
651 | }\r | |
652 | \r | |
97796eaa | 653 | if (arg0.getSource() == jButtonRemoveAll) {\r |
a13899c5 | 654 | if (model.getRowCount() == 0) {\r |
655 | return;\r | |
656 | }\r | |
d129bd96 | 657 | docConsole.setSaved(false);\r |
a13899c5 | 658 | model.setRowCount(0);\r |
659 | sfc.removeSpdLibClass();\r | |
660 | }\r | |
a13899c5 | 661 | }\r |
662 | \r | |
ce73a791 | 663 | private boolean dataValidation(String[] row) {\r |
97796eaa | 664 | if (!DataValidation.isKeywordType(row[cnClassName])) {\r |
816ea437 | 665 | JOptionPane.showMessageDialog(frame, "Library Class name entered does not match KeyWord datatype.");\r |
ce73a791 | 666 | return false;\r |
667 | }\r | |
97796eaa | 668 | if (!DataValidation.isPathAndFilename(row[cnHdrFile])) {\r |
816ea437 | 669 | JOptionPane.showMessageDialog(frame, "Include Header does not match the PathAndFilename datatype.");\r |
d129bd96 | 670 | return false;\r |
ce73a791 | 671 | }\r |
97796eaa | 672 | if (row[cnHelpText].length() == 0) {\r |
816ea437 | 673 | JOptionPane.showMessageDialog(frame, "Help Text must be entered!");\r |
d129bd96 | 674 | return false;\r |
675 | }\r | |
5a502bd4 | 676 | // if (row[cnRecInstVer] != null && row[cnRecInstVer].length() > 0) {\r |
677 | // if (row[cnRecInstName] == null || row[cnRecInstName].length() == 0) {\r | |
678 | // JOptionPane.showMessageDialog(frame, "Recommended Instance Version must associate with the Instance Name.");\r | |
679 | // return false;\r | |
680 | // }\r | |
681 | // \r | |
682 | // if (!DataValidation.isVersionDataType(row[cnRecInstVer])) {\r | |
683 | // JOptionPane.showMessageDialog(frame, "Recommended Instance Version does not match Version datatype.");\r | |
684 | // return false;\r | |
685 | // }\r | |
686 | // }\r | |
ce73a791 | 687 | return true;\r |
688 | }\r | |
a13899c5 | 689 | /**\r |
690 | Add contents in list to sfc\r | |
691 | **/\r | |
692 | protected void save() {\r | |
693 | \r | |
694 | }\r | |
695 | \r | |
696 | /**\r | |
697 | This method initializes jTextField \r | |
698 | \r | |
699 | @return javax.swing.JTextField \r | |
700 | **/\r | |
97796eaa | 701 | private JTextField getJTextFieldHdr() {\r |
702 | if (jTextFieldHdr == null) {\r | |
703 | jTextFieldHdr = new JTextField();\r | |
0a35c6e2 | 704 | jTextFieldHdr.setPreferredSize(new java.awt.Dimension(shortWidth,20));\r |
705 | jTextFieldHdr.setLocation(new java.awt.Point(longValueCol,rowThree));\r | |
706 | jTextFieldHdr.setSize(new java.awt.Dimension(shortWidth,20));\r | |
a13899c5 | 707 | }\r |
97796eaa | 708 | return jTextFieldHdr;\r |
a13899c5 | 709 | }\r |
710 | \r | |
711 | /**\r | |
712 | This method initializes jButtonBrowse \r | |
713 | \r | |
714 | @return javax.swing.JButton \r | |
715 | **/\r | |
716 | private JButton getJButtonBrowse() {\r | |
717 | if (jButtonBrowse == null) {\r | |
718 | jButtonBrowse = new JButton();\r | |
0a35c6e2 | 719 | jButtonBrowse.setBounds(new java.awt.Rectangle(longValueCol + shortWidth + 7,rowThree,90,20));\r |
a13899c5 | 720 | jButtonBrowse.setText("Browse");\r |
97796eaa | 721 | jButtonBrowse.setPreferredSize(new java.awt.Dimension(99,20));\r |
a13899c5 | 722 | jButtonBrowse.addActionListener(new AbstractAction() {\r |
723 | \r | |
ce73a791 | 724 | /**\r |
725 | * \r | |
726 | */\r | |
727 | private static final long serialVersionUID = 1L;\r | |
728 | \r | |
a13899c5 | 729 | public void actionPerformed(ActionEvent arg0) {\r |
730 | //\r | |
731 | // Select files from current pkg\r | |
732 | //\r | |
733 | String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));\r | |
734 | JFileChooser chooser = new JFileChooser(dirPrefix);\r | |
735 | File theFile = null;\r | |
736 | String headerDest = null;\r | |
737 | \r | |
738 | chooser.setMultiSelectionEnabled(false);\r | |
739 | chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);\r | |
740 | int retval = chooser.showOpenDialog(frame);\r | |
741 | if (retval == JFileChooser.APPROVE_OPTION) {\r | |
742 | \r | |
743 | theFile = chooser.getSelectedFile();\r | |
744 | String file = theFile.getPath();\r | |
745 | if (!file.startsWith(dirPrefix)) {\r | |
816ea437 | 746 | JOptionPane.showMessageDialog(frame, "You can only select files in current package directory structure!");\r |
a13899c5 | 747 | return;\r |
748 | }\r | |
749 | \r | |
750 | \r | |
751 | }\r | |
752 | else {\r | |
753 | return;\r | |
754 | }\r | |
755 | \r | |
756 | headerDest = theFile.getPath();\r | |
757 | int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());\r | |
97796eaa | 758 | jTextFieldHdr.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));\r |
a13899c5 | 759 | \r |
760 | }\r | |
761 | \r | |
762 | });\r | |
763 | }\r | |
764 | return jButtonBrowse;\r | |
765 | }\r | |
766 | \r | |
767 | public void componentResized(ComponentEvent arg0) {\r | |
768 | int intPreferredWidth = 500;\r | |
769 | \r | |
0a35c6e2 | 770 | Tools.resizeComponentWidth(this.jTextFieldAddClass, this.getWidth(), intPreferredWidth-28);\r |
771 | Tools.resizeComponentWidth(this.jHelpTextScrollPane, this.getWidth(), intPreferredWidth-28);\r | |
772 | Tools.resizeComponentWidth(this.jScrollPaneTable, this.getWidth(), intPreferredWidth-10);\r | |
773 | Tools.resizeComponentWidth(this.jTextFieldHdr, this.getWidth(), intPreferredWidth - 7);\r | |
774 | Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), intPreferredWidth,\r | |
775 | DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON); \r | |
a13899c5 | 776 | }\r |
777 | \r | |
778 | /**\r | |
0a35c6e2 | 779 | * This method initializes jHelpTextScrollPane\r |
780 | *\r | |
781 | * @return javax.swing.JScrollPane jHelpTextScrollPane\r | |
a13899c5 | 782 | */\r |
0a35c6e2 | 783 | private JScrollPane getJHelpTextScrollPane() {\r |
784 | if (jHelpTextScrollPane == null) {\r | |
785 | jHelpTextScrollPane = new JScrollPane();\r | |
786 | jHelpTextScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r | |
787 | jHelpTextScrollPane.setPreferredSize(new java.awt.Dimension(longValueWidth, 80));\r | |
788 | jHelpTextScrollPane.setSize(new java.awt.Dimension(longValueWidth, 80));\r | |
789 | jHelpTextScrollPane.setLocation(new java.awt.Point(shortValueCol,rowTwo));\r | |
790 | jHelpTextScrollPane.setViewportView(getJTextAreaHelp());\r | |
a13899c5 | 791 | }\r |
0a35c6e2 | 792 | return jHelpTextScrollPane;\r |
a13899c5 | 793 | }\r |
794 | \r | |
795 | /**\r | |
0a35c6e2 | 796 | * This method initializes jTextAreaHelp \r |
a13899c5 | 797 | * \r |
0a35c6e2 | 798 | * @return javax.swing.JTextArea \r |
a13899c5 | 799 | */\r |
0a35c6e2 | 800 | private JTextArea getJTextAreaHelp() {\r |
801 | if (jTextAreaHelp == null) {\r | |
802 | jTextAreaHelp = new JTextArea();\r | |
803 | jTextAreaHelp.setLineWrap(true);\r | |
804 | jTextAreaHelp.setWrapStyleWord(true);\r | |
a13899c5 | 805 | }\r |
0a35c6e2 | 806 | return jTextAreaHelp;\r |
a13899c5 | 807 | }\r |
808 | \r | |
97796eaa | 809 | private JScrollPane getJScrollPaneModules() {\r |
810 | if (jScrollPaneModules == null) {\r | |
811 | jScrollPaneModules = new JScrollPane();\r | |
0a35c6e2 | 812 | jScrollPaneModules.setBounds(new java.awt.Rectangle(longValueCol,rowFive,medWidth,60));\r |
813 | jScrollPaneModules.setPreferredSize(new java.awt.Dimension(medWidth, 60));\r | |
97796eaa | 814 | jScrollPaneModules.setViewportView(getICheckBoxListSupportedModules());\r |
a13899c5 | 815 | }\r |
97796eaa | 816 | return jScrollPaneModules;\r |
a13899c5 | 817 | }\r |
818 | \r | |
97796eaa | 819 | private ICheckBoxList getICheckBoxListSupportedModules() {\r |
820 | if (iCheckBoxListModules == null) {\r | |
821 | iCheckBoxListModules = new ICheckBoxList();\r | |
0a35c6e2 | 822 | iCheckBoxListModules.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));\r |
a13899c5 | 823 | Vector<String> v = new Vector<String>();\r |
824 | v.add("BASE");\r | |
825 | v.add("SEC");\r | |
826 | v.add("PEI_CORE");\r | |
827 | v.add("PEIM");\r | |
828 | v.add("DXE_CORE");\r | |
829 | v.add("DXE_DRIVER");\r | |
830 | v.add("DXE_RUNTIME_DRIVER");\r | |
831 | v.add("DXE_SAL_DRIVER");\r | |
832 | v.add("DXE_SMM_DRIVER");\r | |
833 | v.add("UEFI_DRIVER");\r | |
834 | v.add("UEFI_APPLICATION");\r | |
835 | v.add("USER_DEFINED");\r | |
97796eaa | 836 | iCheckBoxListModules.setAllItems(v);\r |
a13899c5 | 837 | }\r |
97796eaa | 838 | return iCheckBoxListModules;\r |
a13899c5 | 839 | }\r |
840 | \r | |
a13899c5 | 841 | private String vectorToString(Vector<String> v) {\r |
842 | String s = " ";\r | |
843 | for (int i = 0; i < v.size(); ++i) {\r | |
844 | s += v.get(i);\r | |
845 | s += " ";\r | |
846 | }\r | |
847 | return s.trim();\r | |
848 | }\r | |
af25df16 | 849 | \r |
97796eaa | 850 | private JScrollPane getJScrollPane1Arch() {\r |
851 | if (jScrollPane1Arch == null) {\r | |
852 | jScrollPane1Arch = new JScrollPane();\r | |
0a35c6e2 | 853 | jScrollPane1Arch.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));\r |
854 | jScrollPane1Arch.setPreferredSize(new java.awt.Dimension(medWidth, 60));\r | |
4da2e625 | 855 | jScrollPane1Arch.setViewportView(getICheckBoxListArch());\r |
af25df16 | 856 | }\r |
97796eaa | 857 | return jScrollPane1Arch;\r |
af25df16 | 858 | }\r |
ce73a791 | 859 | /**\r |
af25df16 | 860 | * This method initializes iCheckBoxList \r |
ce73a791 | 861 | * \r |
af25df16 | 862 | * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList \r |
ce73a791 | 863 | */\r |
4da2e625 | 864 | private ICheckBoxList getICheckBoxListArch() {\r |
865 | if (iCheckBoxListArch == null) {\r | |
866 | iCheckBoxListArch = new ICheckBoxList();\r | |
0a35c6e2 | 867 | iCheckBoxListArch.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));\r |
af25df16 | 868 | Vector<String> v = new Vector<String>();\r |
869 | v.add("IA32");\r | |
870 | v.add("X64");\r | |
871 | v.add("IPF");\r | |
872 | v.add("EBC");\r | |
873 | v.add("ARM");\r | |
874 | v.add("PPC");\r | |
4da2e625 | 875 | iCheckBoxListArch.setAllItems(v);\r |
ce73a791 | 876 | }\r |
4da2e625 | 877 | return iCheckBoxListArch;\r |
ce73a791 | 878 | }\r |
879 | \r | |
5a502bd4 | 880 | // private void getLibInstances(String libClass){\r |
881 | // libNameGuidMap.clear();\r | |
882 | // try {\r | |
883 | // Iterator ismi = GlobalData.vModuleList.iterator();\r | |
884 | // while (ismi.hasNext()) {\r | |
885 | // ModuleIdentification mi = (ModuleIdentification) ismi.next();\r | |
886 | // \r | |
887 | // Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r | |
888 | // for (int i = 0; i < classProduced.size(); ++i) {\r | |
889 | // if (classProduced.get(i).equals(libClass)) {\r | |
890 | // libNameGuidMap.put(mi.getName(), mi.getGuid());\r | |
891 | // }\r | |
892 | // }\r | |
893 | // }\r | |
894 | // \r | |
895 | // }\r | |
896 | // catch(Exception e){\r | |
897 | // JOptionPane.showMessageDialog(frame, "Search Instances Failed.");\r | |
898 | // }\r | |
899 | // \r | |
900 | // }\r | |
901 | \r | |
902 | // private String nameToGuid(String name) {\r | |
903 | // String s = null;\r | |
904 | // if (!libNameGuidMap.containsKey(name)) {\r | |
905 | // return s;\r | |
906 | // }\r | |
907 | // \r | |
908 | // s = libNameGuidMap.get(name);\r | |
909 | // return s;\r | |
910 | // }\r | |
12e17a0a | 911 | \r |
5a502bd4 | 912 | // private String guidToName(String guid){\r |
913 | // String s = "";\r | |
914 | // if (!libNameGuidMap.containsValue(guid)) {\r | |
915 | // return s;\r | |
916 | // }\r | |
917 | // Set<String> key = libNameGuidMap.keySet();\r | |
918 | // Iterator<String> is = key.iterator();\r | |
919 | // while(is.hasNext()) {\r | |
920 | // s = is.next();\r | |
921 | // if (libNameGuidMap.get(s).equals(guid)) {\r | |
922 | // break;\r | |
923 | // }\r | |
924 | // }\r | |
925 | // return s;\r | |
926 | // }\r | |
12e17a0a | 927 | \r |
a13899c5 | 928 | }\r |
929 | \r | |
930 | \r |