Do not display token number for Pcd in ModuleSA and Dynamic Pcd editors for FPD file.
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdModuleSA.java
1 package org.tianocore.frameworkwizard.platform.ui;
2
3 import java.awt.BorderLayout;
4 import java.awt.Dimension;
5 import java.awt.Toolkit;
6
7 import javax.swing.JFrame;
8 import javax.swing.JOptionPane;
9 import javax.swing.JPanel;
10 import javax.swing.JDialog;
11 import javax.swing.JTabbedPane;
12 import javax.swing.JLabel;
13 import javax.swing.JScrollPane;
14 import javax.swing.JTable;
15 import javax.swing.JTextArea;
16 import javax.swing.JSplitPane;
17 import javax.swing.JButton;
18 import javax.swing.ListSelectionModel;
19 import javax.swing.event.ListSelectionEvent;
20 import javax.swing.event.ListSelectionListener;
21 import javax.swing.event.TableModelEvent;
22 import javax.swing.event.TableModelListener;
23 import javax.swing.table.DefaultTableModel;
24 import javax.swing.table.TableColumn;
25 import javax.swing.table.TableModel;
26
27 import org.tianocore.frameworkwizard.common.DataValidation;
28 import org.tianocore.frameworkwizard.common.GlobalData;
29 import org.tianocore.frameworkwizard.common.IDefaultTableModel;
30 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
31 import org.tianocore.frameworkwizard.platform.ui.global.LibraryClassDescriptor;
32 import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
33 import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
34 import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
35 import org.tianocore.frameworkwizard.packaging.PackageIdentification;
36
37 import java.awt.FlowLayout;
38 import java.awt.event.ActionEvent;
39 import java.awt.event.ActionListener;
40 import java.util.ArrayList;
41 import java.util.HashMap;
42 import java.util.Iterator;
43 import java.util.ListIterator;
44 import java.util.Vector;
45
46 import javax.swing.JTextField;
47 import java.awt.GridLayout;
48 import javax.swing.JComboBox;
49
50 public class FpdModuleSA extends JDialog implements ActionListener {
51
52 /**
53 *
54 */
55 private static final long serialVersionUID = 1L;
56 static JFrame frame;
57 private JPanel jContentPane = null;
58 private JTabbedPane jTabbedPane = null;
59 private JPanel jPanelPcd = null;
60 private JPanel jPanelLibrary = null;
61 private JLabel jLabelPcdData = null;
62 private JScrollPane jScrollPaneTablePcd = null;
63 private JTable jTablePcd = null;
64 private JPanel jPanelPcdSouth = null;
65 private JScrollPane jScrollPanePcdHelp = null;
66 private JTextArea jTextAreaPcdHelp = null;
67 private JPanel jPanelContentPaneSouth = null;
68 private JSplitPane jSplitPane = null;
69 private JPanel jPanelLibraryLeft = null;
70 private JPanel jPanelLibraryRight = null;
71 private JLabel jLabelLibClass = null;
72 private JLabel jLabelQualifiedInstance = null;
73 private JScrollPane jScrollPaneSelectedInstances = null;
74 private JTable jTableSelectedInstances = null;
75 private JScrollPane jScrollPaneLibClass = null;
76 private JTable jTableLibClass = null;
77 private JScrollPane jScrollPaneQualifiedInstance = null;
78 private JTable jTableLibInstances = null;
79 private JPanel jPanelLibrarySouth = null;
80 private JPanel jPanelLibraryCenter = null;
81 private JScrollPane jScrollPaneInstanceHelp = null;
82 private JTextArea jTextAreaInstanceHelp = null;
83 private JLabel jLabelSelectedInstances = null;
84 private JLabel jLabelInstanceHelp = null;
85 private JButton jButtonAdd = null;
86 private JButton jButtonDeleteInstance = null;
87 private JLabel jLabelPcdHelp = null;
88 private JButton jButtonOk = null;
89 private JButton jButtonCancel = null;
90 private IDefaultTableModel model = null;
91 private IDefaultTableModel selectedInstancesTableModel = null;
92 private IDefaultTableModel libClassTableModel = null;
93 private IDefaultTableModel libInstanceTableModel = null;
94 private DefaultTableModel optionsTableModel = null;
95 private FpdFileContents ffc = null;
96 private String moduleKey = null;
97 private int moduleSaNum = -1;
98 private HashMap<LibraryClassDescriptor, ArrayList<String>> classInstanceMap = null;
99 //
100 // map of <{libName, supArch, supMod}, list of Module information>
101 //
102 private HashMap<LibraryClassDescriptor, ArrayList<String>> classConsumed = null;
103 private HashMap<LibraryClassDescriptor, ArrayList<String>> classProduced = null;
104
105 private JPanel jPanelModuleSaOpts = null;
106 private JLabel jLabelFvBinding = null;
107 private JTextField jTextFieldFvBinding = null;
108 private JLabel jLabelFfsFileGuid = null;
109 private JTextField jTextFieldFileGuid = null;
110 private JLabel jLabelFfsFormatKey = null;
111 private JTextField jTextFieldFfsKey = null;
112 private JScrollPane jScrollPaneModuleSaOptions = null;
113 private JTable jTableModuleSaOptions = null;
114 private JButton jButtonNew = null;
115 private JButton jButtonDeleteOption = null;
116 private JPanel jPanelPcdFields = null;
117 private JPanel jPanelPcdFieldsSecondRow = null;
118 private JPanel jPanelPcdFieldsThirdRow = null;
119 private JPanel jPanelPcdFieldsFirstRow = null;
120 private JLabel jLabelItemType = null;
121 private JComboBox jComboBoxItemType = null;
122 private JLabel jLabelMaxDatumSize = null;
123 private JTextField jTextFieldMaxDatumSize = null;
124 private JLabel jLabelPcdDefaultValue = null;
125 private JTextField jTextFieldPcdDefault = null;
126 private JButton jButtonUpdatePcd = null;
127 private JComboBox jComboBoxFeatureFlagValue = null;
128 private OpeningPlatformType docConsole = null;
129 private JPanel jPanelCustomToolChain = null;
130 private JPanel jPanelToolchainS = null;
131 private JPanel jPanelLibraryCenterN = null;
132 private JPanel jPanelLibraryCenterC = null; // @jve:decl-index=0:visual-constraint="20,224"
133
134 private final int buildTargetWidth = 150;
135 private final int toolChainFamilyWidth = 150;
136 private final int supportArchWidth = 150;
137 private final int toolCmdCodeWidth = 200;
138 private final int tagNameWidth = 150;
139 private final int argWidth = 400;
140
141 /**
142 * This is the default constructor
143 */
144 public FpdModuleSA() {
145 super();
146 initialize();
147 }
148 public FpdModuleSA(FpdFileContents ffc) {
149 this();
150 this.ffc = ffc;
151 }
152
153 public void setKey(String k, int i, OpeningPlatformType dc){
154 this.moduleKey = k;
155 moduleSaNum = i;
156 this.docConsole = dc;
157 classInstanceMap = null;
158 classProduced = null;
159 classConsumed = null;
160 jTabbedPane.setSelectedIndex(0);
161 initPcdBuildDefinition(i);
162 ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
163 int tabIndex = jTabbedPane.indexOfTab("Libraries");
164 if (mi.isLibrary()) {
165 jTabbedPane.setEnabledAt(tabIndex, false);
166 }
167 else {
168 jTabbedPane.setEnabledAt(tabIndex, true);
169 }
170 }
171
172 /**
173 init will be called each time FpdModuleSA object is to be shown.
174 @param key Module information.
175 **/
176 public void initPcdBuildDefinition(int i) {
177 //
178 // display pcd for key.
179 //
180 model.setRowCount(0);
181 jTextAreaPcdHelp.setText("");
182 jComboBoxItemType.setSelectedIndex(-1);
183 jTextFieldMaxDatumSize.setText("");
184 jTextFieldPcdDefault.setText("");
185 int pcdCount = ffc.getPcdDataCount(i);
186 if (pcdCount != 0) {
187 String[][] saa = new String[pcdCount][7];
188 ffc.getPcdData(i, saa);
189 for (int j = 0; j < saa.length; ++j) {
190 model.addRow(saa[j]);
191 }
192 }
193 }
194
195 public void initLibraries(String key) {
196 try {
197 //
198 // display library classes that need to be resolved. also potential instances for them.
199 //
200 resolveLibraryInstances(moduleKey);
201 } catch (Exception e) {
202 JOptionPane.showMessageDialog(frame, e.getMessage());
203 }
204 //
205 // display lib instances already selected for key
206 //
207 selectedInstancesTableModel.setRowCount(0);
208 int instanceCount = ffc.getLibraryInstancesCount(key);
209 if (instanceCount != 0) {
210 String[][] saa = new String[instanceCount][5];
211 ffc.getLibraryInstances(key, saa);
212 for (int i = 0; i < saa.length; ++i) {
213 ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3]
214 + " " + saa[i][4]);
215 if (mi != null) {
216 //
217 // ToDo: verify this instance first.
218 //
219 saa[i][0] = mi.getName();
220 saa[i][2] = mi.getVersion();
221 saa[i][4] = mi.getPackageId().getVersion();
222 //
223 // re-evaluate lib instance usage when adding a already-selected lib instance.
224 //
225 try {
226 resolveLibraryInstances(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);
227 } catch (Exception e) {
228 JOptionPane.showMessageDialog(frame, e.getMessage());
229 }
230 selectedInstancesTableModel.addRow(saa[i]);
231 }
232 }
233 }
234
235 showClassToResolved();
236 }
237
238 public void initFvInfo (String key) {
239 //
240 // display module SA options
241 //
242 jTextFieldFvBinding.setText("");
243 String fvBinding = ffc.getFvBinding(key);
244 if (fvBinding != null) {
245 jTextFieldFvBinding.setText(fvBinding);
246 }
247 jTextFieldFileGuid.setText("");
248 String fileGuid = ffc.getFfsFileNameGuid(key);
249 if (fileGuid != null) {
250 jTextFieldFileGuid.setText(fileGuid);
251 }
252 jTextFieldFfsKey.setText("");
253 String ffsKey = ffc.getFfsFormatKey(key);
254 if (ffsKey != null) {
255 jTextFieldFfsKey.setText(ffsKey);
256 }
257 }
258
259 public void initToolChainOptions(String key) {
260
261 optionsTableModel.setRowCount(0);
262 String[][] saa = new String[ffc.getModuleSAOptionsCount(key)][6];
263 ffc.getModuleSAOptions(key, saa);
264 for (int i = 0; i < saa.length; ++i) {
265 optionsTableModel.addRow(saa[i]);
266 }
267 }
268
269 private void filterClassConsumedByArch (Vector<LibraryClassDescriptor> v) {
270 String[] moduleInfo = moduleKey.split(" ");
271 Vector<String> vModuleArchs = new Vector<String>();
272 //
273 // Skip guid, version information, get archs to check.
274 //
275 for (int i = 4; i < moduleInfo.length; ++i) {
276 vModuleArchs.add(moduleInfo[i]);
277 }
278 //
279 // if module will be built on all platforms, no filter needed for lib classes.
280 //
281 if (vModuleArchs.size() == 0) {
282 return;
283 }
284
285 for (int j = 0; j < v.size(); ++j) {
286 LibraryClassDescriptor libInfo = v.get(j);
287
288 Vector<String> vSupArchs = libInfo.getVectorFromString(libInfo.supArchs);
289
290 if (vSupArchs.size() == 0 || (vSupArchs.size() == 1 && vSupArchs.get(0).equalsIgnoreCase(""))) {
291 //
292 // update lib info to module archs only.
293 //
294 libInfo.supArchs = "";
295 for (int i = 0; i < vModuleArchs.size(); ++i) {
296 libInfo.supArchs += vModuleArchs.get(i);
297 libInfo.supArchs += " ";
298 }
299 libInfo.supArchs.trim();
300 continue;
301 }
302 //
303 // only retain those lib class used by module archs.
304 //
305 vSupArchs.retainAll(vModuleArchs);
306 if (vSupArchs.size() > 0) {
307 //
308 // update lib info to reflect which kind of arch need to select instance.
309 //
310 libInfo.supArchs = "";
311 for (int i = 0; i < vSupArchs.size(); ++i) {
312 libInfo.supArchs += vSupArchs.get(i);
313 libInfo.supArchs += " ";
314 }
315 libInfo.supArchs.trim();
316 continue;
317 }
318 //
319 // remove this lib definition if it supports no archs module will be built under.
320 //
321 v.iterator().remove();
322 }
323 }
324
325 private void resolveLibraryInstances(String key) throws MultipleInstanceException, NoInstanceException{
326 ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
327 PackageIdentification[] depPkgList = null;
328
329 //
330 // Get dependency pkg list into which we will search lib instances.
331 //
332 depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
333 //
334 // Get the lib class consumed, produced by this module itself.
335 //
336 Vector<LibraryClassDescriptor> vClassConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
337 filterClassConsumedByArch(vClassConsumed);
338 if (this.classConsumed == null) {
339 this.classConsumed = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
340 }
341
342 for (int i = 0; i < vClassConsumed.size(); ++i) {
343 ArrayList<String> consumedBy = this.classConsumed.get(vClassConsumed.get(i));
344 if (consumedBy == null) {
345 consumedBy = new ArrayList<String>();
346 }
347 consumedBy.add(key);
348 this.classConsumed.put(vClassConsumed.get(i), consumedBy);
349 }
350
351 Vector<LibraryClassDescriptor> vClassProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
352 if (this.classProduced == null) {
353 this.classProduced = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
354 }
355 for (int i = 0; i < vClassProduced.size(); ++i) {
356 ArrayList<String> producedBy = this.classProduced.get(vClassProduced.get(i));
357 if (producedBy == null) {
358 producedBy = new ArrayList<String>();
359 }
360 //
361 // class already produced by previous module (lib instance).
362 /*
363 if (producedBy.size() == 1) {
364 String instanceKey = producedBy.get(0);
365 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
366 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
367 }
368 Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
369 while (lcdi.hasNext()) {
370 LibraryClassDescriptor lcd = lcdi.next();
371 if (vClassProduced.get(i).hasInterSectionWith(lcd)) {
372 ArrayList<String> alreadyProducedBy = this.classProduced.get(lcd);
373 String instanceKey = alreadyProducedBy.get(0);
374 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
375 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
376 }
377 }
378 */
379 // normal case.
380 //
381 producedBy.add(key);
382 this.classProduced.put(vClassProduced.get(i), producedBy);
383
384 }
385
386 //
387 // find potential instances in all pkgs for classes still in classConsumed.
388 //
389 if (classInstanceMap == null) {
390 classInstanceMap = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
391 }
392 Iterator<LibraryClassDescriptor> lic = this.classConsumed.keySet().iterator();
393 while (lic.hasNext()) {
394 LibraryClassDescriptor cls = lic.next();
395 if (isBoundedClass(cls)) {
396 continue;
397 }
398 ArrayList<String> instances = getInstancesForClass(cls, depPkgList);
399 if (instances.size() == 0) {
400 throw new NoInstanceException (cls.className);
401 }
402 classInstanceMap.put(cls, instances);
403
404 }
405 // showClassToResolved();
406 }
407
408 /**Search classProduced map to see if this class has been produced by some instance (module).
409 * @param cls
410 * @return
411 */
412 private boolean isBoundedClass (LibraryClassDescriptor cls) {
413 if (this.classProduced.containsKey(cls)) {
414 return true;
415 }
416 Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
417 while (lcdi.hasNext()) {
418 LibraryClassDescriptor lcd = lcdi.next();
419 if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {
420 return true;
421 }
422 }
423
424 return false;
425 }
426
427 private ArrayList<String> getInstancesForClass(LibraryClassDescriptor cls, PackageIdentification[] depPkgList){
428 ArrayList<String> al = new ArrayList<String>();
429
430 // for (int i = 0; i < depPkgList.length; ++i) {
431 Iterator ismi = GlobalData.vModuleList.iterator();
432 while(ismi.hasNext()) {
433 ModuleIdentification mi = (ModuleIdentification)ismi.next();
434 // if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
435 // continue;
436 // }
437 Vector<LibraryClassDescriptor> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
438
439 boolean isPotential = false;
440 Iterator<LibraryClassDescriptor> lcdi = clsProduced.iterator();
441 while (lcdi.hasNext()) {
442 LibraryClassDescriptor lcd = lcdi.next();
443 if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)){
444 isPotential = true;
445 }
446
447 if (hasBeenProduced(lcd)) {
448 isPotential = false;
449 break;
450 }
451 }
452 if (isPotential) {
453 al.add(mi.getGuid() + " " + mi.getVersion() + " " +
454 mi.getPackageId().getGuid() + " " + mi.getPackageId().getVersion());
455 }
456 }
457 // }
458
459 return al;
460 }
461
462 private boolean hasBeenProduced (LibraryClassDescriptor cls) {
463 Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
464 while (lcdi.hasNext()) {
465 LibraryClassDescriptor lcd = lcdi.next();
466 if (cls.hasInterSectionWith(lcd)) {
467 return true;
468 }
469 }
470 return false;
471 }
472
473 private ArrayList<String> getConsumedBy (String className) {
474 Iterator<LibraryClassDescriptor> lcdi = this.classConsumed.keySet().iterator();
475 while (lcdi.hasNext()) {
476 LibraryClassDescriptor lcd = lcdi.next();
477 if (lcd.className.equals(className)) {
478 return this.classConsumed.get(lcd);
479 }
480 }
481 return null;
482 }
483
484 private void removeInstance(String key) {
485 ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
486 //
487 // remove pcd information of instance from current ModuleSA
488 //
489 ffc.removePcdData(moduleKey, mi);
490 //
491 // remove class produced by this instance and add back these produced class to be bound.
492 //
493 Vector<LibraryClassDescriptor> clsProduced = getClassProduced(mi);
494 for (int i = 0; i < clsProduced.size(); ++i) {
495
496 classProduced.remove(clsProduced.get(i));
497 }
498 //
499 // remove class consumed by this instance. we do not need to bound it now.
500 //
501 String[] clsConsumed = getClassConsumed(mi);
502 for (int i = 0; i < clsConsumed.length; ++i) {
503 ArrayList<String> al = getConsumedBy (clsConsumed[i]);
504
505 if (al == null ) {
506 continue;
507 }
508 al.remove(key);
509
510 }
511
512 showClassToResolved();
513
514 }
515
516
517 private Vector<LibraryClassDescriptor> getClassProduced(ModuleIdentification mi){
518
519 Vector<LibraryClassDescriptor> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
520 return clsProduced;
521 // String[] sClassProduced = new String[clsProduced.size()];
522 // for (int i = 0; i < clsProduced.size(); ++i) {
523 // sClassProduced[i] = clsProduced.get(i).className;
524 // }
525 // return sClassProduced;
526 }
527
528 private String[] getClassConsumed(ModuleIdentification mi){
529
530 Vector<LibraryClassDescriptor> clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
531 String[] sClassConsumed = new String[clsConsumed.size()];
532 for (int i = 0; i < clsConsumed.size(); ++i) {
533 sClassConsumed[i] = clsConsumed.get(i).className;
534 }
535 return sClassConsumed;
536 }
537
538 private void showClassToResolved(){
539 libClassTableModel.setRowCount(0);
540 if (classConsumed == null || classConsumed.size() == 0) {
541 return;
542 }
543 Iterator<LibraryClassDescriptor> li = classConsumed.keySet().iterator();
544 while(li.hasNext()){
545 LibraryClassDescriptor lcd = li.next();
546 String[] s = {lcd.className, lcd.supArchs, lcd.supModTypes};
547 if (classConsumed.get(lcd) == null || classConsumed.get(lcd).size() == 0) {
548 continue;
549 }
550
551 if (!isBoundedClass(lcd)){
552 libClassTableModel.addRow(s);
553 }
554 }
555 libInstanceTableModel.setRowCount(0);
556 }
557
558 private void addLibInstance (ModuleIdentification libMi) throws Exception{
559
560 //
561 // Add pcd information of selected instance to current moduleSA
562 //
563 ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey));
564
565 ffc.genLibraryInstance(libMi, moduleKey);
566 }
567 /**
568 * This method initializes this
569 *
570 * @return void
571 */
572 private void initialize() {
573 this.setSize(877, 555);
574 this.setResizable(false);
575 this.centerWindow();
576 this.setModal(true);
577 this.setTitle("Module Settings");
578 this.setContentPane(getJContentPane());
579 }
580
581 /**
582 * This method initializes jContentPane
583 *
584 * @return javax.swing.JPanel
585 */
586 private JPanel getJContentPane() {
587 if (jContentPane == null) {
588 jContentPane = new JPanel();
589 jContentPane.setLayout(new BorderLayout());
590 jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
591 jContentPane.add(getJPanelContentPaneSouth(), java.awt.BorderLayout.SOUTH);
592 }
593 return jContentPane;
594 }
595
596 /**
597 * This method initializes jTabbedPane
598 *
599 * @return javax.swing.JTabbedPane
600 */
601 private JTabbedPane getJTabbedPane() {
602 if (jTabbedPane == null) {
603 jTabbedPane = new JTabbedPane();
604 jTabbedPane.addTab("PCD Build Definition", null, getJPanelPcd(), null);
605 jTabbedPane.addTab("Libraries", null, getJPanelLibrary(), null);
606 jTabbedPane.addTab("FV Info", null, getJPanelModuleSaOpts(), null);
607 jTabbedPane.addTab("Custom Toolchain", null, getJPanelCustomToolChain(), null);
608
609 }
610 return jTabbedPane;
611 }
612
613 /**
614 * This method initializes jPanelPcd
615 *
616 * @return javax.swing.JPanel
617 */
618 private JPanel getJPanelPcd() {
619 if (jPanelPcd == null) {
620 jLabelPcdData = new JLabel();
621 jLabelPcdData.setText(" PCD Data");
622 jPanelPcd = new JPanel();
623 jPanelPcd.setLayout(new BorderLayout());
624 jPanelPcd.add(jLabelPcdData, java.awt.BorderLayout.NORTH);
625 jPanelPcd.add(getJScrollPaneTablePcd(), java.awt.BorderLayout.CENTER);
626 jPanelPcd.add(getJPanelPcdSouth(), java.awt.BorderLayout.SOUTH);
627 jPanelPcd.addComponentListener(new java.awt.event.ComponentAdapter() {
628 public void componentShown(java.awt.event.ComponentEvent e) {
629 initPcdBuildDefinition(moduleSaNum);
630 }
631 });
632
633 }
634 return jPanelPcd;
635 }
636
637 /**
638 * This method initializes jPanelLibrary
639 *
640 * @return javax.swing.JPanel
641 */
642 private JPanel getJPanelLibrary() {
643 if (jPanelLibrary == null) {
644 jPanelLibrary = new JPanel();
645 jPanelLibrary.setLayout(new BorderLayout());
646 jPanelLibrary.add(getJSplitPane(), java.awt.BorderLayout.NORTH);
647 jPanelLibrary.add(getJPanelLibrarySouth(), java.awt.BorderLayout.SOUTH);
648 jPanelLibrary.add(getJPanelLibraryCenter(), java.awt.BorderLayout.CENTER);
649 jPanelLibrary.addComponentListener(new java.awt.event.ComponentAdapter() {
650 public void componentShown(java.awt.event.ComponentEvent e) {
651 initLibraries(moduleKey);
652 }
653 });
654 }
655 return jPanelLibrary;
656 }
657
658 /**
659 * This method initializes jScrollPaneTablePcd
660 *
661 * @return javax.swing.JScrollPane
662 */
663 private JScrollPane getJScrollPaneTablePcd() {
664 if (jScrollPaneTablePcd == null) {
665 jScrollPaneTablePcd = new JScrollPane();
666 jScrollPaneTablePcd.setViewportView(getJTablePcd());
667 }
668 return jScrollPaneTablePcd;
669 }
670
671 /**
672 * This method initializes jTable
673 *
674 * @return javax.swing.JTable
675 */
676 private JTable getJTablePcd() {
677 if (jTablePcd == null) {
678 model = new IDefaultTableModel();
679 jTablePcd = new JTable(model);
680 jTablePcd.setRowHeight(20);
681 jTablePcd.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
682 model.addColumn("CName");
683 model.addColumn("TokenSpaceGUID");
684 model.addColumn("ItemType");
685 model.addColumn("Token");
686 model.addColumn("MaxDatumSize");
687 model.addColumn("DataType");
688 model.addColumn("DefaultValue");
689
690 jTablePcd.getColumnModel().getColumn(0).setMinWidth(250);
691
692 TableColumn tokenColumn = jTablePcd.getColumnModel().getColumn(3);
693 jTablePcd.removeColumn(tokenColumn);
694
695 jTablePcd.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
696 jTablePcd.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
697 public void valueChanged(ListSelectionEvent e) {
698
699 if (e.getValueIsAdjusting()){
700 return;
701 }
702 ListSelectionModel lsm = (ListSelectionModel)e.getSource();
703 if (lsm.isSelectionEmpty()) {
704 return;
705 }
706 else{
707 int selectedRow = lsm.getMinSelectionIndex();
708 String cName = model.getValueAt(selectedRow, 0)+"";
709 String tsGuid = model.getValueAt(selectedRow, 1)+"";
710 String itemType = model.getValueAt(selectedRow, 2)+"";
711 //
712 // array for pcd related information: helpText, itemType, moduleType.
713 //
714 String[] pcdInfo = {"", "", ""};
715 getPcdInfo(cName, tsGuid, pcdInfo);
716 jTextAreaPcdHelp.setText(pcdInfo[0]);
717 initComboBox(pcdInfo[1], pcdInfo[2]);
718 jComboBoxItemType.setSelectedItem(itemType);
719 jTextFieldMaxDatumSize.setEnabled(true);
720 jTextFieldMaxDatumSize.setVisible(true);
721 jTextFieldMaxDatumSize.setText(model.getValueAt(selectedRow, 4)+"");
722 jTextFieldPcdDefault.setEnabled(true);
723 jTextFieldPcdDefault.setText(model.getValueAt(selectedRow, 6)+"");
724 if (model.getValueAt(selectedRow, 5).equals("VOID*")) {
725 if (pcdInfo[1].equals("FEATURE_FLAG")) {
726 jTextFieldMaxDatumSize.setVisible(false);
727 }
728 else if (pcdInfo[1].equals("FIXED_AT_BUILD")) {
729 try{
730 jTextFieldMaxDatumSize.setEnabled(false);
731 jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(model.getValueAt(selectedRow, 6)+"")+"");
732 }
733 catch(Exception except){
734 JOptionPane.showMessageDialog(frame, "Unacceptable PCD Value: " + except.getMessage());
735 }
736 }
737 else{
738 jTextFieldMaxDatumSize.setText(model.getValueAt(selectedRow, 4)+"");
739 }
740 }
741 else {
742 jTextFieldMaxDatumSize.setEnabled(false);
743 }
744
745 if (!model.getValueAt(selectedRow, 2).equals("DYNAMIC") && !model.getValueAt(selectedRow, 2).equals("DYNAMIC_EX")) {
746 jTextFieldPcdDefault.setText(model.getValueAt(selectedRow, 6)+"");
747 if (model.getValueAt(selectedRow, 2).equals("FEATURE_FLAG")){
748 jTextFieldPcdDefault.setVisible(false);
749 jComboBoxFeatureFlagValue.setVisible(true);
750 jComboBoxFeatureFlagValue.setSelectedItem(model.getValueAt(selectedRow, 6)+"");
751 }
752 else{
753 jTextFieldPcdDefault.setVisible(true);
754 jTextFieldPcdDefault.setEnabled(true);
755 jComboBoxFeatureFlagValue.setVisible(false);
756 }
757 }
758 else{
759 jTextFieldPcdDefault.setEnabled(false);
760 }
761 }
762
763
764 }
765 });
766
767 }
768 return jTablePcd;
769 }
770
771 private void initComboBox(String originalType, String mType) {
772 jComboBoxItemType.removeAllItems();
773 jComboBoxItemType.addItem(originalType);
774 if (originalType.equals("PATCHABLE_IN_MODULE") && mType.equalsIgnoreCase("false")) {
775 jComboBoxItemType.addItem("FIXED_AT_BUILD");
776 }
777 if (originalType.equals("DYNAMIC")) {
778 jComboBoxItemType.addItem("FIXED_AT_BUILD");
779 jComboBoxItemType.addItem("PATCHABLE_IN_MODULE");
780 }
781 }
782
783 /**
784 * @param cName
785 * @param tsGuid
786 * @param sa sa[0]: HelpText; sa[1]: itemType in Msa; sa[2]: isBinary;
787 */
788 private void getPcdInfo(String cName, String tsGuid, String[] sa) {
789 String[][] saa = new String[ffc.getLibraryInstancesCount(moduleKey)][5];
790 ffc.getLibraryInstances(moduleKey, saa);
791
792 try{
793 if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(moduleKey), cName, tsGuid, sa)) {
794 return;
795 }
796 for (int j = 0; j < saa.length; ++j) {
797 if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]),
798 cName, tsGuid, sa)) {
799 return;
800 }
801 }
802 }
803 catch(Exception e) {
804 JOptionPane.showMessageDialog(this, "Get PCD details fail: " + e.getMessage());
805 }
806 }
807
808 /**
809 * This method initializes jPanelPcdSouth
810 *
811 * @return javax.swing.JPanel
812 */
813 private JPanel getJPanelPcdSouth() {
814 if (jPanelPcdSouth == null) {
815 jLabelPcdHelp = new JLabel();
816 jLabelPcdHelp.setText("PCD Description");
817 jPanelPcdSouth = new JPanel();
818 jPanelPcdSouth.setPreferredSize(new java.awt.Dimension(607,200));
819 jPanelPcdSouth.add(jLabelPcdHelp, null);
820 jPanelPcdSouth.add(getJScrollPanePcdHelp(), null);
821 jPanelPcdSouth.add(getJPanelPcdFields(), null);
822 }
823 return jPanelPcdSouth;
824 }
825
826 /**
827 * This method initializes jScrollPanePcdHelp
828 *
829 * @return javax.swing.JScrollPane
830 */
831 private JScrollPane getJScrollPanePcdHelp() {
832 if (jScrollPanePcdHelp == null) {
833 jScrollPanePcdHelp = new JScrollPane();
834 jScrollPanePcdHelp.setPreferredSize(new java.awt.Dimension(500,100));
835 jScrollPanePcdHelp.setViewportView(getJTextAreaPcdHelp());
836 }
837 return jScrollPanePcdHelp;
838 }
839
840 /**
841 * This method initializes jTextAreaPcdHelp
842 *
843 * @return javax.swing.JTextArea
844 */
845 private JTextArea getJTextAreaPcdHelp() {
846 if (jTextAreaPcdHelp == null) {
847 jTextAreaPcdHelp = new JTextArea();
848 jTextAreaPcdHelp.setEditable(false);
849 }
850 return jTextAreaPcdHelp;
851 }
852
853 /**
854 * This method initializes jPanelContentPaneSouth
855 *
856 * @return javax.swing.JPanel
857 */
858 private JPanel getJPanelContentPaneSouth() {
859 if (jPanelContentPaneSouth == null) {
860 FlowLayout flowLayout = new FlowLayout();
861 flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
862 jPanelContentPaneSouth = new JPanel();
863 jPanelContentPaneSouth.setLayout(flowLayout);
864 jPanelContentPaneSouth.add(getJButtonOk(), null);
865 jPanelContentPaneSouth.add(getJButtonCancel(), null);
866 }
867 return jPanelContentPaneSouth;
868 }
869
870 /**
871 * This method initializes jSplitPane
872 *
873 * @return javax.swing.JSplitPane
874 */
875 private JSplitPane getJSplitPane() {
876 if (jSplitPane == null) {
877 jSplitPane = new JSplitPane();
878 jSplitPane.setDividerLocation(200);
879 jSplitPane.setLeftComponent(getJPanelLibraryLeft());
880 jSplitPane.setRightComponent(getJPanelLibraryRight());
881 jSplitPane.setPreferredSize(new java.awt.Dimension(202,200));
882 }
883 return jSplitPane;
884 }
885
886 /**
887 * This method initializes jPanelLibraryLeft
888 *
889 * @return javax.swing.JPanel
890 */
891 private JPanel getJPanelLibraryLeft() {
892 if (jPanelLibraryLeft == null) {
893 jLabelLibClass = new JLabel();
894 jLabelLibClass.setText("Library Classes Uninstantiated");
895 jPanelLibraryLeft = new JPanel();
896 jPanelLibraryLeft.add(jLabelLibClass, null);
897 jPanelLibraryLeft.add(getJScrollPaneLibClass(), null);
898 }
899 return jPanelLibraryLeft;
900 }
901
902 /**
903 * This method initializes jPanelLibraryRight
904 *
905 * @return javax.swing.JPanel
906 */
907 private JPanel getJPanelLibraryRight() {
908 if (jPanelLibraryRight == null) {
909 jLabelQualifiedInstance = new JLabel();
910 jLabelQualifiedInstance.setText("Instances Available");
911 jPanelLibraryRight = new JPanel();
912 jPanelLibraryRight.add(jLabelQualifiedInstance, null);
913 jPanelLibraryRight.add(getJScrollPaneQualifiedInstance(), null);
914 }
915 return jPanelLibraryRight;
916 }
917
918 /**
919 * This method initializes jScrollPaneSelectedInstances
920 *
921 * @return javax.swing.JScrollPane
922 */
923 private JScrollPane getJScrollPaneSelectedInstances() {
924 if (jScrollPaneSelectedInstances == null) {
925 jScrollPaneSelectedInstances = new JScrollPane();
926 jScrollPaneSelectedInstances.setPreferredSize(new java.awt.Dimension(600,150));
927 jScrollPaneSelectedInstances.setViewportView(getJTableSelectedInstances());
928 }
929 return jScrollPaneSelectedInstances;
930 }
931
932 /**
933 * This method initializes jTableSelectedInstances
934 *
935 * @return javax.swing.JTable
936 */
937 private JTable getJTableSelectedInstances() {
938 if (jTableSelectedInstances == null) {
939 selectedInstancesTableModel = new IDefaultTableModel();
940 selectedInstancesTableModel.addColumn("Name");
941 selectedInstancesTableModel.addColumn("ModuleGUID");
942 selectedInstancesTableModel.addColumn("ModuleVersion");
943 selectedInstancesTableModel.addColumn("PackageGUID");
944 selectedInstancesTableModel.addColumn("PackageVersion");
945 jTableSelectedInstances = new JTable(selectedInstancesTableModel);
946 jTableSelectedInstances.setRowHeight(20);
947
948 jTableSelectedInstances.getColumnModel().getColumn(0).setMinWidth(250);
949
950 jTableSelectedInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
951 jTableSelectedInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
952
953 }
954 return jTableSelectedInstances;
955 }
956
957 /**
958 * This method initializes jScrollPaneLibClass
959 *
960 * @return javax.swing.JScrollPane
961 */
962 private JScrollPane getJScrollPaneLibClass() {
963 if (jScrollPaneLibClass == null) {
964 jScrollPaneLibClass = new JScrollPane();
965 jScrollPaneLibClass.setPreferredSize(new java.awt.Dimension(200,170));
966 jScrollPaneLibClass.setViewportView(getJTableLibClass());
967 }
968 return jScrollPaneLibClass;
969 }
970
971 /**
972 * This method initializes jTableLibClass
973 *
974 * @return javax.swing.JTable
975 */
976 private JTable getJTableLibClass() {
977 if (jTableLibClass == null) {
978 libClassTableModel = new IDefaultTableModel();
979 libClassTableModel.addColumn("LibraryClass");
980 libClassTableModel.addColumn("Arch");
981 libClassTableModel.addColumn("ModType");
982 jTableLibClass = new JTable(libClassTableModel);
983 jTableLibClass.setRowHeight(20);
984 jTableLibClass.setShowGrid(false);
985 jTableLibClass.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
986
987 TableColumn column = jTableLibClass.getColumnModel().getColumn(1);
988 jTableLibClass.getColumnModel().removeColumn(column);
989 column = jTableLibClass.getColumnModel().getColumn(1);
990 jTableLibClass.getColumnModel().removeColumn(column);
991
992 jTableLibClass.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
993 public void valueChanged(ListSelectionEvent e) {
994 if (e.getValueIsAdjusting()){
995 return;
996 }
997 ListSelectionModel lsm = (ListSelectionModel)e.getSource();
998 if (lsm.isSelectionEmpty()) {
999 return;
1000 }
1001 else{
1002 int selectedRow2 = lsm.getMinSelectionIndex();
1003 if (selectedRow2 < 0) {
1004 return;
1005 }
1006 //
1007 // display potential lib instances according to class selection
1008 //
1009 libInstanceTableModel.setRowCount(0);
1010 String cls = libClassTableModel.getValueAt(selectedRow2, 0).toString();
1011 String arch = libClassTableModel.getValueAt(selectedRow2, 1).toString();
1012 String modType = libClassTableModel.getValueAt(selectedRow2, 2).toString();
1013 ArrayList<String> al = classInstanceMap.get(new LibraryClassDescriptor(cls, arch, modType));
1014 if (al == null) {
1015 return;
1016 }
1017 ListIterator<String> li = al.listIterator();
1018 while(li.hasNext()) {
1019 String instance = li.next();
1020 String[] s = {"", "", "", "", ""};
1021 if (WorkspaceProfile.getModuleId(instance) != null) {
1022 s[0] = WorkspaceProfile.getModuleId(instance).getName();
1023 }
1024
1025 String[] instancePart = instance.split(" ");
1026 for (int i = 0; i < instancePart.length; ++i){
1027 s[i+1] = instancePart[i];
1028 }
1029 libInstanceTableModel.addRow(s);
1030 }
1031
1032 }
1033 }
1034 });
1035 }
1036 return jTableLibClass;
1037 }
1038
1039 /**
1040 * This method initializes jScrollPaneQualifiedInstance
1041 *
1042 * @return javax.swing.JScrollPane
1043 */
1044 private JScrollPane getJScrollPaneQualifiedInstance() {
1045 if (jScrollPaneQualifiedInstance == null) {
1046 jScrollPaneQualifiedInstance = new JScrollPane();
1047 jScrollPaneQualifiedInstance.setPreferredSize(new java.awt.Dimension(600,170));
1048 jScrollPaneQualifiedInstance.setViewportView(getJTableLibInstances());
1049 }
1050 return jScrollPaneQualifiedInstance;
1051 }
1052
1053 /**
1054 * This method initializes jTableLibInstances
1055 *
1056 * @return javax.swing.JTable
1057 */
1058 private JTable getJTableLibInstances() {
1059 if (jTableLibInstances == null) {
1060 libInstanceTableModel = new IDefaultTableModel();
1061 libInstanceTableModel.addColumn("Name");
1062 libInstanceTableModel.addColumn("ModuleGUID");
1063 libInstanceTableModel.addColumn("ModuleVersion");
1064 libInstanceTableModel.addColumn("PackageGUID");
1065 libInstanceTableModel.addColumn("PackageVersion");
1066 jTableLibInstances = new JTable(libInstanceTableModel);
1067 jTableLibInstances.setRowHeight(20);
1068
1069 jTableLibInstances.getColumnModel().getColumn(0).setMinWidth(250);
1070
1071 jTableLibInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
1072 jTableLibInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
1073
1074 }
1075 return jTableLibInstances;
1076 }
1077
1078 /**
1079 * This method initializes jPanelLibrarySouth
1080 *
1081 * @return javax.swing.JPanel
1082 */
1083 private JPanel getJPanelLibrarySouth() {
1084 if (jPanelLibrarySouth == null) {
1085 jPanelLibrarySouth = new JPanel();
1086 }
1087 return jPanelLibrarySouth;
1088 }
1089
1090 /**
1091 * This method initializes jPanelLibraryCenter
1092 *
1093 * @return javax.swing.JPanel
1094 */
1095 private JPanel getJPanelLibraryCenter() {
1096 if (jPanelLibraryCenter == null) {
1097 jLabelInstanceHelp = new JLabel();
1098 jLabelInstanceHelp.setText("Instance Description");
1099 jLabelSelectedInstances = new JLabel();
1100 jLabelSelectedInstances.setText("Selected Instances");
1101 jPanelLibraryCenter = new JPanel();
1102 jPanelLibraryCenter.setLayout(new BorderLayout());
1103
1104 jPanelLibraryCenter.add(getJPanelLibraryCenterC(), java.awt.BorderLayout.CENTER);
1105 jPanelLibraryCenter.add(getJPanelLibraryCenterN(), java.awt.BorderLayout.NORTH);
1106
1107 }
1108 return jPanelLibraryCenter;
1109 }
1110
1111 /**
1112 * This method initializes jScrollPaneInstanceHelp
1113 *
1114 * @return javax.swing.JScrollPane
1115 */
1116 private JScrollPane getJScrollPaneInstanceHelp() {
1117 if (jScrollPaneInstanceHelp == null) {
1118 jScrollPaneInstanceHelp = new JScrollPane();
1119 jScrollPaneInstanceHelp.setPreferredSize(new java.awt.Dimension(400,50));
1120 jScrollPaneInstanceHelp.setViewportView(getJTextAreaInstanceHelp());
1121 }
1122 return jScrollPaneInstanceHelp;
1123 }
1124
1125 /**
1126 * This method initializes jTextAreaInstanceHelp
1127 *
1128 * @return javax.swing.JTextArea
1129 */
1130 private JTextArea getJTextAreaInstanceHelp() {
1131 if (jTextAreaInstanceHelp == null) {
1132 jTextAreaInstanceHelp = new JTextArea();
1133 jTextAreaInstanceHelp.setEditable(false);
1134 }
1135 return jTextAreaInstanceHelp;
1136 }
1137
1138 /**
1139 * This method initializes jButtonAdd
1140 *
1141 * @return javax.swing.JButton
1142 */
1143 private JButton getJButtonAdd() {
1144 if (jButtonAdd == null) {
1145 jButtonAdd = new JButton();
1146 jButtonAdd.setPreferredSize(new java.awt.Dimension(80,20));
1147 jButtonAdd.setText("Add");
1148 jButtonAdd.addActionListener(new java.awt.event.ActionListener() {
1149 public void actionPerformed(java.awt.event.ActionEvent e) {
1150 int row = jTableLibInstances.getSelectedRow();
1151 if (row < 0) {
1152 return;
1153 }
1154
1155 String instanceValue = libInstanceTableModel.getValueAt(row, 1) + " " +
1156 libInstanceTableModel.getValueAt(row, 2) + " " +
1157 libInstanceTableModel.getValueAt(row, 3) + " " +
1158 libInstanceTableModel.getValueAt(row, 4);
1159 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceValue);
1160 try {
1161 addLibInstance (libMi);
1162 }
1163 catch (Exception exception) {
1164 JOptionPane.showMessageDialog(frame, "Adding Instance" + libMi.getName() + ": "+ exception.getMessage());
1165 return;
1166 }
1167 docConsole.setSaved(false);
1168 Object[] s = {libInstanceTableModel.getValueAt(row, 0), libInstanceTableModel.getValueAt(row, 1),
1169 libInstanceTableModel.getValueAt(row, 2), libInstanceTableModel.getValueAt(row, 3),
1170 libInstanceTableModel.getValueAt(row, 4)};
1171 selectedInstancesTableModel.addRow(s);
1172 try {
1173 resolveLibraryInstances(instanceValue);
1174 }
1175 catch (Exception exp) {
1176 JOptionPane.showMessageDialog(frame, exp.getMessage());
1177 }
1178 showClassToResolved();
1179 }
1180 });
1181 }
1182 return jButtonAdd;
1183 }
1184
1185 /**
1186 * This method initializes jButton1
1187 *
1188 * @return javax.swing.JButton
1189 */
1190 private JButton getJButtonDeleteInstance() {
1191 if (jButtonDeleteInstance == null) {
1192 jButtonDeleteInstance = new JButton();
1193 jButtonDeleteInstance.setPreferredSize(new java.awt.Dimension(80,20));
1194 jButtonDeleteInstance.setText("Delete");
1195 jButtonDeleteInstance.addActionListener(new java.awt.event.ActionListener() {
1196 public void actionPerformed(java.awt.event.ActionEvent e) {
1197 int row = jTableSelectedInstances.getSelectedRow();
1198 if (row < 0) {
1199 return;
1200 }
1201 docConsole.setSaved(false);
1202 removeInstance(selectedInstancesTableModel.getValueAt(row, 1) + " " +
1203 selectedInstancesTableModel.getValueAt(row, 2) + " " +
1204 selectedInstancesTableModel.getValueAt(row, 3) + " " +
1205 selectedInstancesTableModel.getValueAt(row, 4));
1206 ffc.removeLibraryInstance(moduleKey, row);
1207 selectedInstancesTableModel.removeRow(row);
1208
1209 }
1210 });
1211 }
1212 return jButtonDeleteInstance;
1213 }
1214
1215 /**
1216 * This method initializes jButton2
1217 *
1218 * @return javax.swing.JButton
1219 */
1220 private JButton getJButtonOk() {
1221 if (jButtonOk == null) {
1222 jButtonOk = new JButton();
1223 jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
1224 jButtonOk.setText("Close");
1225 jButtonOk.addActionListener(this);
1226 }
1227 return jButtonOk;
1228 }
1229
1230 /**
1231 * This method initializes jButton3
1232 *
1233 * @return javax.swing.JButton
1234 */
1235 private JButton getJButtonCancel() {
1236 if (jButtonCancel == null) {
1237 jButtonCancel = new JButton();
1238 jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
1239 jButtonCancel.setText("Cancel");
1240 jButtonCancel.setVisible(false);
1241 }
1242 return jButtonCancel;
1243 }
1244 public void actionPerformed(ActionEvent arg0) {
1245
1246 if (arg0.getSource() == jButtonOk) {
1247 if (jTableModuleSaOptions.isEditing()) {
1248 jTableModuleSaOptions.getCellEditor().stopCellEditing();
1249 }
1250 this.setVisible(false);
1251 }
1252 }
1253 /**
1254 * This method initializes jPanelModuleSaOpts
1255 *
1256 * @return javax.swing.JPanel
1257 */
1258 private JPanel getJPanelModuleSaOpts() {
1259 if (jPanelModuleSaOpts == null) {
1260 FlowLayout flowLayout4 = new FlowLayout();
1261 flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
1262 jLabelFfsFormatKey = new JLabel();
1263 jLabelFfsFormatKey.setText("FFS Format Key");
1264 jLabelFfsFormatKey.setPreferredSize(new java.awt.Dimension(90,16));
1265 jLabelFfsFileGuid = new JLabel();
1266 jLabelFfsFileGuid.setText("FFS File GUID");
1267 jLabelFfsFileGuid.setPreferredSize(new java.awt.Dimension(90,16));
1268 jLabelFfsFileGuid.setVisible(false);
1269 jLabelFvBinding = new JLabel();
1270 jLabelFvBinding.setText("FV Binding");
1271 jLabelFvBinding.setPreferredSize(new java.awt.Dimension(90,16));
1272 jPanelModuleSaOpts = new JPanel();
1273 jPanelModuleSaOpts.setLayout(flowLayout4);
1274 jPanelModuleSaOpts.add(jLabelFvBinding, null);
1275 jPanelModuleSaOpts.add(getJTextFieldFvBinding(), null);
1276 jPanelModuleSaOpts.add(jLabelFfsFileGuid, null);
1277 jPanelModuleSaOpts.add(getJTextFieldFileGuid(), null);
1278 jPanelModuleSaOpts.add(jLabelFfsFormatKey, null);
1279 jPanelModuleSaOpts.add(getJTextFieldFfsKey(), null);
1280 jPanelModuleSaOpts.addComponentListener(new java.awt.event.ComponentAdapter() {
1281 public void componentShown(java.awt.event.ComponentEvent e) {
1282 initFvInfo(moduleKey);
1283 }
1284 });
1285 }
1286 return jPanelModuleSaOpts;
1287 }
1288
1289 private Vector<String> getVectorFromString (String s) {
1290 if (s == null || s.equals("null")) {
1291 s = "";
1292 }
1293 String[] sa1 = s.split(" ");
1294 Vector<String> v = new Vector<String>();
1295 for (int i = 0; i < sa1.length; ++i) {
1296 v.add(sa1[i]);
1297 }
1298 return v;
1299 }
1300
1301 /**
1302 * This method initializes jTextField
1303 *
1304 * @return javax.swing.JTextField
1305 */
1306 private JTextField getJTextFieldFvBinding() {
1307 if (jTextFieldFvBinding == null) {
1308 jTextFieldFvBinding = new JTextField();
1309 jTextFieldFvBinding.setPreferredSize(new java.awt.Dimension(400,20));
1310 jTextFieldFvBinding.setEditable(true);
1311 jTextFieldFvBinding.addFocusListener(new java.awt.event.FocusAdapter() {
1312 public void focusLost(java.awt.event.FocusEvent e) {
1313 String originalFvBinding = ffc.getFvBinding(moduleKey);
1314 String newFvBinding = jTextFieldFvBinding.getText();
1315 if (newFvBinding.equals(originalFvBinding)) {
1316 return;
1317 }
1318 if (newFvBinding.length() == 0 && originalFvBinding == null) {
1319 return;
1320 }
1321
1322 Vector<String> oldFvList = getVectorFromString (originalFvBinding);
1323 Vector<String> newFvList = getVectorFromString (newFvBinding);
1324 String moduleInfo[] = moduleKey.split(" ");
1325 ffc.setFvBinding(moduleKey, newFvBinding);
1326 //
1327 // remove module from Fvs that not in newFvList now.
1328 //
1329 oldFvList.removeAll(newFvList);
1330 for (int j = 0; j < oldFvList.size(); ++j) {
1331 ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
1332 }
1333 //
1334 // add module to Fvs that were not in oldFvList.
1335 //
1336 oldFvList = getVectorFromString (originalFvBinding);
1337 newFvList.removeAll(oldFvList);
1338 for (int i = 0; i < newFvList.size(); ++i) {
1339 ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
1340 }
1341 docConsole.setSaved(false);
1342 }
1343 });
1344
1345 }
1346 return jTextFieldFvBinding;
1347 }
1348 /**
1349 * This method initializes jTextField1
1350 *
1351 * @return javax.swing.JTextField
1352 */
1353 private JTextField getJTextFieldFileGuid() {
1354 if (jTextFieldFileGuid == null) {
1355 jTextFieldFileGuid = new JTextField();
1356 jTextFieldFileGuid.setPreferredSize(new java.awt.Dimension(300,20));
1357 jTextFieldFileGuid.setVisible(false);
1358 jTextFieldFileGuid.addFocusListener(new java.awt.event.FocusAdapter() {
1359 public void focusLost(java.awt.event.FocusEvent e) {
1360 String originalFileGuid = ffc.getFfsFileNameGuid(moduleKey);
1361 String newFileGuid = jTextFieldFileGuid.getText();
1362 if (newFileGuid.equals(originalFileGuid)) {
1363 return;
1364 }
1365 if (newFileGuid.length() == 0 && originalFileGuid == null) {
1366 return;
1367 }
1368 if (newFileGuid.length() > 0) {
1369 if (!DataValidation.isGuid(newFileGuid)) {
1370 JOptionPane.showMessageDialog(frame, "FFS File Guid is NOT GUID Type.");
1371 return;
1372 }
1373 }
1374
1375 docConsole.setSaved(false);
1376 if (newFileGuid.length() == 0) {
1377 newFileGuid = null;
1378 }
1379 ffc.setFfsFileNameGuid(moduleKey, newFileGuid);
1380 }
1381 });
1382
1383 }
1384 return jTextFieldFileGuid;
1385 }
1386 /**
1387 * This method initializes jTextFieldFfsKey
1388 *
1389 * @return javax.swing.JTextField
1390 */
1391 private JTextField getJTextFieldFfsKey() {
1392 if (jTextFieldFfsKey == null) {
1393 jTextFieldFfsKey = new JTextField();
1394 jTextFieldFfsKey.setPreferredSize(new java.awt.Dimension(250,20));
1395 jTextFieldFfsKey.addFocusListener(new java.awt.event.FocusAdapter() {
1396 public void focusLost(java.awt.event.FocusEvent e) {
1397 String originalFfsKey = ffc.getFfsFormatKey(moduleKey);
1398 String newFfsKey = jTextFieldFfsKey.getText();
1399 if (newFfsKey.equals(originalFfsKey)) {
1400 return;
1401 }
1402 if (newFfsKey.length() == 0 && originalFfsKey == null) {
1403 return;
1404 }
1405 docConsole.setSaved(false);
1406 ffc.setFfsFormatKey(moduleKey, newFfsKey);
1407 }
1408 });
1409
1410 }
1411 return jTextFieldFfsKey;
1412 }
1413 /**
1414 * This method initializes jScrollPaneModuleSaOptions
1415 *
1416 * @return javax.swing.JScrollPane
1417 */
1418 private JScrollPane getJScrollPaneModuleSaOptions() {
1419 if (jScrollPaneModuleSaOptions == null) {
1420 jScrollPaneModuleSaOptions = new JScrollPane();
1421 jScrollPaneModuleSaOptions.setPreferredSize(new java.awt.Dimension(600,350));
1422 jScrollPaneModuleSaOptions.setViewportView(getJTableModuleSaOptions());
1423 }
1424 return jScrollPaneModuleSaOptions;
1425 }
1426 /**
1427 * This method initializes jTableModuleSaOptions
1428 *
1429 * @return javax.swing.JTable
1430 */
1431 private JTable getJTableModuleSaOptions() {
1432 if (jTableModuleSaOptions == null) {
1433 optionsTableModel = new DefaultTableModel();
1434 optionsTableModel.addColumn("BuildTargets");
1435 optionsTableModel.addColumn("ToolChainFamily");
1436 optionsTableModel.addColumn("TagName");
1437 optionsTableModel.addColumn("ToolCode");
1438 optionsTableModel.addColumn("SupportedArchs");
1439 optionsTableModel.addColumn("Contents");
1440 jTableModuleSaOptions = new JTable(optionsTableModel);
1441 jTableModuleSaOptions.setRowHeight(20);
1442
1443 jTableModuleSaOptions.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth);
1444 jTableModuleSaOptions.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth);
1445 jTableModuleSaOptions.getColumnModel().getColumn(2).setMinWidth(tagNameWidth);
1446 jTableModuleSaOptions.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth);
1447 jTableModuleSaOptions.getColumnModel().getColumn(4).setMinWidth(supportArchWidth);
1448 jTableModuleSaOptions.getColumnModel().getColumn(5).setMinWidth(argWidth);
1449 // javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);
1450 // JComboBox cb = new JComboBox();
1451 // cb.addItem("MSFT");
1452 // cb.addItem("GCC");
1453 // cb.addItem("CYGWIN");
1454 // cb.addItem("INTEL");
1455 // cb.addItem("USER_DEFINED");
1456 // toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1457
1458 Vector<String> vArch = new Vector<String>();
1459 vArch.add("IA32");
1460 vArch.add("X64");
1461 vArch.add("IPF");
1462 vArch.add("EBC");
1463 vArch.add("ARM");
1464 vArch.add("PPC");
1465 jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch));
1466
1467 jTableModuleSaOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());
1468
1469 jTableModuleSaOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
1470 jTableModuleSaOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
1471 jTableModuleSaOptions.getModel().addTableModelListener(new TableModelListener() {
1472 public void tableChanged(TableModelEvent arg0) {
1473 // TODO Auto-generated method stub
1474 int row = arg0.getFirstRow();
1475 TableModel m = (TableModel)arg0.getSource();
1476
1477 if (arg0.getType() == TableModelEvent.UPDATE){
1478 //ToDo Data Validition check.
1479 String targets = m.getValueAt(row, 0) + "";
1480 Vector<Object> targetName = null;
1481 if (targets.length() > 0) {
1482 targetName = new Vector<Object>();
1483 String[] sArray = targets.split(" ");
1484 for (int i = 0; i < sArray.length; ++i) {
1485 targetName.add(sArray[i]);
1486 }
1487 }
1488
1489 String toolChain = m.getValueAt(row, 1) + "";
1490 String tagName = m.getValueAt(row, 2) + "";
1491 String toolCode = m.getValueAt(row, 3) + "";
1492 String archs = m.getValueAt(row, 4) + "";
1493 Vector<Object> supArch = null;
1494 if (archs.length() > 0) {
1495 supArch = new Vector<Object>();
1496 String[] sArray1 = archs.split(" ");
1497 for (int i = 0; i < sArray1.length; ++i) {
1498 supArch.add(sArray1[i]);
1499 }
1500 }
1501
1502 String contents = m.getValueAt(row, 5) + "";
1503 docConsole.setSaved(false);
1504 ffc.updateModuleSAOptionsOpt(moduleKey, row, targetName, toolChain, tagName, toolCode, supArch, contents);
1505 }
1506 }
1507 });
1508 }
1509 return jTableModuleSaOptions;
1510 }
1511 /**
1512 * This method initializes jButtonNew
1513 *
1514 * @return javax.swing.JButton
1515 */
1516 private JButton getJButtonNew() {
1517 if (jButtonNew == null) {
1518 jButtonNew = new JButton();
1519 jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));
1520 jButtonNew.setText("New");
1521 jButtonNew.addActionListener(new java.awt.event.ActionListener() {
1522 public void actionPerformed(java.awt.event.ActionEvent e) {
1523 String[] row = {"", "", "", "", "", ""};
1524 optionsTableModel.addRow(row);
1525 Vector<Object> v = null;
1526 Vector<Object> v1 = null;
1527 docConsole.setSaved(false);
1528 ffc.genModuleSAOptionsOpt(moduleKey, v, "", "", "", v1, "");
1529 }
1530 });
1531 }
1532 return jButtonNew;
1533 }
1534 /**
1535 * This method initializes jButtonDelete
1536 *
1537 * @return javax.swing.JButton
1538 */
1539 private JButton getJButtonDeleteOption() {
1540 if (jButtonDeleteOption == null) {
1541 jButtonDeleteOption = new JButton();
1542 jButtonDeleteOption.setPreferredSize(new java.awt.Dimension(80,20));
1543 jButtonDeleteOption.setText("Delete");
1544 jButtonDeleteOption.addActionListener(new java.awt.event.ActionListener() {
1545 public void actionPerformed(java.awt.event.ActionEvent e) {
1546 if (jTableModuleSaOptions.getSelectedRow() < 0) {
1547 return;
1548 }
1549 docConsole.setSaved(false);
1550 ffc.removeModuleSAOptionsOpt(moduleKey, jTableModuleSaOptions.getSelectedRow());
1551 optionsTableModel.removeRow(jTableModuleSaOptions.getSelectedRow());
1552 }
1553 });
1554 }
1555 return jButtonDeleteOption;
1556 }
1557
1558 /**
1559 Start the window at the center of screen
1560
1561 **/
1562 protected void centerWindow(int intWidth, int intHeight) {
1563 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
1564 this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
1565 }
1566
1567 /**
1568 Start the window at the center of screen
1569
1570 **/
1571 protected void centerWindow() {
1572 centerWindow(this.getSize().width, this.getSize().height);
1573 }
1574 /**
1575 * This method initializes jPanelPcdFields
1576 *
1577 * @return javax.swing.JPanel
1578 */
1579 private JPanel getJPanelPcdFields() {
1580 if (jPanelPcdFields == null) {
1581 GridLayout gridLayout = new GridLayout();
1582 gridLayout.setRows(3);
1583 gridLayout.setColumns(2);
1584 jPanelPcdFields = new JPanel();
1585 jPanelPcdFields.setLayout(gridLayout);
1586 jPanelPcdFields.setPreferredSize(new java.awt.Dimension(600,90));
1587 jPanelPcdFields.add(getJPanelPcdFieldsFirstRow(), null);
1588 jPanelPcdFields.add(getJPanelPcdFieldsSecondRow(), null);
1589 jPanelPcdFields.add(getJPanelPcdFieldsThirdRow(), null);
1590 }
1591 return jPanelPcdFields;
1592 }
1593 /**
1594 * This method initializes jPanelPcdFieldsSecondRow
1595 *
1596 * @return javax.swing.JPanel
1597 */
1598 private JPanel getJPanelPcdFieldsSecondRow() {
1599 if (jPanelPcdFieldsSecondRow == null) {
1600 FlowLayout flowLayout2 = new FlowLayout();
1601 flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
1602 jLabelMaxDatumSize = new JLabel();
1603 jLabelMaxDatumSize.setText("Max Datum Size");
1604 jPanelPcdFieldsSecondRow = new JPanel();
1605 jPanelPcdFieldsSecondRow.setLayout(flowLayout2);
1606 jPanelPcdFieldsSecondRow.add(jLabelMaxDatumSize, null);
1607 jPanelPcdFieldsSecondRow.add(getJTextFieldMaxDatumSize(), null);
1608 }
1609 return jPanelPcdFieldsSecondRow;
1610 }
1611 /**
1612 * This method initializes jPanelPcdFieldsThirdRow
1613 *
1614 * @return javax.swing.JPanel
1615 */
1616 private JPanel getJPanelPcdFieldsThirdRow() {
1617 if (jPanelPcdFieldsThirdRow == null) {
1618 FlowLayout flowLayout3 = new FlowLayout();
1619 flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
1620 jLabelPcdDefaultValue = new JLabel();
1621 jLabelPcdDefaultValue.setText("Default Value");
1622 jLabelPcdDefaultValue.setPreferredSize(new java.awt.Dimension(91,16));
1623 jPanelPcdFieldsThirdRow = new JPanel();
1624 jPanelPcdFieldsThirdRow.setLayout(flowLayout3);
1625 jPanelPcdFieldsThirdRow.add(jLabelPcdDefaultValue, null);
1626 jPanelPcdFieldsThirdRow.add(getJTextFieldPcdDefault(), null);
1627 jPanelPcdFieldsThirdRow.add(getJComboBoxFeatureFlagValue(), null);
1628 jPanelPcdFieldsThirdRow.add(getJButtonUpdatePcd(), null);
1629 }
1630 return jPanelPcdFieldsThirdRow;
1631 }
1632 /**
1633 * This method initializes jPanelPcdFieldsFirstRow
1634 *
1635 * @return javax.swing.JPanel
1636 */
1637 private JPanel getJPanelPcdFieldsFirstRow() {
1638 if (jPanelPcdFieldsFirstRow == null) {
1639 FlowLayout flowLayout1 = new FlowLayout();
1640 flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
1641 jLabelItemType = new JLabel();
1642 jLabelItemType.setText("Item Type");
1643 jLabelItemType.setPreferredSize(new java.awt.Dimension(91,16));
1644 jPanelPcdFieldsFirstRow = new JPanel();
1645 jPanelPcdFieldsFirstRow.setLayout(flowLayout1);
1646 jPanelPcdFieldsFirstRow.add(jLabelItemType, null);
1647 jPanelPcdFieldsFirstRow.add(getJComboBoxItemType(), null);
1648 }
1649 return jPanelPcdFieldsFirstRow;
1650 }
1651 /**
1652 * This method initializes jComboBoxItemType
1653 *
1654 * @return javax.swing.JComboBox
1655 */
1656 private JComboBox getJComboBoxItemType() {
1657 if (jComboBoxItemType == null) {
1658 jComboBoxItemType = new JComboBox();
1659 jComboBoxItemType.setPreferredSize(new java.awt.Dimension(200,20));
1660 jComboBoxItemType.addItemListener(new java.awt.event.ItemListener() {
1661 public void itemStateChanged(java.awt.event.ItemEvent e) {
1662 int row = jTablePcd.getSelectedRow();
1663 if (row < 0 || model.getValueAt(row, 2).equals(jComboBoxItemType.getSelectedItem())) {
1664 return;
1665 }
1666 if (jComboBoxItemType.getItemCount() == 3) {
1667 if (!jComboBoxItemType.getSelectedItem().equals("DYNAMIC")) {
1668
1669 if (jComboBoxItemType.getSelectedItem().equals("FIXED_AT_BUILD")) {
1670 jTextFieldPcdDefault.setText("");
1671 jTextFieldPcdDefault.setEnabled(true);
1672 }
1673 }
1674 else{
1675
1676 }
1677 }
1678 }
1679 });
1680 }
1681 return jComboBoxItemType;
1682 }
1683
1684 private void pcdDynamicToNonDynamic(String cName, String tsGuid) {
1685 String[][] saa = new String[ffc.getDynamicPcdBuildDataCount()][5];
1686 ffc.getDynamicPcdBuildData(saa);
1687 String maxSize = "";
1688 String value = "";
1689 for (int i = 0; i < saa.length; ++i) {
1690 if (saa[i][0].equals(cName) && saa[i][2].equals(tsGuid)) {
1691 maxSize = saa[i][3];
1692 value = ffc.getDynamicPcdBuildDataValue(i);
1693 break;
1694 }
1695 }
1696
1697 ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
1698 for (int i = 0; i < al.size(); ++i) {
1699 String mKey = moduleInfo (al.get(i));
1700 value = null;
1701 ffc.updatePcdData(mKey, cName, tsGuid, jComboBoxItemType.getSelectedItem()+"", maxSize, value);
1702 String itemType = jComboBoxItemType.getSelectedItem()+"";
1703 al.set(i, mKey + " " + itemType);
1704 }
1705
1706 ffc.removeDynamicPcdBuildData(cName, tsGuid);
1707 }
1708
1709 private void pcdNonDynamicToDynamic(String cName, String tsGuid) {
1710 ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
1711 for (int i = 0; i < al.size(); ++i) {
1712 String mKey = moduleInfo (al.get(i));
1713 ffc.updatePcdData(mKey, cName, tsGuid, jComboBoxItemType.getSelectedItem()+"", jTextFieldMaxDatumSize.getText(), jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");
1714 String itemType = jComboBoxItemType.getSelectedItem()+"";
1715 al.set(i, mKey + " " + itemType);
1716 }
1717 try{
1718 ffc.addDynamicPcdBuildData(cName, jTablePcd.getValueAt(jTablePcd.getSelectedRow(), 3), tsGuid, "DYNAMIC", jTablePcd.getValueAt(jTablePcd.getSelectedRow(), 5)+"", jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");
1719 }
1720 catch(Exception e){
1721 JOptionPane.showMessageDialog(frame, "PCD value format: " + e.getMessage());
1722 }
1723 }
1724
1725 private String moduleInfo (String pcdInfo) {
1726
1727 return pcdInfo.substring(0, pcdInfo.lastIndexOf(" "));
1728 }
1729
1730 /**
1731 * This method initializes jTextFieldMaxDatumSize
1732 *
1733 * @return javax.swing.JTextField
1734 */
1735 private JTextField getJTextFieldMaxDatumSize() {
1736 if (jTextFieldMaxDatumSize == null) {
1737 jTextFieldMaxDatumSize = new JTextField();
1738 jTextFieldMaxDatumSize.setPreferredSize(new java.awt.Dimension(200,20));
1739 }
1740 return jTextFieldMaxDatumSize;
1741 }
1742 /**
1743 * This method initializes jTextField4
1744 *
1745 * @return javax.swing.JTextField
1746 */
1747 private JTextField getJTextFieldPcdDefault() {
1748 if (jTextFieldPcdDefault == null) {
1749 jTextFieldPcdDefault = new JTextField();
1750 jTextFieldPcdDefault.setPreferredSize(new java.awt.Dimension(200,20));
1751 }
1752 return jTextFieldPcdDefault;
1753 }
1754 /**
1755 * This method initializes jButton6
1756 *
1757 * @return javax.swing.JButton
1758 */
1759 private JButton getJButtonUpdatePcd() {
1760 if (jButtonUpdatePcd == null) {
1761 jButtonUpdatePcd = new JButton();
1762 jButtonUpdatePcd.setPreferredSize(new java.awt.Dimension(150,20));
1763 jButtonUpdatePcd.setText("Update PCD Data");
1764 jButtonUpdatePcd.addActionListener(new java.awt.event.ActionListener() {
1765 public void actionPerformed(java.awt.event.ActionEvent e) {
1766 int row = jTablePcd.getSelectedRow();
1767 if (row < 0) {
1768 return;
1769 }
1770 docConsole.setSaved(false);
1771 String oldItemType = model.getValueAt(row, 2)+"";
1772 String newItemType = jComboBoxItemType.getSelectedItem()+"";
1773 model.setValueAt(newItemType, row, 2);
1774 model.setValueAt(jTextFieldPcdDefault.isVisible()? jTextFieldPcdDefault.getText():jComboBoxFeatureFlagValue.getSelectedItem(), row, 6);
1775
1776 String[] pcdInfo = {"", "", ""};
1777 getPcdInfo (model.getValueAt(row, 0)+"", model.getValueAt(row, 1)+"", pcdInfo);
1778 if (pcdInfo[1].equals("FIXED_AT_BUILD") && model.getValueAt(row, 5).equals("VOID*")) {
1779 try {
1780 jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(model.getValueAt(row, 6)+"")+"");
1781 }
1782 catch (Exception exp) {
1783 JOptionPane.showMessageDialog(frame, "PCD Value MalFormed: " + exp.getMessage());
1784 return;
1785 }
1786 }
1787 model.setValueAt(jTextFieldMaxDatumSize.getText(), row, 4);
1788
1789 if (oldItemType.equals("DYNAMIC") && !newItemType.equals("DYNAMIC")) {
1790 pcdDynamicToNonDynamic(model.getValueAt(row, 0)+"", model.getValueAt(row, 1)+"");
1791 }
1792 if (!oldItemType.equals("DYNAMIC") && newItemType.equals("DYNAMIC")) {
1793 pcdNonDynamicToDynamic(model.getValueAt(row, 0)+"", model.getValueAt(row, 1)+"");
1794 }
1795 ffc.updatePcdData(moduleKey, model.getValueAt(row, 0)+"", model.getValueAt(row, 1)+"", model.getValueAt(row, 2)+"", model.getValueAt(row, 4)+"", model.getValueAt(row, 6)+"");
1796 }
1797 });
1798 }
1799 return jButtonUpdatePcd;
1800 }
1801 /**
1802 * This method initializes jComboBoxFeatureFlagValue
1803 *
1804 * @return javax.swing.JComboBox
1805 */
1806 private JComboBox getJComboBoxFeatureFlagValue() {
1807 if (jComboBoxFeatureFlagValue == null) {
1808 jComboBoxFeatureFlagValue = new JComboBox();
1809 jComboBoxFeatureFlagValue.setPreferredSize(new java.awt.Dimension(100,20));
1810 jComboBoxFeatureFlagValue.setVisible(false);
1811 jComboBoxFeatureFlagValue.addItem("TRUE");
1812 jComboBoxFeatureFlagValue.addItem("FALSE");
1813 }
1814 return jComboBoxFeatureFlagValue;
1815 }
1816 /**
1817 * This method initializes jPanelCustomToolChain
1818 *
1819 * @return javax.swing.JPanel
1820 */
1821 private JPanel getJPanelCustomToolChain() {
1822 if (jPanelCustomToolChain == null) {
1823 jPanelCustomToolChain = new JPanel();
1824 jPanelCustomToolChain.setLayout(new BorderLayout());
1825 jPanelCustomToolChain.add(getJPanelToolchainS(), java.awt.BorderLayout.SOUTH);
1826 jPanelCustomToolChain.add(getJScrollPaneModuleSaOptions(), java.awt.BorderLayout.CENTER);
1827 jPanelCustomToolChain.addComponentListener(new java.awt.event.ComponentAdapter() {
1828 public void componentShown(java.awt.event.ComponentEvent e) {
1829 initToolChainOptions(moduleKey);
1830 }
1831 });
1832 }
1833 return jPanelCustomToolChain;
1834 }
1835 /**
1836 * This method initializes jPanelToolchainS
1837 *
1838 * @return javax.swing.JPanel
1839 */
1840 private JPanel getJPanelToolchainS() {
1841 if (jPanelToolchainS == null) {
1842 jPanelToolchainS = new JPanel();
1843 jPanelToolchainS.add(getJButtonNew(), null);
1844 jPanelToolchainS.add(getJButtonDeleteOption(), null);
1845 }
1846 return jPanelToolchainS;
1847 }
1848
1849 /**
1850 * This method initializes jPanelLibraryCenterN
1851 *
1852 * @return javax.swing.JPanel
1853 */
1854 private JPanel getJPanelLibraryCenterN() {
1855 if (jPanelLibraryCenterN == null) {
1856 FlowLayout flowLayout5 = new FlowLayout();
1857 flowLayout5.setAlignment(java.awt.FlowLayout.CENTER);
1858 flowLayout5.setHgap(10);
1859 jPanelLibraryCenterN = new JPanel();
1860 jPanelLibraryCenterN.setLayout(flowLayout5);
1861 jPanelLibraryCenterN.add(jLabelInstanceHelp, null);
1862 jPanelLibraryCenterN.add(getJScrollPaneInstanceHelp(), null);
1863 jPanelLibraryCenterN.add(getJButtonAdd(), null);
1864 jPanelLibraryCenterN.add(getJButtonDeleteInstance(), null);
1865 }
1866 return jPanelLibraryCenterN;
1867 }
1868 /**
1869 * This method initializes jPanelLibraryCenterC
1870 *
1871 * @return javax.swing.JPanel
1872 */
1873 private JPanel getJPanelLibraryCenterC() {
1874 if (jPanelLibraryCenterC == null) {
1875 jPanelLibraryCenterC = new JPanel();
1876 jPanelLibraryCenterC.add(jLabelSelectedInstances, null);
1877 jPanelLibraryCenterC.add(getJScrollPaneSelectedInstances(), null);
1878 }
1879 return jPanelLibraryCenterC;
1880 }
1881
1882
1883 } // @jve:decl-index=0:visual-constraint="10,10"
1884
1885 class MultipleInstanceException extends Exception {
1886
1887 /**
1888 *
1889 */
1890 private static final long serialVersionUID = -9148463005930920297L;
1891 private String className = null;
1892 private String libInstance1 = null;
1893 private String libInstance2 = null;
1894
1895 MultipleInstanceException (String libClass, String instance1, String instance2) {
1896 super();
1897 className = libClass;
1898 libInstance1 = instance1;
1899 libInstance2 = instance2;
1900 }
1901
1902 /* (non-Javadoc)
1903 * @see java.lang.Throwable#getMessage()
1904 */
1905 @Override
1906 public String getMessage() {
1907 // TODO Auto-generated method stub
1908 return "Library Class " + className + "is Produced by Two Instances: "
1909 + libInstance1 + " and " + libInstance2 + ". Platform Build will Fail.";
1910 }
1911
1912 }
1913
1914 class NoInstanceException extends Exception {
1915
1916 /**
1917 *
1918 */
1919 private static final long serialVersionUID = 1987122786598970598L;
1920
1921 private String className = null;
1922
1923 NoInstanceException (String libClass) {
1924 className = libClass;
1925 }
1926
1927 public String getMessage() {
1928 return "No Applicable Instance for Library Class " + className
1929 + ", Platform Build will Fail.";
1930 }
1931 }