1 package org
.tianocore
.frameworkwizard
.platform
.ui
;
3 import java
.awt
.BorderLayout
;
4 import java
.awt
.Dimension
;
5 import java
.awt
.Toolkit
;
7 import javax
.swing
.JOptionPane
;
8 import javax
.swing
.JPanel
;
9 import javax
.swing
.JDialog
;
10 import javax
.swing
.JTabbedPane
;
11 import javax
.swing
.JLabel
;
12 import javax
.swing
.JScrollPane
;
13 import javax
.swing
.JTable
;
14 import javax
.swing
.JTextArea
;
15 import javax
.swing
.JSplitPane
;
16 import javax
.swing
.JButton
;
17 import javax
.swing
.ListSelectionModel
;
18 import javax
.swing
.event
.ListSelectionEvent
;
19 import javax
.swing
.event
.ListSelectionListener
;
20 import javax
.swing
.event
.TableModelEvent
;
21 import javax
.swing
.event
.TableModelListener
;
22 import javax
.swing
.table
.DefaultTableModel
;
23 import javax
.swing
.table
.TableColumn
;
24 import javax
.swing
.table
.TableModel
;
26 import org
.tianocore
.frameworkwizard
.FrameworkWizardUI
;
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
;
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
;
45 import java
.util
.Stack
;
46 import java
.util
.Vector
;
48 import javax
.swing
.JTextField
;
49 import java
.awt
.GridLayout
;
50 import javax
.swing
.JComboBox
;
52 public class FpdModuleSA
extends JDialog
implements ActionListener
{
57 private static final long serialVersionUID
= 1L;
58 private JPanel jContentPane
= null;
59 private JTabbedPane jTabbedPane
= null;
60 private JPanel jPanelPcd
= null;
61 private JPanel jPanelLibrary
= null;
62 private JLabel jLabelPcdData
= null;
63 private JScrollPane jScrollPaneTablePcd
= null;
64 private JTable jTablePcd
= null;
65 private JPanel jPanelPcdSouth
= null;
66 private JScrollPane jScrollPanePcdHelp
= null;
67 private JTextArea jTextAreaPcdHelp
= null;
68 private JPanel jPanelContentPaneSouth
= null;
69 private JSplitPane jSplitPane
= null;
70 private JPanel jPanelLibraryLeft
= null;
71 private JPanel jPanelLibraryRight
= null;
72 private JLabel jLabelLibClass
= null;
73 private JLabel jLabelQualifiedInstance
= null;
74 private JScrollPane jScrollPaneSelectedInstances
= null;
75 private JTable jTableSelectedInstances
= null;
76 private JScrollPane jScrollPaneLibClass
= null;
77 private JTable jTableLibClass
= null;
78 private JScrollPane jScrollPaneQualifiedInstance
= null;
79 private JTable jTableLibInstances
= null;
80 private JPanel jPanelLibrarySouth
= null;
81 private JPanel jPanelLibraryCenter
= null;
82 private JScrollPane jScrollPaneInstanceHelp
= null;
83 private JTextArea jTextAreaInstanceHelp
= null;
84 private JLabel jLabelSelectedInstances
= null;
85 private JLabel jLabelInstanceHelp
= null;
86 private JButton jButtonAdd
= null;
87 private JButton jButtonDeleteInstance
= null;
88 private JLabel jLabelPcdHelp
= null;
89 private JButton jButtonOk
= null;
90 private JButton jButtonCancel
= null;
91 private IDefaultTableModel model
= null;
92 private IDefaultTableModel selectedInstancesTableModel
= null;
93 private IDefaultTableModel libClassTableModel
= null;
94 private IDefaultTableModel libInstanceTableModel
= null;
95 private DefaultTableModel optionsTableModel
= null;
96 private FpdFileContents ffc
= null;
97 private String moduleKey
= null;
98 private ModuleIdentification moduleId
= null;
99 private int moduleSaNum
= -1;
100 private HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> classInstanceMap
= null;
102 // map of <{libName, supArch, supMod}, list of Module information>
104 private HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> classConsumed
= null;
105 private HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> classProduced
= null;
107 private JPanel jPanelModuleSaOpts
= null;
108 private JLabel jLabelFvBinding
= null;
109 private JTextField jTextFieldFvBinding
= null;
110 private JLabel jLabelFfsFileGuid
= null;
111 private JTextField jTextFieldFileGuid
= null;
112 private JLabel jLabelFfsFormatKey
= null;
113 private JTextField jTextFieldFfsKey
= null;
114 private JScrollPane jScrollPaneModuleSaOptions
= null;
115 private JTable jTableModuleSaOptions
= null;
116 private JButton jButtonNew
= null;
117 private JButton jButtonDeleteOption
= null;
118 private JPanel jPanelPcdFields
= null;
119 private JPanel jPanelPcdFieldsSecondRow
= null;
120 private JPanel jPanelPcdFieldsThirdRow
= null;
121 private JPanel jPanelPcdFieldsFirstRow
= null;
122 private JLabel jLabelItemType
= null;
123 private JComboBox jComboBoxItemType
= null;
124 private JLabel jLabelMaxDatumSize
= null;
125 private JTextField jTextFieldMaxDatumSize
= null;
126 private JLabel jLabelPcdDefaultValue
= null;
127 private JTextField jTextFieldPcdDefault
= null;
128 private JButton jButtonUpdatePcd
= null;
129 private JComboBox jComboBoxFeatureFlagValue
= null;
130 private OpeningPlatformType docConsole
= null;
131 private JPanel jPanelCustomToolChain
= null;
132 private JPanel jPanelToolchainS
= null;
133 private JPanel jPanelLibraryCenterN
= null;
134 private JPanel jPanelLibraryCenterC
= null; // @jve:decl-index=0:visual-constraint="20,224"
136 private final int buildTargetWidth
= 150;
137 private final int toolChainFamilyWidth
= 150;
138 private final int supportArchWidth
= 150;
139 private final int toolCmdCodeWidth
= 200;
140 private final int tagNameWidth
= 150;
141 private final int argWidth
= 400;
144 * This is the default constructor
146 public FpdModuleSA() {
147 super(FrameworkWizardUI
.getInstance());
150 public FpdModuleSA(FpdFileContents ffc
) {
155 public void setKey(String k
, int i
, OpeningPlatformType dc
){
158 this.docConsole
= dc
;
159 classInstanceMap
= null;
160 classProduced
= null;
161 classConsumed
= null;
162 jTabbedPane
.setSelectedIndex(0);
163 initPcdBuildDefinition(i
);
164 moduleId
= WorkspaceProfile
.getModuleId(moduleKey
);
165 if (moduleId
== null) {
168 int tabIndex
= jTabbedPane
.indexOfTab("Libraries");
169 if (moduleId
.isLibrary()) {
170 jTabbedPane
.setEnabledAt(tabIndex
, false);
173 jTabbedPane
.setEnabledAt(tabIndex
, true);
178 init will be called each time FpdModuleSA object is to be shown.
179 @param key Module information.
181 public void initPcdBuildDefinition(int i
) {
183 // display pcd for key.
185 model
.setRowCount(0);
186 jTextAreaPcdHelp
.setText("");
187 jComboBoxItemType
.setSelectedIndex(-1);
188 jTextFieldMaxDatumSize
.setText("");
189 jTextFieldPcdDefault
.setText("");
190 int pcdCount
= ffc
.getPcdDataCount(i
);
192 String
[][] saa
= new String
[pcdCount
][7];
193 ffc
.getPcdData(i
, saa
);
194 for (int j
= 0; j
< saa
.length
; ++j
) {
195 model
.addRow(saa
[j
]);
200 public void initLibraries(String key
) {
201 libClassTableModel
.setRowCount(0);
202 libInstanceTableModel
.setRowCount(0);
203 selectedInstancesTableModel
.setRowCount(0);
204 Vector
<String
> errorMsg
= new Vector
<String
>();
205 Vector
<ModuleIdentification
> newInstances
= new Vector
<ModuleIdentification
>();
207 addConsumedClassFromModule (key
);
208 addProducedClassFromModule (key
);
210 int instanceCount
= ffc
.getLibraryInstancesCount(key
);
211 if (instanceCount
!= 0) {
212 String
[][] saa
= new String
[instanceCount
][5];
213 ffc
.getLibraryInstances(key
, saa
);
214 for (int i
= 0; i
< saa
.length
; ++i
) {
215 String libInstanceKey
= saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4];
216 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(libInstanceKey
);
219 // ToDo: verify this instance first.
221 saa
[i
][0] = mi
.getName();
222 saa
[i
][2] = mi
.getVersion();
223 saa
[i
][4] = mi
.getPackageId().getVersion();
225 // re-evaluate lib instance usage when adding a already-selected lib instance.
227 addConsumedClassFromModule (libInstanceKey
);
228 addProducedClassFromModule (libInstanceKey
);
229 selectedInstancesTableModel
.addRow(saa
[i
]);
234 Set
<LibraryClassDescriptor
> sLcd
= this.classConsumed
.keySet();
235 Iterator
<LibraryClassDescriptor
> iter
= sLcd
.iterator();
236 Stack
<LibraryClassDescriptor
> lcdStack
= new Stack
<LibraryClassDescriptor
>();
237 while (iter
.hasNext()) {
238 LibraryClassDescriptor lcd
= iter
.next();
239 if (isBoundedClass(lcd
, errorMsg
)) {
243 if (!lcdStack
.contains(lcd
)) {
249 resolveLibraryInstances(lcdStack
, true, errorMsg
, newInstances
);
250 } catch (Exception e
) {
251 String exceptionMsg
= e
.getCause() + " " + e
.getMessage();
252 if (!errorMsg
.contains(exceptionMsg
)) {
253 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), e
.getCause() + " " + e
.getMessage());
257 String newInstancesAddedMsg
= "Library instance automatically added to this module :\n";
258 for (int i
= 0; i
< newInstances
.size(); ++i
) {
259 ModuleIdentification libMi
= newInstances
.get(i
);
260 newInstancesAddedMsg
+= libMi
.getName();
261 newInstancesAddedMsg
+= " ";
263 if (newInstances
.size() > 0) {
264 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), newInstancesAddedMsg
);
267 showClassToResolved();
269 if (errorMsg
.size() > 0) {
271 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
272 errors
+= " " + errorMsg
.get(i
) + "\n";
274 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), errors
);
278 public void initFvInfo (String key
) {
280 // display module SA options
282 jTextFieldFvBinding
.setText("");
283 String fvBinding
= ffc
.getFvBinding(key
);
284 if (fvBinding
!= null) {
285 jTextFieldFvBinding
.setText(fvBinding
);
287 jTextFieldFileGuid
.setText("");
288 String fileGuid
= ffc
.getFfsFileNameGuid(key
);
289 if (fileGuid
!= null) {
290 jTextFieldFileGuid
.setText(fileGuid
);
292 jTextFieldFfsKey
.setText("");
293 String ffsKey
= ffc
.getFfsFormatKey(key
);
294 if (ffsKey
!= null) {
295 jTextFieldFfsKey
.setText(ffsKey
);
299 public void initToolChainOptions(String key
) {
301 optionsTableModel
.setRowCount(0);
302 String
[][] saa
= new String
[ffc
.getModuleSAOptionsCount(key
)][6];
303 ffc
.getModuleSAOptions(key
, saa
);
304 for (int i
= 0; i
< saa
.length
; ++i
) {
305 optionsTableModel
.addRow(saa
[i
]);
309 private void filterClassConsumedByArch (Vector
<LibraryClassDescriptor
> v
) {
310 String
[] moduleInfo
= moduleKey
.split(" ");
311 Vector
<String
> vModuleArchs
= new Vector
<String
>();
313 // Skip guid, version information, get archs to check.
315 for (int i
= 4; i
< moduleInfo
.length
; ++i
) {
316 vModuleArchs
.add(moduleInfo
[i
]);
319 // if module will be built on all platforms, no filter needed for lib classes.
321 if (vModuleArchs
.size() == 0) {
325 Iterator
<LibraryClassDescriptor
> iter
= v
.iterator();
326 while (iter
.hasNext()) {
327 LibraryClassDescriptor libInfo
= iter
.next();
329 Vector
<String
> vSupArchs
= libInfo
.getVectorFromString(libInfo
.supArchs
);
331 if (vSupArchs
.size() == 0 || (vSupArchs
.size() == 1 && vSupArchs
.get(0).equalsIgnoreCase(""))) {
333 // update lib info to module archs only.
335 libInfo
.supArchs
= "";
336 for (int i
= 0; i
< vModuleArchs
.size(); ++i
) {
337 libInfo
.supArchs
+= vModuleArchs
.get(i
);
338 libInfo
.supArchs
+= " ";
340 libInfo
.supArchs
.trim();
344 // only retain those lib class used by module archs.
346 vSupArchs
.retainAll(vModuleArchs
);
347 if (vSupArchs
.size() > 0) {
349 // update lib info to reflect which kind of arch need to select instance.
351 libInfo
.supArchs
= "";
352 for (int i
= 0; i
< vSupArchs
.size(); ++i
) {
353 libInfo
.supArchs
+= vSupArchs
.get(i
);
354 libInfo
.supArchs
+= " ";
356 libInfo
.supArchs
.trim();
360 // remove this lib definition if it supports no archs module will be built under.
366 private void addProducedClassFromModule (String key
) {
367 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
368 Vector
<LibraryClassDescriptor
> vClassProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
369 if (this.classProduced
== null) {
370 this.classProduced
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
372 for (int i
= 0; i
< vClassProduced
.size(); ++i
) {
373 ArrayList
<String
> producedBy
= this.classProduced
.get(vClassProduced
.get(i
));
374 if (producedBy
== null) {
375 producedBy
= new ArrayList
<String
>();
378 // class already produced by previous module (lib instance).
380 if (producedBy.size() == 1) {
381 String instanceKey = producedBy.get(0);
382 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
383 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
385 Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
386 while (lcdi.hasNext()) {
387 LibraryClassDescriptor lcd = lcdi.next();
388 if (vClassProduced.get(i).hasInterSectionWith(lcd)) {
389 ArrayList<String> alreadyProducedBy = this.classProduced.get(lcd);
390 String instanceKey = alreadyProducedBy.get(0);
391 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
392 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
399 this.classProduced
.put(vClassProduced
.get(i
), producedBy
);
404 private Vector
<LibraryClassDescriptor
> addConsumedClassFromModule (String key
) {
405 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
406 // PackageIdentification[] depPkgList = null;
409 // Get dependency pkg list into which we will search lib instances.
411 //depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
413 // Get the lib class consumed, produced by this module itself.
415 Vector
<LibraryClassDescriptor
> vClassConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED", mi
);
416 for (int i
= 0; i
< vClassConsumed
.size(); ++i
) {
417 vClassConsumed
.get(i
).supModTypes
= WorkspaceProfile
.getModuleType(moduleId
);
419 filterClassConsumedByArch(vClassConsumed
);
420 if (this.classConsumed
== null) {
421 this.classConsumed
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
424 for (int i
= 0; i
< vClassConsumed
.size(); ++i
) {
425 ArrayList
<String
> consumedBy
= this.classConsumed
.get(vClassConsumed
.get(i
));
426 if (consumedBy
== null) {
427 consumedBy
= new ArrayList
<String
>();
430 this.classConsumed
.put(vClassConsumed
.get(i
), consumedBy
);
433 return vClassConsumed
;
436 private void resolveLibraryInstances(Stack
<LibraryClassDescriptor
> lcdStack
, boolean autoSelectSingleInstance
, Vector
<String
> errorMsg
, Vector
<ModuleIdentification
> newInstances
) throws MultipleInstanceException
, NoInstanceException
{
438 if (classInstanceMap
== null) {
439 classInstanceMap
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
441 while (!lcdStack
.empty()) {
442 LibraryClassDescriptor cls
= lcdStack
.pop();
443 if (isBoundedClass(cls
, errorMsg
)) {
446 ArrayList
<String
> instances
= getInstancesForClass(cls
, null);
447 if (instances
.size() == 0) {
448 // throw new NoInstanceException (cls.className);
449 String exceptionMsg
= new NoInstanceException (cls
.className
).getMessage();
450 if (!errorMsg
.contains(exceptionMsg
)) {
451 errorMsg
.add(exceptionMsg
);
455 classInstanceMap
.put(cls
, instances
);
456 if (instances
.size() == 1 && autoSelectSingleInstance
) {
457 String instanceInfo
= instances
.get(0);
458 ModuleIdentification libMi
= WorkspaceProfile
.getModuleId(instanceInfo
);
460 Object
[] row
= {libMi
.getName(), libMi
.getGuid(), libMi
.getVersion(),
461 libMi
.getPackageId().getGuid(), libMi
.getPackageId().getVersion()};
462 if (!ffc
.instanceExistsInModuleSA(moduleKey
, row
[1]+"", row
[2]+"", row
[3]+"", row
[4]+"")) {
463 addLibInstance(libMi
);
464 newInstances
.add(libMi
);
465 docConsole
.setSaved(false);
466 selectedInstancesTableModel
.addRow(row
);
467 addProducedClassFromModule (instanceInfo
);
468 Vector
<LibraryClassDescriptor
> vLcd
= addConsumedClassFromModule(instanceInfo
);
469 for (int i
= 0; i
< vLcd
.size(); ++i
) {
470 LibraryClassDescriptor lcd
= vLcd
.get(i
);
471 if (!lcdStack
.contains(lcd
)) {
477 catch (Exception e
) {
478 if (!errorMsg
.contains(e
.getMessage())) {
479 errorMsg
.add(e
.getMessage());
487 /**Search classProduced map to see if this class has been produced by some instance (module).
491 private boolean isBoundedClass (LibraryClassDescriptor cls
, Vector
<String
> errorMsg
) {
492 // if (this.classProduced.containsKey(cls)) {
495 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
496 while (lcdi
.hasNext()) {
497 LibraryClassDescriptor lcd
= lcdi
.next();
498 if (cls
.className
.equals(lcd
.className
)) {
499 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)) {
503 ArrayList
<String
> producedBy
= this.classProduced
.get(lcd
);
504 String instancesName
= "";
505 for (int i
= 0; i
< producedBy
.size(); ++i
) {
506 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(producedBy
.get(i
));
507 instancesName
+= mi
.getName();
508 instancesName
+= " ";
510 String msg
= new ImproperInstanceException(lcd
.className
, instancesName
, lcd
.supArchs
, lcd
.supModTypes
).getMessage();
511 if (!errorMsg
.contains(msg
)) {
521 private ArrayList
<String
> getInstancesForClass(LibraryClassDescriptor cls
, PackageIdentification
[] depPkgList
){
522 ArrayList
<String
> al
= new ArrayList
<String
>();
524 // for (int i = 0; i < depPkgList.length; ++i) {
525 Iterator ismi
= GlobalData
.vModuleList
.iterator();
526 while(ismi
.hasNext()) {
527 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
528 // if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
531 Vector
<LibraryClassDescriptor
> clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
533 boolean isPotential
= false;
534 Iterator
<LibraryClassDescriptor
> lcdi
= clsProduced
.iterator();
535 while (lcdi
.hasNext()) {
536 LibraryClassDescriptor lcd
= lcdi
.next();
537 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)){
541 if (isPotential
&& hasBeenProduced(lcd
)) {
547 al
.add(mi
.getGuid() + " " + mi
.getVersion() + " " +
548 mi
.getPackageId().getGuid() + " " + mi
.getPackageId().getVersion());
556 private boolean hasBeenProduced (LibraryClassDescriptor cls
) {
557 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
558 while (lcdi
.hasNext()) {
559 LibraryClassDescriptor lcd
= lcdi
.next();
560 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)) {
567 private ArrayList
<String
> getConsumedBy (String className
) {
568 Iterator
<LibraryClassDescriptor
> lcdi
= this.classConsumed
.keySet().iterator();
569 while (lcdi
.hasNext()) {
570 LibraryClassDescriptor lcd
= lcdi
.next();
571 if ((lcd
.className
!= null) && lcd
.className
.equals(className
)) {
572 return this.classConsumed
.get(lcd
);
578 private void removeInstance(String key
) {
579 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
581 // remove pcd information of instance from current ModuleSA
583 ffc
.removePcdData(moduleKey
, mi
);
585 // remove class produced by this instance and add back these produced class to be bound.
587 Vector
<LibraryClassDescriptor
> clsProduced
= getClassProduced(mi
);
588 for (int i
= 0; i
< clsProduced
.size(); ++i
) {
590 classProduced
.remove(clsProduced
.get(i
));
593 // remove class consumed by this instance. we do not need to bound it now.
595 String
[] clsConsumed
= getClassConsumed(mi
);
596 for (int i
= 0; i
< clsConsumed
.length
; ++i
) {
597 ArrayList
<String
> al
= getConsumedBy (clsConsumed
[i
]);
609 private Vector
<LibraryClassDescriptor
> getClassProduced(ModuleIdentification mi
){
611 Vector
<LibraryClassDescriptor
> clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
613 // String[] sClassProduced = new String[clsProduced.size()];
614 // for (int i = 0; i < clsProduced.size(); ++i) {
615 // sClassProduced[i] = clsProduced.get(i).className;
617 // return sClassProduced;
620 private String
[] getClassConsumed(ModuleIdentification mi
){
622 Vector
<LibraryClassDescriptor
> clsConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED", mi
);
623 String
[] sClassConsumed
= new String
[clsConsumed
.size()];
624 for (int i
= 0; i
< clsConsumed
.size(); ++i
) {
625 sClassConsumed
[i
] = clsConsumed
.get(i
).className
;
627 return sClassConsumed
;
630 private void showClassToResolved(){
631 Vector
<String
> errorMsg
= new Vector
<String
>();
632 libClassTableModel
.setRowCount(0);
633 libInstanceTableModel
.setRowCount(0);
634 if (classConsumed
== null || classConsumed
.size() == 0) {
638 Iterator
<LibraryClassDescriptor
> li
= classConsumed
.keySet().iterator();
640 LibraryClassDescriptor lcd
= li
.next();
641 if (classConsumed
.get(lcd
) == null || classConsumed
.get(lcd
).size() == 0) {
645 if (!isBoundedClass(lcd
, errorMsg
)){
647 String
[] s
= { lcd
.className
, lcd
.supArchs
, lcd
.supModTypes
};
648 libClassTableModel
.addRow(s
);
652 if (errorMsg
.size() > 0) {
654 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
655 errors
+= " " + errorMsg
.get(i
) + "\n";
657 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), errors
);
661 private String
getModuleArch () {
663 String
[] moduleInfo
= moduleKey
.split(" ");
664 for (int i
= 4; i
< moduleInfo
.length
; ++i
) {
665 arch
+= moduleInfo
[i
];
670 private void addLibInstance (ModuleIdentification libMi
) throws Exception
{
673 // Add pcd information of selected instance to current moduleSA
675 ffc
.addFrameworkModulesPcdBuildDefs(libMi
, getModuleArch(), ffc
.getModuleSA(moduleKey
));
677 ffc
.genLibraryInstance(libMi
, moduleKey
);
680 * This method initializes this
684 private void initialize() {
685 this.setSize(877, 555);
686 this.setResizable(false);
689 this.setTitle("Module Settings");
690 this.setContentPane(getJContentPane());
694 * This method initializes jContentPane
696 * @return javax.swing.JPanel
698 private JPanel
getJContentPane() {
699 if (jContentPane
== null) {
700 jContentPane
= new JPanel();
701 jContentPane
.setLayout(new BorderLayout());
702 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
703 jContentPane
.add(getJPanelContentPaneSouth(), java
.awt
.BorderLayout
.SOUTH
);
709 * This method initializes jTabbedPane
711 * @return javax.swing.JTabbedPane
713 private JTabbedPane
getJTabbedPane() {
714 if (jTabbedPane
== null) {
715 jTabbedPane
= new JTabbedPane();
716 jTabbedPane
.addTab("PCD Build Definition", null, getJPanelPcd(), null);
717 jTabbedPane
.addTab("Libraries", null, getJPanelLibrary(), null);
718 jTabbedPane
.addTab("FV Info", null, getJPanelModuleSaOpts(), null);
719 jTabbedPane
.addTab("Custom Toolchain", null, getJPanelCustomToolChain(), null);
726 * This method initializes jPanelPcd
728 * @return javax.swing.JPanel
730 private JPanel
getJPanelPcd() {
731 if (jPanelPcd
== null) {
732 jLabelPcdData
= new JLabel();
733 jLabelPcdData
.setText(" PCD Data");
734 jPanelPcd
= new JPanel();
735 jPanelPcd
.setLayout(new BorderLayout());
736 jPanelPcd
.add(jLabelPcdData
, java
.awt
.BorderLayout
.NORTH
);
737 jPanelPcd
.add(getJScrollPaneTablePcd(), java
.awt
.BorderLayout
.CENTER
);
738 jPanelPcd
.add(getJPanelPcdSouth(), java
.awt
.BorderLayout
.SOUTH
);
739 jPanelPcd
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
740 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
741 initPcdBuildDefinition(moduleSaNum
);
750 * This method initializes jPanelLibrary
752 * @return javax.swing.JPanel
754 private JPanel
getJPanelLibrary() {
755 if (jPanelLibrary
== null) {
756 jPanelLibrary
= new JPanel();
757 jPanelLibrary
.setLayout(new BorderLayout());
758 jPanelLibrary
.add(getJSplitPane(), java
.awt
.BorderLayout
.NORTH
);
759 jPanelLibrary
.add(getJPanelLibrarySouth(), java
.awt
.BorderLayout
.SOUTH
);
760 jPanelLibrary
.add(getJPanelLibraryCenter(), java
.awt
.BorderLayout
.CENTER
);
761 jPanelLibrary
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
762 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
763 initLibraries(moduleKey
);
767 return jPanelLibrary
;
771 * This method initializes jScrollPaneTablePcd
773 * @return javax.swing.JScrollPane
775 private JScrollPane
getJScrollPaneTablePcd() {
776 if (jScrollPaneTablePcd
== null) {
777 jScrollPaneTablePcd
= new JScrollPane();
778 jScrollPaneTablePcd
.setViewportView(getJTablePcd());
780 return jScrollPaneTablePcd
;
784 * This method initializes jTable
786 * @return javax.swing.JTable
788 private JTable
getJTablePcd() {
789 if (jTablePcd
== null) {
790 model
= new IDefaultTableModel();
791 jTablePcd
= new JTable(model
);
792 jTablePcd
.setRowHeight(20);
793 jTablePcd
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_ALL_COLUMNS
);
794 model
.addColumn("CName");
795 model
.addColumn("TokenSpaceGUID");
796 model
.addColumn("ItemType");
797 model
.addColumn("Token");
798 model
.addColumn("MaxDatumSize");
799 model
.addColumn("DataType");
800 model
.addColumn("DefaultValue");
802 jTablePcd
.getColumnModel().getColumn(0).setMinWidth(250);
804 TableColumn tokenColumn
= jTablePcd
.getColumnModel().getColumn(3);
805 jTablePcd
.removeColumn(tokenColumn
);
807 jTablePcd
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
808 jTablePcd
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
809 public void valueChanged(ListSelectionEvent e
) {
811 if (e
.getValueIsAdjusting()){
814 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
815 if (lsm
.isSelectionEmpty()) {
819 int selectedRow
= lsm
.getMinSelectionIndex();
820 String cName
= model
.getValueAt(selectedRow
, 0)+"";
821 String tsGuid
= model
.getValueAt(selectedRow
, 1)+"";
822 String itemType
= model
.getValueAt(selectedRow
, 2)+"";
824 // array for pcd related information: helpText, itemType, moduleType.
826 String
[] pcdInfo
= {"", "", ""};
827 Vector
<String
> validPcdTypes
= new Vector
<String
>();
828 getPcdInfo(moduleKey
, cName
, tsGuid
, pcdInfo
, validPcdTypes
);
829 jTextAreaPcdHelp
.setText(pcdInfo
[0]);
830 initComboBox(pcdInfo
[1], pcdInfo
[2], validPcdTypes
);
831 jComboBoxItemType
.setSelectedItem(itemType
);
832 jTextFieldMaxDatumSize
.setEnabled(true);
833 jTextFieldMaxDatumSize
.setVisible(true);
834 jTextFieldMaxDatumSize
.setText(model
.getValueAt(selectedRow
, 4)+"");
835 jTextFieldPcdDefault
.setEnabled(true);
836 jTextFieldPcdDefault
.setText(model
.getValueAt(selectedRow
, 6)+"");
837 if ((model
.getValueAt(selectedRow
, 5) != null) && model
.getValueAt(selectedRow
, 5).equals("VOID*")) {
838 if (pcdInfo
[1].equals("FEATURE_FLAG")) {
839 jTextFieldMaxDatumSize
.setVisible(false);
841 else if (pcdInfo
[1].equals("FIXED_AT_BUILD")) {
843 jTextFieldMaxDatumSize
.setEnabled(false);
844 jTextFieldMaxDatumSize
.setText(ffc
.setMaxSizeForPointer(model
.getValueAt(selectedRow
, 6)+"")+"");
846 catch(Exception except
){
847 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Unacceptable PCD Value: " + except
.getMessage());
851 jTextFieldMaxDatumSize
.setText(model
.getValueAt(selectedRow
, 4)+"");
855 jTextFieldMaxDatumSize
.setEnabled(false);
858 if (!model
.getValueAt(selectedRow
, 2).equals("DYNAMIC") && !model
.getValueAt(selectedRow
, 2).equals("DYNAMIC_EX")) {
859 jTextFieldPcdDefault
.setText(model
.getValueAt(selectedRow
, 6)+"");
860 if (model
.getValueAt(selectedRow
, 2).equals("FEATURE_FLAG")){
861 jTextFieldPcdDefault
.setVisible(false);
862 jComboBoxFeatureFlagValue
.setVisible(true);
863 jComboBoxFeatureFlagValue
.setSelectedItem(model
.getValueAt(selectedRow
, 6)+"");
866 jTextFieldPcdDefault
.setVisible(true);
867 jTextFieldPcdDefault
.setEnabled(true);
868 jComboBoxFeatureFlagValue
.setVisible(false);
872 jTextFieldPcdDefault
.setEnabled(false);
884 private void initComboBox(String originalType
, String mType
, Vector
<String
> validPcdTypes
) {
885 jComboBoxItemType
.removeAllItems();
887 if (originalType
.equals("DYNAMIC")) {
888 for (int i
= 0; i
< validPcdTypes
.size(); ++i
) {
889 jComboBoxItemType
.addItem(validPcdTypes
.get(i
));
893 jComboBoxItemType
.addItem(originalType
);
900 * @param sa sa[0]: HelpText; sa[1]: itemType in Msa; sa[2]: isBinary;
902 private void getPcdInfo(String moduleKey
, String cName
, String tsGuid
, String
[] sa
, Vector
<String
> validPcdTypes
) {
903 String
[][] saa
= new String
[ffc
.getLibraryInstancesCount(moduleKey
)][5];
904 ffc
.getLibraryInstances(moduleKey
, saa
);
907 if (ffc
.getPcdBuildDataInfo(WorkspaceProfile
.getModuleId(moduleKey
), cName
, tsGuid
, sa
, validPcdTypes
)) {
910 for (int j
= 0; j
< saa
.length
; ++j
) {
911 if (ffc
.getPcdBuildDataInfo(WorkspaceProfile
.getModuleId(saa
[j
][1] + " " + saa
[j
][2] + " " + saa
[j
][3] + " " + saa
[j
][4]),
912 cName
, tsGuid
, sa
, validPcdTypes
)) {
918 JOptionPane
.showMessageDialog(this, "Get PCD details fail: " + e
.getMessage());
923 * This method initializes jPanelPcdSouth
925 * @return javax.swing.JPanel
927 private JPanel
getJPanelPcdSouth() {
928 if (jPanelPcdSouth
== null) {
929 jLabelPcdHelp
= new JLabel();
930 jLabelPcdHelp
.setText("PCD Description");
931 jPanelPcdSouth
= new JPanel();
932 jPanelPcdSouth
.setPreferredSize(new java
.awt
.Dimension(607,200));
933 jPanelPcdSouth
.add(jLabelPcdHelp
, null);
934 jPanelPcdSouth
.add(getJScrollPanePcdHelp(), null);
935 jPanelPcdSouth
.add(getJPanelPcdFields(), null);
937 return jPanelPcdSouth
;
941 * This method initializes jScrollPanePcdHelp
943 * @return javax.swing.JScrollPane
945 private JScrollPane
getJScrollPanePcdHelp() {
946 if (jScrollPanePcdHelp
== null) {
947 jScrollPanePcdHelp
= new JScrollPane();
948 jScrollPanePcdHelp
.setPreferredSize(new java
.awt
.Dimension(500,100));
949 jScrollPanePcdHelp
.setViewportView(getJTextAreaPcdHelp());
951 return jScrollPanePcdHelp
;
955 * This method initializes jTextAreaPcdHelp
957 * @return javax.swing.JTextArea
959 private JTextArea
getJTextAreaPcdHelp() {
960 if (jTextAreaPcdHelp
== null) {
961 jTextAreaPcdHelp
= new JTextArea();
962 jTextAreaPcdHelp
.setEditable(false);
964 return jTextAreaPcdHelp
;
968 * This method initializes jPanelContentPaneSouth
970 * @return javax.swing.JPanel
972 private JPanel
getJPanelContentPaneSouth() {
973 if (jPanelContentPaneSouth
== null) {
974 FlowLayout flowLayout
= new FlowLayout();
975 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
976 jPanelContentPaneSouth
= new JPanel();
977 jPanelContentPaneSouth
.setLayout(flowLayout
);
978 jPanelContentPaneSouth
.add(getJButtonOk(), null);
979 jPanelContentPaneSouth
.add(getJButtonCancel(), null);
981 return jPanelContentPaneSouth
;
985 * This method initializes jSplitPane
987 * @return javax.swing.JSplitPane
989 private JSplitPane
getJSplitPane() {
990 if (jSplitPane
== null) {
991 jSplitPane
= new JSplitPane();
992 jSplitPane
.setDividerLocation(200);
993 jSplitPane
.setLeftComponent(getJPanelLibraryLeft());
994 jSplitPane
.setRightComponent(getJPanelLibraryRight());
995 jSplitPane
.setPreferredSize(new java
.awt
.Dimension(202,200));
1001 * This method initializes jPanelLibraryLeft
1003 * @return javax.swing.JPanel
1005 private JPanel
getJPanelLibraryLeft() {
1006 if (jPanelLibraryLeft
== null) {
1007 jLabelLibClass
= new JLabel();
1008 jLabelLibClass
.setText("Library Classes Uninstantiated");
1009 jPanelLibraryLeft
= new JPanel();
1010 jPanelLibraryLeft
.add(jLabelLibClass
, null);
1011 jPanelLibraryLeft
.add(getJScrollPaneLibClass(), null);
1013 return jPanelLibraryLeft
;
1017 * This method initializes jPanelLibraryRight
1019 * @return javax.swing.JPanel
1021 private JPanel
getJPanelLibraryRight() {
1022 if (jPanelLibraryRight
== null) {
1023 jLabelQualifiedInstance
= new JLabel();
1024 jLabelQualifiedInstance
.setText("Instances Available");
1025 jPanelLibraryRight
= new JPanel();
1026 jPanelLibraryRight
.add(jLabelQualifiedInstance
, null);
1027 jPanelLibraryRight
.add(getJScrollPaneQualifiedInstance(), null);
1029 return jPanelLibraryRight
;
1033 * This method initializes jScrollPaneSelectedInstances
1035 * @return javax.swing.JScrollPane
1037 private JScrollPane
getJScrollPaneSelectedInstances() {
1038 if (jScrollPaneSelectedInstances
== null) {
1039 jScrollPaneSelectedInstances
= new JScrollPane();
1040 jScrollPaneSelectedInstances
.setPreferredSize(new java
.awt
.Dimension(600,150));
1041 jScrollPaneSelectedInstances
.setViewportView(getJTableSelectedInstances());
1043 return jScrollPaneSelectedInstances
;
1047 * This method initializes jTableSelectedInstances
1049 * @return javax.swing.JTable
1051 private JTable
getJTableSelectedInstances() {
1052 if (jTableSelectedInstances
== null) {
1053 selectedInstancesTableModel
= new IDefaultTableModel();
1054 selectedInstancesTableModel
.addColumn("Name");
1055 selectedInstancesTableModel
.addColumn("ModuleGUID");
1056 selectedInstancesTableModel
.addColumn("ModuleVersion");
1057 selectedInstancesTableModel
.addColumn("PackageGUID");
1058 selectedInstancesTableModel
.addColumn("PackageVersion");
1059 jTableSelectedInstances
= new JTable(selectedInstancesTableModel
);
1060 jTableSelectedInstances
.setRowHeight(20);
1062 jTableSelectedInstances
.getColumnModel().getColumn(0).setMinWidth(250);
1064 jTableSelectedInstances
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_SUBSEQUENT_COLUMNS
);
1065 jTableSelectedInstances
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1068 return jTableSelectedInstances
;
1072 * This method initializes jScrollPaneLibClass
1074 * @return javax.swing.JScrollPane
1076 private JScrollPane
getJScrollPaneLibClass() {
1077 if (jScrollPaneLibClass
== null) {
1078 jScrollPaneLibClass
= new JScrollPane();
1079 jScrollPaneLibClass
.setPreferredSize(new java
.awt
.Dimension(200,170));
1080 jScrollPaneLibClass
.setViewportView(getJTableLibClass());
1082 return jScrollPaneLibClass
;
1086 * This method initializes jTableLibClass
1088 * @return javax.swing.JTable
1090 private JTable
getJTableLibClass() {
1091 if (jTableLibClass
== null) {
1092 libClassTableModel
= new IDefaultTableModel();
1093 libClassTableModel
.addColumn("LibraryClass");
1094 libClassTableModel
.addColumn("Arch");
1095 libClassTableModel
.addColumn("ModType");
1096 jTableLibClass
= new JTable(libClassTableModel
);
1097 jTableLibClass
.setRowHeight(20);
1098 jTableLibClass
.setShowGrid(false);
1099 jTableLibClass
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1101 TableColumn column
= jTableLibClass
.getColumnModel().getColumn(1);
1102 jTableLibClass
.getColumnModel().removeColumn(column
);
1103 column
= jTableLibClass
.getColumnModel().getColumn(1);
1104 jTableLibClass
.getColumnModel().removeColumn(column
);
1106 jTableLibClass
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
1107 public void valueChanged(ListSelectionEvent e
) {
1108 if (e
.getValueIsAdjusting()){
1111 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
1112 if (lsm
.isSelectionEmpty()) {
1116 int selectedRow2
= lsm
.getMinSelectionIndex();
1117 if (selectedRow2
< 0) {
1121 // display potential lib instances according to class selection
1123 libInstanceTableModel
.setRowCount(0);
1124 String cls
= libClassTableModel
.getValueAt(selectedRow2
, 0).toString();
1125 String arch
= libClassTableModel
.getValueAt(selectedRow2
, 1).toString();
1126 String modType
= libClassTableModel
.getValueAt(selectedRow2
, 2).toString();
1127 ArrayList
<String
> al
= classInstanceMap
.get(new LibraryClassDescriptor(cls
, arch
, modType
));
1131 ListIterator
<String
> li
= al
.listIterator();
1132 while(li
.hasNext()) {
1133 String instance
= li
.next();
1134 String
[] s
= {"", "", "", "", ""};
1135 if (WorkspaceProfile
.getModuleId(instance
) != null) {
1136 s
[0] = WorkspaceProfile
.getModuleId(instance
).getName();
1139 String
[] instancePart
= instance
.split(" ");
1140 for (int i
= 0; i
< instancePart
.length
; ++i
){
1141 s
[i
+1] = instancePart
[i
];
1143 libInstanceTableModel
.addRow(s
);
1150 return jTableLibClass
;
1154 * This method initializes jScrollPaneQualifiedInstance
1156 * @return javax.swing.JScrollPane
1158 private JScrollPane
getJScrollPaneQualifiedInstance() {
1159 if (jScrollPaneQualifiedInstance
== null) {
1160 jScrollPaneQualifiedInstance
= new JScrollPane();
1161 jScrollPaneQualifiedInstance
.setPreferredSize(new java
.awt
.Dimension(600,170));
1162 jScrollPaneQualifiedInstance
.setViewportView(getJTableLibInstances());
1164 return jScrollPaneQualifiedInstance
;
1168 * This method initializes jTableLibInstances
1170 * @return javax.swing.JTable
1172 private JTable
getJTableLibInstances() {
1173 if (jTableLibInstances
== null) {
1174 libInstanceTableModel
= new IDefaultTableModel();
1175 libInstanceTableModel
.addColumn("Name");
1176 libInstanceTableModel
.addColumn("ModuleGUID");
1177 libInstanceTableModel
.addColumn("ModuleVersion");
1178 libInstanceTableModel
.addColumn("PackageGUID");
1179 libInstanceTableModel
.addColumn("PackageVersion");
1180 jTableLibInstances
= new JTable(libInstanceTableModel
);
1181 jTableLibInstances
.setRowHeight(20);
1183 jTableLibInstances
.getColumnModel().getColumn(0).setMinWidth(250);
1185 jTableLibInstances
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_SUBSEQUENT_COLUMNS
);
1186 jTableLibInstances
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1189 return jTableLibInstances
;
1193 * This method initializes jPanelLibrarySouth
1195 * @return javax.swing.JPanel
1197 private JPanel
getJPanelLibrarySouth() {
1198 if (jPanelLibrarySouth
== null) {
1199 jPanelLibrarySouth
= new JPanel();
1201 return jPanelLibrarySouth
;
1205 * This method initializes jPanelLibraryCenter
1207 * @return javax.swing.JPanel
1209 private JPanel
getJPanelLibraryCenter() {
1210 if (jPanelLibraryCenter
== null) {
1211 jLabelInstanceHelp
= new JLabel();
1212 jLabelInstanceHelp
.setText("Instance Description");
1213 jLabelSelectedInstances
= new JLabel();
1214 jLabelSelectedInstances
.setText("Selected Instances");
1215 jPanelLibraryCenter
= new JPanel();
1216 jPanelLibraryCenter
.setLayout(new BorderLayout());
1218 jPanelLibraryCenter
.add(getJPanelLibraryCenterC(), java
.awt
.BorderLayout
.CENTER
);
1219 jPanelLibraryCenter
.add(getJPanelLibraryCenterN(), java
.awt
.BorderLayout
.NORTH
);
1222 return jPanelLibraryCenter
;
1226 * This method initializes jScrollPaneInstanceHelp
1228 * @return javax.swing.JScrollPane
1230 private JScrollPane
getJScrollPaneInstanceHelp() {
1231 if (jScrollPaneInstanceHelp
== null) {
1232 jScrollPaneInstanceHelp
= new JScrollPane();
1233 jScrollPaneInstanceHelp
.setPreferredSize(new java
.awt
.Dimension(400,50));
1234 jScrollPaneInstanceHelp
.setViewportView(getJTextAreaInstanceHelp());
1236 return jScrollPaneInstanceHelp
;
1240 * This method initializes jTextAreaInstanceHelp
1242 * @return javax.swing.JTextArea
1244 private JTextArea
getJTextAreaInstanceHelp() {
1245 if (jTextAreaInstanceHelp
== null) {
1246 jTextAreaInstanceHelp
= new JTextArea();
1247 jTextAreaInstanceHelp
.setEditable(false);
1249 return jTextAreaInstanceHelp
;
1253 * This method initializes jButtonAdd
1255 * @return javax.swing.JButton
1257 private JButton
getJButtonAdd() {
1258 if (jButtonAdd
== null) {
1259 jButtonAdd
= new JButton();
1260 jButtonAdd
.setPreferredSize(new java
.awt
.Dimension(80,20));
1261 jButtonAdd
.setText("Add");
1262 jButtonAdd
.addActionListener(new java
.awt
.event
.ActionListener() {
1263 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1264 int row
= jTableLibInstances
.getSelectedRow();
1269 String libInstanceKey
= libInstanceTableModel
.getValueAt(row
, 1) + " " +
1270 libInstanceTableModel
.getValueAt(row
, 2) + " " +
1271 libInstanceTableModel
.getValueAt(row
, 3) + " " +
1272 libInstanceTableModel
.getValueAt(row
, 4);
1273 ModuleIdentification libMi
= WorkspaceProfile
.getModuleId(libInstanceKey
);
1275 addLibInstance (libMi
);
1277 catch (Exception exception
) {
1278 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Adding Instance " + libMi
.getName() + " : \n"+ exception
.getMessage());
1281 docConsole
.setSaved(false);
1282 Object
[] s
= {libInstanceTableModel
.getValueAt(row
, 0), libInstanceTableModel
.getValueAt(row
, 1),
1283 libInstanceTableModel
.getValueAt(row
, 2), libInstanceTableModel
.getValueAt(row
, 3),
1284 libInstanceTableModel
.getValueAt(row
, 4)};
1285 selectedInstancesTableModel
.addRow(s
);
1287 Vector
<LibraryClassDescriptor
> vLcd
= addConsumedClassFromModule (libInstanceKey
);
1288 addProducedClassFromModule (libInstanceKey
);
1290 Vector
<String
> errorMsg
= new Vector
<String
>();
1291 Vector
<ModuleIdentification
> newInstances
= new Vector
<ModuleIdentification
>();
1292 Stack
<LibraryClassDescriptor
> lcdStack
= new Stack
<LibraryClassDescriptor
>();
1293 for (int i
= 0; i
< vLcd
.size(); ++i
) {
1294 LibraryClassDescriptor lcd
= vLcd
.get(i
);
1295 if (!lcdStack
.contains(lcd
)) {
1300 resolveLibraryInstances(lcdStack
, true, errorMsg
, newInstances
);
1302 catch (Exception exp
) {
1303 JOptionPane
.showMessageDialog(FpdModuleSA
.this, exp
.getMessage());
1306 showClassToResolved();
1308 if (errorMsg
.size() > 0) {
1310 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
1311 errors
+= " " + errorMsg
.get(i
) + "\n";
1313 JOptionPane
.showMessageDialog(FpdModuleSA
.this, errors
);
1322 * This method initializes jButton1
1324 * @return javax.swing.JButton
1326 private JButton
getJButtonDeleteInstance() {
1327 if (jButtonDeleteInstance
== null) {
1328 jButtonDeleteInstance
= new JButton();
1329 jButtonDeleteInstance
.setPreferredSize(new java
.awt
.Dimension(80,20));
1330 jButtonDeleteInstance
.setText("Delete");
1331 jButtonDeleteInstance
.addActionListener(new java
.awt
.event
.ActionListener() {
1332 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1333 int row
= jTableSelectedInstances
.getSelectedRow();
1337 docConsole
.setSaved(false);
1338 removeInstance(selectedInstancesTableModel
.getValueAt(row
, 1) + " " +
1339 selectedInstancesTableModel
.getValueAt(row
, 2) + " " +
1340 selectedInstancesTableModel
.getValueAt(row
, 3) + " " +
1341 selectedInstancesTableModel
.getValueAt(row
, 4));
1342 ffc
.removeLibraryInstance(moduleKey
, row
);
1343 selectedInstancesTableModel
.removeRow(row
);
1344 showClassToResolved();
1348 return jButtonDeleteInstance
;
1352 * This method initializes jButton2
1354 * @return javax.swing.JButton
1356 private JButton
getJButtonOk() {
1357 if (jButtonOk
== null) {
1358 jButtonOk
= new JButton();
1359 jButtonOk
.setPreferredSize(new java
.awt
.Dimension(80,20));
1360 jButtonOk
.setText("Close");
1361 jButtonOk
.addActionListener(this);
1367 * This method initializes jButton3
1369 * @return javax.swing.JButton
1371 private JButton
getJButtonCancel() {
1372 if (jButtonCancel
== null) {
1373 jButtonCancel
= new JButton();
1374 jButtonCancel
.setPreferredSize(new java
.awt
.Dimension(80,20));
1375 jButtonCancel
.setText("Cancel");
1376 jButtonCancel
.setVisible(false);
1378 return jButtonCancel
;
1380 public void actionPerformed(ActionEvent arg0
) {
1382 if (arg0
.getSource() == jButtonOk
) {
1383 if (jTableModuleSaOptions
.isEditing()) {
1384 jTableModuleSaOptions
.getCellEditor().stopCellEditing();
1386 this.setVisible(false);
1390 * This method initializes jPanelModuleSaOpts
1392 * @return javax.swing.JPanel
1394 private JPanel
getJPanelModuleSaOpts() {
1395 if (jPanelModuleSaOpts
== null) {
1396 FlowLayout flowLayout4
= new FlowLayout();
1397 flowLayout4
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1398 jLabelFfsFormatKey
= new JLabel();
1399 jLabelFfsFormatKey
.setText("FFS Format Key");
1400 jLabelFfsFormatKey
.setPreferredSize(new java
.awt
.Dimension(90,16));
1401 jLabelFfsFileGuid
= new JLabel();
1402 jLabelFfsFileGuid
.setText("FFS File GUID");
1403 jLabelFfsFileGuid
.setPreferredSize(new java
.awt
.Dimension(90,16));
1404 jLabelFfsFileGuid
.setVisible(false);
1405 jLabelFvBinding
= new JLabel();
1406 jLabelFvBinding
.setText("FV Binding");
1407 jLabelFvBinding
.setPreferredSize(new java
.awt
.Dimension(90,16));
1408 jPanelModuleSaOpts
= new JPanel();
1409 jPanelModuleSaOpts
.setLayout(flowLayout4
);
1410 jPanelModuleSaOpts
.add(jLabelFvBinding
, null);
1411 jPanelModuleSaOpts
.add(getJTextFieldFvBinding(), null);
1412 jPanelModuleSaOpts
.add(jLabelFfsFileGuid
, null);
1413 jPanelModuleSaOpts
.add(getJTextFieldFileGuid(), null);
1414 jPanelModuleSaOpts
.add(jLabelFfsFormatKey
, null);
1415 jPanelModuleSaOpts
.add(getJTextFieldFfsKey(), null);
1416 jPanelModuleSaOpts
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
1417 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
1418 initFvInfo(moduleKey
);
1422 return jPanelModuleSaOpts
;
1425 private Vector
<String
> getVectorFromString (String s
) {
1426 if (s
== null || s
.equals("null")) {
1429 String
[] sa1
= s
.split(" ");
1430 Vector
<String
> v
= new Vector
<String
>();
1431 for (int i
= 0; i
< sa1
.length
; ++i
) {
1438 * This method initializes jTextField
1440 * @return javax.swing.JTextField
1442 private JTextField
getJTextFieldFvBinding() {
1443 if (jTextFieldFvBinding
== null) {
1444 jTextFieldFvBinding
= new JTextField();
1445 jTextFieldFvBinding
.setPreferredSize(new java
.awt
.Dimension(400,20));
1446 jTextFieldFvBinding
.setEditable(true);
1447 jTextFieldFvBinding
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1448 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1449 String originalFvBinding
= ffc
.getFvBinding(moduleKey
);
1450 String newFvBinding
= jTextFieldFvBinding
.getText();
1451 if (newFvBinding
.equals(originalFvBinding
)) {
1454 if (newFvBinding
.length() == 0 && originalFvBinding
== null) {
1458 Vector
<String
> oldFvList
= getVectorFromString (originalFvBinding
);
1459 Vector
<String
> newFvList
= getVectorFromString (newFvBinding
);
1460 String moduleInfo
[] = moduleKey
.split(" ");
1461 ffc
.setFvBinding(moduleKey
, newFvBinding
);
1463 // remove module from Fvs that not in newFvList now.
1465 oldFvList
.removeAll(newFvList
);
1466 for (int j
= 0; j
< oldFvList
.size(); ++j
) {
1467 ffc
.removeModuleInBuildOptionsUserExtensions(oldFvList
.get(j
), "IMAGES", "1", moduleInfo
[0], moduleInfo
[1], moduleInfo
[2], moduleInfo
[3], moduleInfo
[4]);
1470 // add module to Fvs that were not in oldFvList.
1472 oldFvList
= getVectorFromString (originalFvBinding
);
1473 newFvList
.removeAll(oldFvList
);
1474 for (int i
= 0; i
< newFvList
.size(); ++i
) {
1475 ffc
.addModuleIntoBuildOptionsUserExtensions(newFvList
.get(i
), "IMAGES", "1", moduleInfo
[0], moduleInfo
[1], moduleInfo
[2], moduleInfo
[3], moduleInfo
[4]);
1477 docConsole
.setSaved(false);
1482 return jTextFieldFvBinding
;
1485 * This method initializes jTextField1
1487 * @return javax.swing.JTextField
1489 private JTextField
getJTextFieldFileGuid() {
1490 if (jTextFieldFileGuid
== null) {
1491 jTextFieldFileGuid
= new JTextField();
1492 jTextFieldFileGuid
.setPreferredSize(new java
.awt
.Dimension(300,20));
1493 jTextFieldFileGuid
.setVisible(false);
1494 jTextFieldFileGuid
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1495 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1496 String originalFileGuid
= ffc
.getFfsFileNameGuid(moduleKey
);
1497 String newFileGuid
= jTextFieldFileGuid
.getText();
1498 if (newFileGuid
.equals(originalFileGuid
)) {
1501 if (newFileGuid
.length() == 0 && originalFileGuid
== null) {
1504 if (newFileGuid
.length() > 0) {
1505 if (!DataValidation
.isGuid(newFileGuid
)) {
1506 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "FFS File Guid is NOT GUID Type.");
1511 docConsole
.setSaved(false);
1512 if (newFileGuid
.length() == 0) {
1515 ffc
.setFfsFileNameGuid(moduleKey
, newFileGuid
);
1520 return jTextFieldFileGuid
;
1523 * This method initializes jTextFieldFfsKey
1525 * @return javax.swing.JTextField
1527 private JTextField
getJTextFieldFfsKey() {
1528 if (jTextFieldFfsKey
== null) {
1529 jTextFieldFfsKey
= new JTextField();
1530 jTextFieldFfsKey
.setPreferredSize(new java
.awt
.Dimension(250,20));
1531 jTextFieldFfsKey
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1532 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1533 String originalFfsKey
= ffc
.getFfsFormatKey(moduleKey
);
1534 String newFfsKey
= jTextFieldFfsKey
.getText();
1535 if (newFfsKey
.equals(originalFfsKey
)) {
1538 if (newFfsKey
.length() == 0 && originalFfsKey
== null) {
1541 docConsole
.setSaved(false);
1542 ffc
.setFfsFormatKey(moduleKey
, newFfsKey
);
1547 return jTextFieldFfsKey
;
1550 * This method initializes jScrollPaneModuleSaOptions
1552 * @return javax.swing.JScrollPane
1554 private JScrollPane
getJScrollPaneModuleSaOptions() {
1555 if (jScrollPaneModuleSaOptions
== null) {
1556 jScrollPaneModuleSaOptions
= new JScrollPane();
1557 jScrollPaneModuleSaOptions
.setPreferredSize(new java
.awt
.Dimension(600,350));
1558 jScrollPaneModuleSaOptions
.setViewportView(getJTableModuleSaOptions());
1560 return jScrollPaneModuleSaOptions
;
1563 * This method initializes jTableModuleSaOptions
1565 * @return javax.swing.JTable
1567 private JTable
getJTableModuleSaOptions() {
1568 if (jTableModuleSaOptions
== null) {
1569 optionsTableModel
= new DefaultTableModel();
1570 optionsTableModel
.addColumn("BuildTargets");
1571 optionsTableModel
.addColumn("ToolChainFamily");
1572 optionsTableModel
.addColumn("TagName");
1573 optionsTableModel
.addColumn("ToolCode");
1574 optionsTableModel
.addColumn("SupportedArchs");
1575 optionsTableModel
.addColumn("Contents");
1576 jTableModuleSaOptions
= new JTable(optionsTableModel
);
1577 jTableModuleSaOptions
.setRowHeight(20);
1579 jTableModuleSaOptions
.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth
);
1580 jTableModuleSaOptions
.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth
);
1581 jTableModuleSaOptions
.getColumnModel().getColumn(2).setMinWidth(tagNameWidth
);
1582 jTableModuleSaOptions
.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth
);
1583 jTableModuleSaOptions
.getColumnModel().getColumn(4).setMinWidth(supportArchWidth
);
1584 jTableModuleSaOptions
.getColumnModel().getColumn(5).setMinWidth(argWidth
);
1585 // javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);
1586 // JComboBox cb = new JComboBox();
1587 // cb.addItem("MSFT");
1588 // cb.addItem("GCC");
1589 // cb.addItem("CYGWIN");
1590 // cb.addItem("INTEL");
1591 // cb.addItem("USER_DEFINED");
1592 // toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1594 Vector
<String
> vArch
= new Vector
<String
>();
1601 jTableModuleSaOptions
.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch
, FrameworkWizardUI
.getInstance()));
1603 jTableModuleSaOptions
.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI
.getInstance()));
1605 jTableModuleSaOptions
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1606 jTableModuleSaOptions
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_OFF
);
1607 jTableModuleSaOptions
.getModel().addTableModelListener(new TableModelListener() {
1608 public void tableChanged(TableModelEvent arg0
) {
1609 // TODO Auto-generated method stub
1610 int row
= arg0
.getFirstRow();
1611 TableModel m
= (TableModel
)arg0
.getSource();
1613 if (arg0
.getType() == TableModelEvent
.UPDATE
){
1614 //ToDo Data Validition check.
1615 String targets
= m
.getValueAt(row
, 0) + "";
1616 Vector
<Object
> targetName
= null;
1617 if (targets
.length() > 0) {
1618 targetName
= new Vector
<Object
>();
1619 String
[] sArray
= targets
.split(" ");
1620 for (int i
= 0; i
< sArray
.length
; ++i
) {
1621 targetName
.add(sArray
[i
]);
1625 String toolChain
= m
.getValueAt(row
, 1) + "";
1626 String tagName
= m
.getValueAt(row
, 2) + "";
1627 String toolCode
= m
.getValueAt(row
, 3) + "";
1628 String archs
= m
.getValueAt(row
, 4) + "";
1629 Vector
<Object
> supArch
= null;
1630 if (archs
.length() > 0) {
1631 supArch
= new Vector
<Object
>();
1632 String
[] sArray1
= archs
.split(" ");
1633 for (int i
= 0; i
< sArray1
.length
; ++i
) {
1634 supArch
.add(sArray1
[i
]);
1638 String contents
= m
.getValueAt(row
, 5) + "";
1639 docConsole
.setSaved(false);
1640 ffc
.updateModuleSAOptionsOpt(moduleKey
, row
, targetName
, toolChain
, tagName
, toolCode
, supArch
, contents
);
1645 return jTableModuleSaOptions
;
1648 * This method initializes jButtonNew
1650 * @return javax.swing.JButton
1652 private JButton
getJButtonNew() {
1653 if (jButtonNew
== null) {
1654 jButtonNew
= new JButton();
1655 jButtonNew
.setPreferredSize(new java
.awt
.Dimension(80,20));
1656 jButtonNew
.setText("New");
1657 jButtonNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1658 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1659 String
[] row
= {"", "", "", "", "", ""};
1660 optionsTableModel
.addRow(row
);
1661 Vector
<Object
> v
= null;
1662 Vector
<Object
> v1
= null;
1663 docConsole
.setSaved(false);
1664 ffc
.genModuleSAOptionsOpt(moduleKey
, v
, "", "", "", v1
, "");
1671 * This method initializes jButtonDelete
1673 * @return javax.swing.JButton
1675 private JButton
getJButtonDeleteOption() {
1676 if (jButtonDeleteOption
== null) {
1677 jButtonDeleteOption
= new JButton();
1678 jButtonDeleteOption
.setPreferredSize(new java
.awt
.Dimension(80,20));
1679 jButtonDeleteOption
.setText("Delete");
1680 jButtonDeleteOption
.addActionListener(new java
.awt
.event
.ActionListener() {
1681 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1682 if (jTableModuleSaOptions
.getSelectedRow() < 0) {
1685 docConsole
.setSaved(false);
1686 ffc
.removeModuleSAOptionsOpt(moduleKey
, jTableModuleSaOptions
.getSelectedRow());
1687 optionsTableModel
.removeRow(jTableModuleSaOptions
.getSelectedRow());
1691 return jButtonDeleteOption
;
1695 Start the window at the center of screen
1698 protected void centerWindow(int intWidth
, int intHeight
) {
1699 Dimension d
= Toolkit
.getDefaultToolkit().getScreenSize();
1700 this.setLocation((d
.width
- intWidth
) / 2, (d
.height
- intHeight
) / 2);
1704 Start the window at the center of screen
1707 protected void centerWindow() {
1708 centerWindow(this.getSize().width
, this.getSize().height
);
1711 * This method initializes jPanelPcdFields
1713 * @return javax.swing.JPanel
1715 private JPanel
getJPanelPcdFields() {
1716 if (jPanelPcdFields
== null) {
1717 GridLayout gridLayout
= new GridLayout();
1718 gridLayout
.setRows(3);
1719 gridLayout
.setColumns(2);
1720 jPanelPcdFields
= new JPanel();
1721 jPanelPcdFields
.setLayout(gridLayout
);
1722 jPanelPcdFields
.setPreferredSize(new java
.awt
.Dimension(600,90));
1723 jPanelPcdFields
.add(getJPanelPcdFieldsFirstRow(), null);
1724 jPanelPcdFields
.add(getJPanelPcdFieldsSecondRow(), null);
1725 jPanelPcdFields
.add(getJPanelPcdFieldsThirdRow(), null);
1727 return jPanelPcdFields
;
1730 * This method initializes jPanelPcdFieldsSecondRow
1732 * @return javax.swing.JPanel
1734 private JPanel
getJPanelPcdFieldsSecondRow() {
1735 if (jPanelPcdFieldsSecondRow
== null) {
1736 FlowLayout flowLayout2
= new FlowLayout();
1737 flowLayout2
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1738 jLabelMaxDatumSize
= new JLabel();
1739 jLabelMaxDatumSize
.setText("Max Datum Size");
1740 jPanelPcdFieldsSecondRow
= new JPanel();
1741 jPanelPcdFieldsSecondRow
.setLayout(flowLayout2
);
1742 jPanelPcdFieldsSecondRow
.add(jLabelMaxDatumSize
, null);
1743 jPanelPcdFieldsSecondRow
.add(getJTextFieldMaxDatumSize(), null);
1745 return jPanelPcdFieldsSecondRow
;
1748 * This method initializes jPanelPcdFieldsThirdRow
1750 * @return javax.swing.JPanel
1752 private JPanel
getJPanelPcdFieldsThirdRow() {
1753 if (jPanelPcdFieldsThirdRow
== null) {
1754 FlowLayout flowLayout3
= new FlowLayout();
1755 flowLayout3
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1756 jLabelPcdDefaultValue
= new JLabel();
1757 jLabelPcdDefaultValue
.setText("Default Value");
1758 jLabelPcdDefaultValue
.setPreferredSize(new java
.awt
.Dimension(91,16));
1759 jPanelPcdFieldsThirdRow
= new JPanel();
1760 jPanelPcdFieldsThirdRow
.setLayout(flowLayout3
);
1761 jPanelPcdFieldsThirdRow
.add(jLabelPcdDefaultValue
, null);
1762 jPanelPcdFieldsThirdRow
.add(getJTextFieldPcdDefault(), null);
1763 jPanelPcdFieldsThirdRow
.add(getJComboBoxFeatureFlagValue(), null);
1764 jPanelPcdFieldsThirdRow
.add(getJButtonUpdatePcd(), null);
1766 return jPanelPcdFieldsThirdRow
;
1769 * This method initializes jPanelPcdFieldsFirstRow
1771 * @return javax.swing.JPanel
1773 private JPanel
getJPanelPcdFieldsFirstRow() {
1774 if (jPanelPcdFieldsFirstRow
== null) {
1775 FlowLayout flowLayout1
= new FlowLayout();
1776 flowLayout1
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1777 jLabelItemType
= new JLabel();
1778 jLabelItemType
.setText("Item Type");
1779 jLabelItemType
.setPreferredSize(new java
.awt
.Dimension(91,16));
1780 jPanelPcdFieldsFirstRow
= new JPanel();
1781 jPanelPcdFieldsFirstRow
.setLayout(flowLayout1
);
1782 jPanelPcdFieldsFirstRow
.add(jLabelItemType
, null);
1783 jPanelPcdFieldsFirstRow
.add(getJComboBoxItemType(), null);
1785 return jPanelPcdFieldsFirstRow
;
1788 * This method initializes jComboBoxItemType
1790 * @return javax.swing.JComboBox
1792 private JComboBox
getJComboBoxItemType() {
1793 if (jComboBoxItemType
== null) {
1794 jComboBoxItemType
= new JComboBox();
1795 jComboBoxItemType
.setPreferredSize(new java
.awt
.Dimension(200,20));
1796 jComboBoxItemType
.addItemListener(new java
.awt
.event
.ItemListener() {
1797 public void itemStateChanged(java
.awt
.event
.ItemEvent e
) {
1799 int row
= jTablePcd
.getSelectedRow();
1804 if (jComboBoxItemType
.getSelectedItem() != null && jComboBoxItemType
.getSelectedItem().equals("FIXED_AT_BUILD")) {
1805 jTextFieldPcdDefault
.setEnabled(true);
1808 jTextFieldPcdDefault
.setEnabled(false);
1813 return jComboBoxItemType
;
1816 private void pcdDynamicToNonDynamic(String cName
, String tsGuid
) {
1817 String
[][] saa
= new String
[ffc
.getDynamicPcdBuildDataCount()][5];
1818 ffc
.getDynamicPcdBuildData(saa
);
1819 String maxSize
= "";
1821 for (int i
= 0; i
< saa
.length
; ++i
) {
1822 if (saa
[i
][0].equals(cName
) && saa
[i
][2].equals(tsGuid
)) {
1823 maxSize
= saa
[i
][3];
1824 value
= ffc
.getDynamicPcdBuildDataValue(i
);
1829 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1830 for (int i
= 0; i
< al
.size(); ++i
) {
1831 String mKey
= moduleInfo (al
.get(i
));
1833 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1834 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, maxSize
, value
);
1835 al
.set(i
, mKey
+ " " + itemType
);
1838 ffc
.removeDynamicPcdBuildData(cName
, tsGuid
);
1841 private void pcdNonDynamicToDynamic(String cName
, String tsGuid
) {
1842 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1843 for (int i
= 0; i
< al
.size(); ++i
) {
1844 String mKey
= moduleInfo (al
.get(i
));
1845 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1846 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, jTextFieldMaxDatumSize
.getText(), jTextFieldPcdDefault
.isVisible() ? jTextFieldPcdDefault
.getText() : jComboBoxFeatureFlagValue
.getSelectedItem()+"");
1847 al
.set(i
, mKey
+ " " + itemType
);
1850 ffc
.addDynamicPcdBuildData(cName
, model
.getValueAt(jTablePcd
.getSelectedRow(), 3), tsGuid
, "DYNAMIC", model
.getValueAt(jTablePcd
.getSelectedRow(), 5)+"", jTextFieldPcdDefault
.isVisible() ? jTextFieldPcdDefault
.getText() : jComboBoxFeatureFlagValue
.getSelectedItem()+"");
1853 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "PCD value format: " + e
.getMessage());
1857 private void changePcdTypeWithinSameCategory (String cName
, String tsGuid
) {
1858 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1859 for (int i
= 0; i
< al
.size(); ++i
) {
1860 String mKey
= moduleInfo (al
.get(i
));
1861 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1862 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, null, null);
1863 al
.set(i
, mKey
+ " " + itemType
);
1867 private String
moduleInfo (String pcdInfo
) {
1869 return pcdInfo
.substring(0, pcdInfo
.lastIndexOf(" "));
1873 * This method initializes jTextFieldMaxDatumSize
1875 * @return javax.swing.JTextField
1877 private JTextField
getJTextFieldMaxDatumSize() {
1878 if (jTextFieldMaxDatumSize
== null) {
1879 jTextFieldMaxDatumSize
= new JTextField();
1880 jTextFieldMaxDatumSize
.setPreferredSize(new java
.awt
.Dimension(200,20));
1882 return jTextFieldMaxDatumSize
;
1885 * This method initializes jTextField4
1887 * @return javax.swing.JTextField
1889 private JTextField
getJTextFieldPcdDefault() {
1890 if (jTextFieldPcdDefault
== null) {
1891 jTextFieldPcdDefault
= new JTextField();
1892 jTextFieldPcdDefault
.setPreferredSize(new java
.awt
.Dimension(200,20));
1894 return jTextFieldPcdDefault
;
1897 * This method initializes jButton6
1899 * @return javax.swing.JButton
1901 private JButton
getJButtonUpdatePcd() {
1902 if (jButtonUpdatePcd
== null) {
1903 jButtonUpdatePcd
= new JButton();
1904 jButtonUpdatePcd
.setPreferredSize(new java
.awt
.Dimension(150,20));
1905 jButtonUpdatePcd
.setText("Update PCD Data");
1906 jButtonUpdatePcd
.addActionListener(new java
.awt
.event
.ActionListener() {
1907 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1908 int row
= jTablePcd
.getSelectedRow();
1913 String cName
= model
.getValueAt(row
, 0)+"";
1914 String tsGuid
= model
.getValueAt(row
, 1)+"";
1915 String oldItemType
= model
.getValueAt(row
, 2)+"";
1916 String dataType
= model
.getValueAt(row
, 5)+"";
1917 String newItemType
= jComboBoxItemType
.getSelectedItem()+"";
1918 String newValue
= jTextFieldPcdDefault
.isVisible()? jTextFieldPcdDefault
.getText():jComboBoxFeatureFlagValue
.getSelectedItem()+"";
1919 if (newValue
.length() == 0){
1921 if (dataType
.equals("UINT8") || dataType
.equals("UINT16") || dataType
.equals("UINT32") || dataType
.equals("UINT64")) {
1924 if (dataType
.equals("BOOLEAN")){
1927 if (dataType
.equals("VOID*")) {
1932 String
[] pcdInfo
= {"", "", ""};
1933 Vector
<String
> validPcdTypes
= new Vector
<String
>();
1934 getPcdInfo (moduleKey
, cName
, tsGuid
, pcdInfo
, validPcdTypes
);
1935 if (pcdInfo
[1].equals("FIXED_AT_BUILD") && model
.getValueAt(row
, 5).equals("VOID*")) {
1937 jTextFieldMaxDatumSize
.setText(ffc
.setMaxSizeForPointer(newValue
)+"");
1939 catch (Exception exp
) {
1940 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "PCD Value MalFormed: " + exp
.getMessage());
1944 String newMaxDatumSize
= jTextFieldMaxDatumSize
.getText();
1946 if (!newItemType
.equals(oldItemType
)) {
1947 Vector
<ModuleIdentification
> moduleInfo
= new Vector
<ModuleIdentification
>();
1949 boolean changable
= itemTypeCouldBeChanged (cName
, tsGuid
, newItemType
, moduleInfo
);
1951 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Can NOT Change Pcd Type in: " + moduleInfo
.get(0).getName() + " contained in package " + moduleInfo
.get(0).getPackageId().getName());
1955 catch (Exception exp
) {
1956 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Can NOT Change Pcd Type in: " + moduleInfo
.get(0).getName() + " contained in package " + moduleInfo
.get(0).getPackageId().getName() + " " + exp
.getMessage());
1960 if ((oldItemType
.equals("DYNAMIC") || oldItemType
.equals("DYNAMIC_EX")) && !newItemType
.equals("DYNAMIC") && !newItemType
.equals("DYNAMIC_EX")) {
1961 pcdDynamicToNonDynamic(cName
, tsGuid
);
1963 if (!oldItemType
.equals("DYNAMIC") && !oldItemType
.equals("DYNAMIC_EX") && (newItemType
.equals("DYNAMIC") || newItemType
.equals("DYNAMIC_EX"))) {
1964 pcdNonDynamicToDynamic(cName
, tsGuid
);
1967 changePcdTypeWithinSameCategory (cName
, tsGuid
);
1969 model
.setValueAt(newItemType
, row
, 2);
1972 ffc
.updatePcdData(moduleKey
, cName
, tsGuid
, model
.getValueAt(row
, 2)+"", newMaxDatumSize
, newValue
);
1973 docConsole
.setSaved(false);
1974 model
.setValueAt(newValue
, row
, 6);
1975 model
.setValueAt(newMaxDatumSize
, row
, 4);
1980 return jButtonUpdatePcd
;
1983 private boolean itemTypeCouldBeChanged (String cName
, String tsGuid
, String newItemType
, Vector
<ModuleIdentification
> mi
) throws Exception
{
1984 ArrayList
<String
> pcdConsumers
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1985 for (int i
= 0; i
< pcdConsumers
.size(); ++i
) {
1986 String consumerInfo
= moduleInfo (pcdConsumers
.get(i
));
1987 mi
.removeAllElements();
1988 mi
.add(WorkspaceProfile
.getModuleId(consumerInfo
));
1989 String
[] sa
= {"", "", ""};
1990 Vector
<String
> validPcdTypes
= new Vector
<String
>();
1991 getPcdInfo (consumerInfo
, cName
, tsGuid
, sa
, validPcdTypes
);
1992 if (validPcdTypes
.size() == 0) {
1995 if (!sa
[1].equals("DYNAMIC")) {
1998 if (!validPcdTypes
.contains(newItemType
)) {
2006 * This method initializes jComboBoxFeatureFlagValue
2008 * @return javax.swing.JComboBox
2010 private JComboBox
getJComboBoxFeatureFlagValue() {
2011 if (jComboBoxFeatureFlagValue
== null) {
2012 jComboBoxFeatureFlagValue
= new JComboBox();
2013 jComboBoxFeatureFlagValue
.setPreferredSize(new java
.awt
.Dimension(100,20));
2014 jComboBoxFeatureFlagValue
.setVisible(false);
2015 jComboBoxFeatureFlagValue
.addItem("TRUE");
2016 jComboBoxFeatureFlagValue
.addItem("FALSE");
2018 return jComboBoxFeatureFlagValue
;
2021 * This method initializes jPanelCustomToolChain
2023 * @return javax.swing.JPanel
2025 private JPanel
getJPanelCustomToolChain() {
2026 if (jPanelCustomToolChain
== null) {
2027 jPanelCustomToolChain
= new JPanel();
2028 jPanelCustomToolChain
.setLayout(new BorderLayout());
2029 jPanelCustomToolChain
.add(getJPanelToolchainS(), java
.awt
.BorderLayout
.SOUTH
);
2030 jPanelCustomToolChain
.add(getJScrollPaneModuleSaOptions(), java
.awt
.BorderLayout
.CENTER
);
2031 jPanelCustomToolChain
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
2032 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
2033 initToolChainOptions(moduleKey
);
2037 return jPanelCustomToolChain
;
2040 * This method initializes jPanelToolchainS
2042 * @return javax.swing.JPanel
2044 private JPanel
getJPanelToolchainS() {
2045 if (jPanelToolchainS
== null) {
2046 jPanelToolchainS
= new JPanel();
2047 jPanelToolchainS
.add(getJButtonNew(), null);
2048 jPanelToolchainS
.add(getJButtonDeleteOption(), null);
2050 return jPanelToolchainS
;
2054 * This method initializes jPanelLibraryCenterN
2056 * @return javax.swing.JPanel
2058 private JPanel
getJPanelLibraryCenterN() {
2059 if (jPanelLibraryCenterN
== null) {
2060 FlowLayout flowLayout5
= new FlowLayout();
2061 flowLayout5
.setAlignment(java
.awt
.FlowLayout
.CENTER
);
2062 flowLayout5
.setHgap(10);
2063 jPanelLibraryCenterN
= new JPanel();
2064 jPanelLibraryCenterN
.setLayout(flowLayout5
);
2065 jPanelLibraryCenterN
.add(jLabelInstanceHelp
, null);
2066 jPanelLibraryCenterN
.add(getJScrollPaneInstanceHelp(), null);
2067 jPanelLibraryCenterN
.add(getJButtonAdd(), null);
2068 jPanelLibraryCenterN
.add(getJButtonDeleteInstance(), null);
2070 return jPanelLibraryCenterN
;
2073 * This method initializes jPanelLibraryCenterC
2075 * @return javax.swing.JPanel
2077 private JPanel
getJPanelLibraryCenterC() {
2078 if (jPanelLibraryCenterC
== null) {
2079 jPanelLibraryCenterC
= new JPanel();
2080 jPanelLibraryCenterC
.add(jLabelSelectedInstances
, null);
2081 jPanelLibraryCenterC
.add(getJScrollPaneSelectedInstances(), null);
2083 return jPanelLibraryCenterC
;
2087 } // @jve:decl-index=0:visual-constraint="10,10"
2089 class MultipleInstanceException
extends Exception
{
2094 private static final long serialVersionUID
= -9148463005930920297L;
2095 private String className
= null;
2096 private String libInstance1
= null;
2097 private String libInstance2
= null;
2099 MultipleInstanceException (String libClass
, String instance1
, String instance2
) {
2101 className
= libClass
;
2102 libInstance1
= instance1
;
2103 libInstance2
= instance2
;
2107 * @see java.lang.Throwable#getMessage()
2110 public String
getMessage() {
2111 // TODO Auto-generated method stub
2112 return " Library Class " + className
+ "is Produced by Two Instances: "
2113 + libInstance1
+ " and " + libInstance2
+ ". Platform Build will Fail.";
2118 class ImproperInstanceException
extends Exception
{
2123 private static final long serialVersionUID
= -5279700566993277033L;
2124 private String className
= null;
2125 private String libInstance
= null;
2126 private String instanceSupArch
= null;
2127 private String instanceSupModType
= null;
2129 ImproperInstanceException (String libClass
, String instance1
, String arch
, String type
) {
2131 className
= libClass
;
2132 libInstance
= instance1
;
2133 instanceSupArch
= arch
;
2134 instanceSupModType
= type
;
2138 * @see java.lang.Throwable#getMessage()
2141 public String
getMessage() {
2142 // TODO Auto-generated method stub
2143 return " Library Class " + className
+ " Produced by Library Instance: "
2144 + libInstance
+ "\nOnly Supports " + instanceSupArch
+ " and Module Type " + instanceSupModType
+ ".\n This instance should be removed.\n";
2149 class NoInstanceException
extends Exception
{
2154 private static final long serialVersionUID
= 1987122786598970598L;
2156 private String className
= null;
2158 NoInstanceException (String libClass
) {
2159 className
= libClass
;
2162 public String
getMessage() {
2163 return "No Applicable Instance for Library Class " + className
2164 + ", Platform Build will Fail.";