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 HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> classInstanceMap
= null;
101 // map of <{libName, supArch, supMod}, list of Module information>
103 private HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> classConsumed
= null;
104 private HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> classProduced
= null;
106 private JPanel jPanelModuleSaOpts
= null;
107 private JLabel jLabelFvBinding
= null;
108 private JTextField jTextFieldFvBinding
= null;
109 private JLabel jLabelFfsFileGuid
= null;
110 private JTextField jTextFieldFileGuid
= null;
111 private JLabel jLabelFfsFormatKey
= null;
112 private JTextField jTextFieldFfsKey
= null;
113 private JScrollPane jScrollPaneModuleSaOptions
= null;
114 private JTable jTableModuleSaOptions
= null;
115 private JButton jButtonNew
= null;
116 private JButton jButtonDeleteOption
= null;
117 private JPanel jPanelPcdFields
= null;
118 private JPanel jPanelPcdFieldsSecondRow
= null;
119 private JPanel jPanelPcdFieldsThirdRow
= null;
120 private JPanel jPanelPcdFieldsFirstRow
= null;
121 private JLabel jLabelItemType
= null;
122 private JComboBox jComboBoxItemType
= null;
123 private JLabel jLabelMaxDatumSize
= null;
124 private JTextField jTextFieldMaxDatumSize
= null;
125 private JLabel jLabelPcdDefaultValue
= null;
126 private JTextField jTextFieldPcdDefault
= null;
127 private JButton jButtonUpdatePcd
= null;
128 private JComboBox jComboBoxFeatureFlagValue
= null;
129 private OpeningPlatformType docConsole
= null;
130 private JPanel jPanelCustomToolChain
= null;
131 private JPanel jPanelToolchainS
= null;
132 private JPanel jPanelLibraryCenterN
= null;
133 private JPanel jPanelLibraryCenterC
= null; // @jve:decl-index=0:visual-constraint="20,224"
135 private final int buildTargetWidth
= 150;
136 private final int toolChainFamilyWidth
= 150;
137 private final int supportArchWidth
= 150;
138 private final int toolCmdCodeWidth
= 200;
139 private final int tagNameWidth
= 150;
140 private final int argWidth
= 400;
143 * This is the default constructor
145 public FpdModuleSA() {
146 super(FrameworkWizardUI
.getInstance());
149 public FpdModuleSA(FpdFileContents ffc
) {
154 public void setKey(String k
, int i
, OpeningPlatformType dc
){
156 this.docConsole
= dc
;
157 classInstanceMap
= null;
158 classProduced
= null;
159 classConsumed
= null;
160 int tabIndex
= jTabbedPane
.indexOfTab("FV Info");
161 jTabbedPane
.setSelectedIndex(tabIndex
);
162 initFvInfo(moduleKey
);
163 initPcdBuildDefinition(moduleKey
);
164 moduleId
= WorkspaceProfile
.getModuleId(moduleKey
);
165 if (moduleId
== null) {
168 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(String key
) {
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(key
);
192 String
[][] saa
= new String
[pcdCount
][7];
193 ffc
.getPcdData(key
, 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 (this.classConsumed
.get(lcd
) == null || this.classConsumed
.get(lcd
).size() == 0) {
242 if (isBoundedClass(lcd
, errorMsg
)) {
246 if (!lcdStack
.contains(lcd
)) {
252 resolveLibraryInstances(lcdStack
, true, errorMsg
, newInstances
);
253 } catch (Exception e
) {
254 String exceptionMsg
= e
.getCause() + " " + e
.getMessage();
255 if (!errorMsg
.contains(exceptionMsg
)) {
256 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), e
.getCause() + " " + e
.getMessage());
260 String newInstancesAddedMsg
= "Library instance automatically added to this module :\n";
261 for (int i
= 0; i
< newInstances
.size(); ++i
) {
262 ModuleIdentification libMi
= newInstances
.get(i
);
263 newInstancesAddedMsg
+= libMi
.getName();
264 newInstancesAddedMsg
+= " ";
266 if (newInstances
.size() > 0) {
267 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), newInstancesAddedMsg
);
270 showClassToResolved();
272 if (errorMsg
.size() > 0) {
274 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
275 errors
+= " " + errorMsg
.get(i
) + "\n";
277 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), errors
);
281 public void initFvInfo (String key
) {
283 // display module SA options
285 jTextFieldFvBinding
.setText("");
286 String fvBinding
= ffc
.getFvBinding(key
);
287 if (fvBinding
!= null) {
288 jTextFieldFvBinding
.setText(fvBinding
);
290 jTextFieldFileGuid
.setText("");
291 String fileGuid
= ffc
.getFfsFileNameGuid(key
);
292 if (fileGuid
!= null) {
293 jTextFieldFileGuid
.setText(fileGuid
);
295 jTextFieldFfsKey
.setText("");
296 String ffsKey
= ffc
.getFfsFormatKey(key
);
297 if (ffsKey
!= null) {
298 jTextFieldFfsKey
.setText(ffsKey
);
302 public void initToolChainOptions(String key
) {
304 optionsTableModel
.setRowCount(0);
305 String
[][] saa
= new String
[ffc
.getModuleSAOptionsCount(key
)][6];
306 ffc
.getModuleSAOptions(key
, saa
);
307 for (int i
= 0; i
< saa
.length
; ++i
) {
308 optionsTableModel
.addRow(saa
[i
]);
312 private void filterClassConsumedByArch (Vector
<LibraryClassDescriptor
> v
) {
313 String
[] moduleInfo
= moduleKey
.split(" ");
314 Vector
<String
> vModuleArchs
= new Vector
<String
>();
316 // Skip guid, version information, get archs to check.
318 for (int i
= 4; i
< moduleInfo
.length
; ++i
) {
319 vModuleArchs
.add(moduleInfo
[i
]);
322 // if module will be built on all platforms, no filter needed for lib classes.
324 if (vModuleArchs
.size() == 0) {
328 Iterator
<LibraryClassDescriptor
> iter
= v
.iterator();
329 while (iter
.hasNext()) {
330 LibraryClassDescriptor libInfo
= iter
.next();
332 Vector
<String
> vSupArchs
= libInfo
.getVectorFromString(libInfo
.supArchs
);
334 if (vSupArchs
.size() == 0 || (vSupArchs
.size() == 1 && vSupArchs
.get(0).equalsIgnoreCase(""))) {
336 // update lib info to module archs only.
338 libInfo
.supArchs
= "";
339 for (int i
= 0; i
< vModuleArchs
.size(); ++i
) {
340 libInfo
.supArchs
+= vModuleArchs
.get(i
);
341 libInfo
.supArchs
+= " ";
343 libInfo
.supArchs
.trim();
347 // only retain those lib class used by module archs.
349 vSupArchs
.retainAll(vModuleArchs
);
350 if (vSupArchs
.size() > 0) {
352 // update lib info to reflect which kind of arch need to select instance.
354 libInfo
.supArchs
= "";
355 for (int i
= 0; i
< vSupArchs
.size(); ++i
) {
356 libInfo
.supArchs
+= vSupArchs
.get(i
);
357 libInfo
.supArchs
+= " ";
359 libInfo
.supArchs
.trim();
363 // remove this lib definition if it supports no archs module will be built under.
369 private void addProducedClassFromModule (String key
) {
370 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
371 Vector
<LibraryClassDescriptor
> vClassProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
372 if (this.classProduced
== null) {
373 this.classProduced
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
375 for (int i
= 0; i
< vClassProduced
.size(); ++i
) {
376 ArrayList
<String
> producedBy
= this.classProduced
.get(vClassProduced
.get(i
));
377 if (producedBy
== null) {
378 producedBy
= new ArrayList
<String
>();
381 // class already produced by previous module (lib instance).
383 if (producedBy.size() == 1) {
384 String instanceKey = producedBy.get(0);
385 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
386 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
388 Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
389 while (lcdi.hasNext()) {
390 LibraryClassDescriptor lcd = lcdi.next();
391 if (vClassProduced.get(i).hasInterSectionWith(lcd)) {
392 ArrayList<String> alreadyProducedBy = this.classProduced.get(lcd);
393 String instanceKey = alreadyProducedBy.get(0);
394 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
395 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
402 this.classProduced
.put(vClassProduced
.get(i
), producedBy
);
407 private Vector
<LibraryClassDescriptor
> addConsumedClassFromModule (String key
) {
408 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
409 // PackageIdentification[] depPkgList = null;
412 // Get dependency pkg list into which we will search lib instances.
414 //depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
416 // Get the lib class consumed, produced by this module itself.
418 Vector
<LibraryClassDescriptor
> vClassConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED", mi
);
419 for (int i
= 0; i
< vClassConsumed
.size(); ++i
) {
420 vClassConsumed
.get(i
).supModTypes
= WorkspaceProfile
.getModuleType(moduleId
);
422 filterClassConsumedByArch(vClassConsumed
);
423 if (this.classConsumed
== null) {
424 this.classConsumed
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
427 for (int i
= 0; i
< vClassConsumed
.size(); ++i
) {
428 ArrayList
<String
> consumedBy
= this.classConsumed
.get(vClassConsumed
.get(i
));
429 if (consumedBy
== null) {
430 consumedBy
= new ArrayList
<String
>();
433 this.classConsumed
.put(vClassConsumed
.get(i
), consumedBy
);
436 return vClassConsumed
;
439 private void resolveLibraryInstances(Stack
<LibraryClassDescriptor
> lcdStack
, boolean autoSelectSingleInstance
, Vector
<String
> errorMsg
, Vector
<ModuleIdentification
> newInstances
) throws MultipleInstanceException
, NoInstanceException
{
441 if (classInstanceMap
== null) {
442 classInstanceMap
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
444 while (!lcdStack
.empty()) {
445 LibraryClassDescriptor cls
= lcdStack
.pop();
446 if (isBoundedClass(cls
, errorMsg
)) {
449 ArrayList
<String
> instances
= getInstancesForClass(cls
, null);
450 if (instances
.size() == 0) {
451 // throw new NoInstanceException (cls.className);
452 String exceptionMsg
= new NoInstanceException (cls
.className
).getMessage();
453 if (!errorMsg
.contains(exceptionMsg
)) {
454 errorMsg
.add(exceptionMsg
);
458 classInstanceMap
.put(cls
, instances
);
459 if (instances
.size() == 1 && autoSelectSingleInstance
) {
460 String instanceInfo
= instances
.get(0);
461 ModuleIdentification libMi
= WorkspaceProfile
.getModuleId(instanceInfo
);
463 Object
[] row
= {libMi
.getName(), libMi
.getGuid(), libMi
.getVersion(),
464 libMi
.getPackageId().getGuid(), libMi
.getPackageId().getVersion()};
465 if (!ffc
.instanceExistsInModuleSA(moduleKey
, row
[1]+"", row
[2]+"", row
[3]+"", row
[4]+"")) {
466 addLibInstance(libMi
);
467 newInstances
.add(libMi
);
468 docConsole
.setSaved(false);
469 selectedInstancesTableModel
.addRow(row
);
470 addProducedClassFromModule (instanceInfo
);
471 Vector
<LibraryClassDescriptor
> vLcd
= addConsumedClassFromModule(instanceInfo
);
472 for (int i
= 0; i
< vLcd
.size(); ++i
) {
473 LibraryClassDescriptor lcd
= vLcd
.get(i
);
474 if (!lcdStack
.contains(lcd
)) {
480 catch (Exception e
) {
481 if (!errorMsg
.contains(e
.getMessage())) {
482 errorMsg
.add(e
.getMessage());
490 /**Search classProduced map to see if this class has been produced by some instance (module).
494 private boolean isBoundedClass (LibraryClassDescriptor cls
, Vector
<String
> errorMsg
) {
495 // if (this.classProduced.containsKey(cls)) {
498 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
499 while (lcdi
.hasNext()) {
500 LibraryClassDescriptor lcd
= lcdi
.next();
501 if (cls
.className
.equals(lcd
.className
)) {
502 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)) {
506 ArrayList
<String
> producedBy
= this.classProduced
.get(lcd
);
507 String instancesName
= "";
508 for (int i
= 0; i
< producedBy
.size(); ++i
) {
509 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(producedBy
.get(i
));
510 instancesName
+= mi
.getName();
511 instancesName
+= " ";
513 String msg
= new ImproperInstanceException(lcd
.className
, instancesName
, lcd
.supArchs
, lcd
.supModTypes
).getMessage();
514 if (!errorMsg
.contains(msg
)) {
524 private ArrayList
<String
> getInstancesForClass(LibraryClassDescriptor cls
, PackageIdentification
[] depPkgList
){
525 ArrayList
<String
> al
= new ArrayList
<String
>();
527 // for (int i = 0; i < depPkgList.length; ++i) {
528 Iterator ismi
= GlobalData
.vModuleList
.iterator();
529 while(ismi
.hasNext()) {
530 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
531 // if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
534 Vector
<LibraryClassDescriptor
> clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
536 boolean isPotential
= false;
537 Iterator
<LibraryClassDescriptor
> lcdi
= clsProduced
.iterator();
538 while (lcdi
.hasNext()) {
539 LibraryClassDescriptor lcd
= lcdi
.next();
540 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)){
544 if (isPotential
&& hasBeenProduced(lcd
)) {
550 al
.add(mi
.getGuid() + " " + mi
.getVersion() + " " +
551 mi
.getPackageId().getGuid() + " " + mi
.getPackageId().getVersion());
559 private boolean hasBeenProduced (LibraryClassDescriptor cls
) {
560 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
561 while (lcdi
.hasNext()) {
562 LibraryClassDescriptor lcd
= lcdi
.next();
563 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)) {
570 private ArrayList
<String
> getConsumedBy (String className
) {
571 Iterator
<LibraryClassDescriptor
> lcdi
= this.classConsumed
.keySet().iterator();
572 while (lcdi
.hasNext()) {
573 LibraryClassDescriptor lcd
= lcdi
.next();
574 if ((lcd
.className
!= null) && lcd
.className
.equals(className
)) {
575 return this.classConsumed
.get(lcd
);
581 private ArrayList
<String
> getProducedBy (String className
) {
582 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
583 while (lcdi
.hasNext()) {
584 LibraryClassDescriptor lcd
= lcdi
.next();
585 if ((lcd
.className
!= null) && lcd
.className
.equals(className
)) {
586 return this.classProduced
.get(lcd
);
592 // Get class name list related with instanceKey from HashMap m<LibraryClass, ArrayList<instanceKey>>.
594 private ArrayList
<String
> getLibraryClassList (String instanceKey
, HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> m
) {
595 ArrayList
<String
> libraryClass
= new ArrayList
<String
>();
596 Iterator
<LibraryClassDescriptor
> lcdi
= m
.keySet().iterator();
597 while (lcdi
.hasNext()) {
598 LibraryClassDescriptor lcd
= lcdi
.next();
599 if ((m
.get(lcd
) != null) && m
.get(lcd
).contains(instanceKey
)) {
600 libraryClass
.add(lcd
.className
);
606 private void removeInstance(String key
) {
607 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
609 // remove pcd information of instance from current ModuleSA
610 // Note that Pcd data SHOULD be removed prior to library instance
611 // because Multi-Sourced PCD could not be removed, if we remove library instance first,
612 // it will impact the judgement of whether a PCD entry is Multi-Sourced.
614 ffc
.removePcdData(moduleKey
, mi
);
615 ffc
.removeLibraryInstance(moduleKey
, key
);
617 // remove class produced by this instance and add back these produced class to be bound.
619 Vector
<LibraryClassDescriptor
> clsProduced
= getClassProduced(mi
);
620 for (int i
= 0; i
< clsProduced
.size(); ++i
) {
622 classProduced
.remove(clsProduced
.get(i
));
625 // remove class consumed by this instance. we do not need to bound it now.
627 String
[] clsConsumed
= getClassConsumed(mi
);
628 for (int i
= 0; i
< clsConsumed
.length
; ++i
) {
629 ArrayList
<String
> al
= getConsumedBy (clsConsumed
[i
]);
635 if (al
.size() == 0) {
636 ArrayList
<String
> from
= getProducedBy (clsConsumed
[i
]);
640 boolean noUse
= true;
641 for (int j
= 0; j
< from
.size(); ++j
) {
642 ArrayList
<String
> libClasses
= getLibraryClassList(from
.get(j
), classProduced
);
643 for (int k
= 0; k
< libClasses
.size(); ++k
) {
644 if (getConsumedBy (libClasses
.get(k
)) != null && getConsumedBy (libClasses
.get(k
)).size() > 0) {
649 removeInstance(from
.get(j
));
659 private Vector
<LibraryClassDescriptor
> getClassProduced(ModuleIdentification mi
){
661 Vector
<LibraryClassDescriptor
> clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
663 // String[] sClassProduced = new String[clsProduced.size()];
664 // for (int i = 0; i < clsProduced.size(); ++i) {
665 // sClassProduced[i] = clsProduced.get(i).className;
667 // return sClassProduced;
670 private String
[] getClassConsumed(ModuleIdentification mi
){
672 Vector
<LibraryClassDescriptor
> clsConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED", mi
);
673 String
[] sClassConsumed
= new String
[clsConsumed
.size()];
674 for (int i
= 0; i
< clsConsumed
.size(); ++i
) {
675 sClassConsumed
[i
] = clsConsumed
.get(i
).className
;
677 return sClassConsumed
;
680 private void showClassToResolved(){
681 Vector
<String
> errorMsg
= new Vector
<String
>();
682 libClassTableModel
.setRowCount(0);
683 libInstanceTableModel
.setRowCount(0);
684 if (classConsumed
== null || classConsumed
.size() == 0) {
688 Iterator
<LibraryClassDescriptor
> li
= classConsumed
.keySet().iterator();
690 LibraryClassDescriptor lcd
= li
.next();
691 if (classConsumed
.get(lcd
) == null || classConsumed
.get(lcd
).size() == 0) {
695 if (!isBoundedClass(lcd
, errorMsg
)){
697 String
[] s
= { lcd
.className
, lcd
.supArchs
, lcd
.supModTypes
};
698 libClassTableModel
.addRow(s
);
702 if (errorMsg
.size() > 0) {
704 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
705 errors
+= " " + errorMsg
.get(i
) + "\n";
707 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), errors
);
711 private String
getModuleArch () {
713 String
[] moduleInfo
= moduleKey
.split(" ");
714 for (int i
= 4; i
< moduleInfo
.length
; ++i
) {
715 arch
+= moduleInfo
[i
];
720 private void addLibInstance (ModuleIdentification libMi
) throws Exception
{
723 // Add pcd information of selected instance to current moduleSA
725 ffc
.addFrameworkModulesPcdBuildDefs(libMi
, getModuleArch(), ffc
.getModuleSA(moduleKey
));
727 ffc
.genLibraryInstance(libMi
, moduleKey
);
730 * This method initializes this
734 private void initialize() {
735 this.setSize(877, 555);
736 this.setResizable(false);
739 this.setTitle("Module Settings");
740 this.setContentPane(getJContentPane());
744 * This method initializes jContentPane
746 * @return javax.swing.JPanel
748 private JPanel
getJContentPane() {
749 if (jContentPane
== null) {
750 jContentPane
= new JPanel();
751 jContentPane
.setLayout(new BorderLayout());
752 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
753 jContentPane
.add(getJPanelContentPaneSouth(), java
.awt
.BorderLayout
.SOUTH
);
759 * This method initializes jTabbedPane
761 * @return javax.swing.JTabbedPane
763 private JTabbedPane
getJTabbedPane() {
764 if (jTabbedPane
== null) {
765 jTabbedPane
= new JTabbedPane();
766 jTabbedPane
.addTab("PCD Build Definition", null, getJPanelPcd(), null);
767 jTabbedPane
.addTab("Libraries", null, getJPanelLibrary(), null);
768 jTabbedPane
.addTab("FV Info", null, getJPanelModuleSaOpts(), null);
769 jTabbedPane
.addTab("Custom Toolchain", null, getJPanelCustomToolChain(), null);
776 * This method initializes jPanelPcd
778 * @return javax.swing.JPanel
780 private JPanel
getJPanelPcd() {
781 if (jPanelPcd
== null) {
782 jLabelPcdData
= new JLabel();
783 jLabelPcdData
.setText(" PCD Data");
784 jPanelPcd
= new JPanel();
785 jPanelPcd
.setLayout(new BorderLayout());
786 jPanelPcd
.add(jLabelPcdData
, java
.awt
.BorderLayout
.NORTH
);
787 jPanelPcd
.add(getJScrollPaneTablePcd(), java
.awt
.BorderLayout
.CENTER
);
788 jPanelPcd
.add(getJPanelPcdSouth(), java
.awt
.BorderLayout
.SOUTH
);
789 jPanelPcd
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
790 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
791 initPcdBuildDefinition(moduleKey
);
800 * This method initializes jPanelLibrary
802 * @return javax.swing.JPanel
804 private JPanel
getJPanelLibrary() {
805 if (jPanelLibrary
== null) {
806 jPanelLibrary
= new JPanel();
807 jPanelLibrary
.setLayout(new BorderLayout());
808 jPanelLibrary
.add(getJSplitPane(), java
.awt
.BorderLayout
.NORTH
);
809 jPanelLibrary
.add(getJPanelLibrarySouth(), java
.awt
.BorderLayout
.SOUTH
);
810 jPanelLibrary
.add(getJPanelLibraryCenter(), java
.awt
.BorderLayout
.CENTER
);
811 jPanelLibrary
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
812 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
813 initLibraries(moduleKey
);
817 return jPanelLibrary
;
821 * This method initializes jScrollPaneTablePcd
823 * @return javax.swing.JScrollPane
825 private JScrollPane
getJScrollPaneTablePcd() {
826 if (jScrollPaneTablePcd
== null) {
827 jScrollPaneTablePcd
= new JScrollPane();
828 jScrollPaneTablePcd
.setViewportView(getJTablePcd());
830 return jScrollPaneTablePcd
;
834 * This method initializes jTable
836 * @return javax.swing.JTable
838 private JTable
getJTablePcd() {
839 if (jTablePcd
== null) {
840 model
= new IDefaultTableModel();
841 jTablePcd
= new JTable(model
);
842 jTablePcd
.setRowHeight(20);
843 jTablePcd
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_ALL_COLUMNS
);
844 model
.addColumn("CName");
845 model
.addColumn("TokenSpaceGUID");
846 model
.addColumn("ItemType");
847 model
.addColumn("Token");
848 model
.addColumn("MaxDatumSize");
849 model
.addColumn("DataType");
850 model
.addColumn("DefaultValue");
852 jTablePcd
.getColumnModel().getColumn(0).setMinWidth(250);
854 TableColumn tokenColumn
= jTablePcd
.getColumnModel().getColumn(3);
855 jTablePcd
.removeColumn(tokenColumn
);
857 jTablePcd
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
858 jTablePcd
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
859 public void valueChanged(ListSelectionEvent e
) {
861 if (e
.getValueIsAdjusting()){
864 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
865 if (lsm
.isSelectionEmpty()) {
869 int selectedRow
= lsm
.getMinSelectionIndex();
870 String cName
= model
.getValueAt(selectedRow
, 0)+"";
871 String tsGuid
= model
.getValueAt(selectedRow
, 1)+"";
872 String itemType
= model
.getValueAt(selectedRow
, 2)+"";
874 // array for pcd related information: helpText, itemType, moduleType.
876 String
[] pcdInfo
= {"", "", ""};
877 Vector
<String
> validPcdTypes
= new Vector
<String
>();
878 getPcdInfo(moduleKey
, cName
, tsGuid
, pcdInfo
, validPcdTypes
);
879 jTextAreaPcdHelp
.setText(pcdInfo
[0]);
880 initComboBox(pcdInfo
[1], pcdInfo
[2], validPcdTypes
);
881 jComboBoxItemType
.setSelectedItem(itemType
);
882 jTextFieldMaxDatumSize
.setEnabled(true);
883 jTextFieldMaxDatumSize
.setVisible(true);
884 jTextFieldMaxDatumSize
.setText(model
.getValueAt(selectedRow
, 4)+"");
885 jTextFieldPcdDefault
.setEnabled(true);
886 jTextFieldPcdDefault
.setText(model
.getValueAt(selectedRow
, 6)+"");
887 if ((model
.getValueAt(selectedRow
, 5) != null) && model
.getValueAt(selectedRow
, 5).equals("VOID*")) {
888 if (pcdInfo
[1].equals("FEATURE_FLAG")) {
889 jTextFieldMaxDatumSize
.setVisible(false);
891 else if (pcdInfo
[1].equals("FIXED_AT_BUILD")) {
893 jTextFieldMaxDatumSize
.setEnabled(false);
894 jTextFieldMaxDatumSize
.setText(ffc
.setMaxSizeForPointer(model
.getValueAt(selectedRow
, 6)+"")+"");
896 catch(Exception except
){
897 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Unacceptable PCD Value: " + except
.getMessage());
901 jTextFieldMaxDatumSize
.setText(model
.getValueAt(selectedRow
, 4)+"");
905 jTextFieldMaxDatumSize
.setEnabled(false);
908 if (!model
.getValueAt(selectedRow
, 2).equals("DYNAMIC") && !model
.getValueAt(selectedRow
, 2).equals("DYNAMIC_EX")) {
909 jTextFieldPcdDefault
.setText(model
.getValueAt(selectedRow
, 6)+"");
910 if (model
.getValueAt(selectedRow
, 2).equals("FEATURE_FLAG")){
911 jTextFieldPcdDefault
.setVisible(false);
912 jComboBoxFeatureFlagValue
.setVisible(true);
913 jComboBoxFeatureFlagValue
.setSelectedItem(model
.getValueAt(selectedRow
, 6)+"");
916 jTextFieldPcdDefault
.setVisible(true);
917 jTextFieldPcdDefault
.setEnabled(true);
918 jComboBoxFeatureFlagValue
.setVisible(false);
922 jTextFieldPcdDefault
.setEnabled(false);
934 private void initComboBox(String originalType
, String mType
, Vector
<String
> validPcdTypes
) {
935 jComboBoxItemType
.removeAllItems();
937 if (originalType
.equals("DYNAMIC")) {
938 for (int i
= 0; i
< validPcdTypes
.size(); ++i
) {
939 jComboBoxItemType
.addItem(validPcdTypes
.get(i
));
943 jComboBoxItemType
.addItem(originalType
);
950 * @param sa sa[0]: HelpText; sa[1]: itemType in Msa; sa[2]: isBinary;
952 private void getPcdInfo(String moduleKey
, String cName
, String tsGuid
, String
[] sa
, Vector
<String
> validPcdTypes
) {
953 String
[][] saa
= new String
[ffc
.getLibraryInstancesCount(moduleKey
)][5];
954 ffc
.getLibraryInstances(moduleKey
, saa
);
957 if (ffc
.getPcdBuildDataInfo(WorkspaceProfile
.getModuleId(moduleKey
), cName
, tsGuid
, sa
, validPcdTypes
)) {
960 for (int j
= 0; j
< saa
.length
; ++j
) {
961 if (ffc
.getPcdBuildDataInfo(WorkspaceProfile
.getModuleId(saa
[j
][1] + " " + saa
[j
][2] + " " + saa
[j
][3] + " " + saa
[j
][4]),
962 cName
, tsGuid
, sa
, validPcdTypes
)) {
968 JOptionPane
.showMessageDialog(this, "Get PCD details fail: " + e
.getMessage());
973 * This method initializes jPanelPcdSouth
975 * @return javax.swing.JPanel
977 private JPanel
getJPanelPcdSouth() {
978 if (jPanelPcdSouth
== null) {
979 jLabelPcdHelp
= new JLabel();
980 jLabelPcdHelp
.setText("PCD Description");
981 jPanelPcdSouth
= new JPanel();
982 jPanelPcdSouth
.setPreferredSize(new java
.awt
.Dimension(607,200));
983 jPanelPcdSouth
.add(jLabelPcdHelp
, null);
984 jPanelPcdSouth
.add(getJScrollPanePcdHelp(), null);
985 jPanelPcdSouth
.add(getJPanelPcdFields(), null);
987 return jPanelPcdSouth
;
991 * This method initializes jScrollPanePcdHelp
993 * @return javax.swing.JScrollPane
995 private JScrollPane
getJScrollPanePcdHelp() {
996 if (jScrollPanePcdHelp
== null) {
997 jScrollPanePcdHelp
= new JScrollPane();
998 jScrollPanePcdHelp
.setPreferredSize(new java
.awt
.Dimension(500,100));
999 jScrollPanePcdHelp
.setViewportView(getJTextAreaPcdHelp());
1001 return jScrollPanePcdHelp
;
1005 * This method initializes jTextAreaPcdHelp
1007 * @return javax.swing.JTextArea
1009 private JTextArea
getJTextAreaPcdHelp() {
1010 if (jTextAreaPcdHelp
== null) {
1011 jTextAreaPcdHelp
= new JTextArea();
1012 jTextAreaPcdHelp
.setEditable(false);
1014 return jTextAreaPcdHelp
;
1018 * This method initializes jPanelContentPaneSouth
1020 * @return javax.swing.JPanel
1022 private JPanel
getJPanelContentPaneSouth() {
1023 if (jPanelContentPaneSouth
== null) {
1024 FlowLayout flowLayout
= new FlowLayout();
1025 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
1026 jPanelContentPaneSouth
= new JPanel();
1027 jPanelContentPaneSouth
.setLayout(flowLayout
);
1028 jPanelContentPaneSouth
.add(getJButtonOk(), null);
1029 jPanelContentPaneSouth
.add(getJButtonCancel(), null);
1031 return jPanelContentPaneSouth
;
1035 * This method initializes jSplitPane
1037 * @return javax.swing.JSplitPane
1039 private JSplitPane
getJSplitPane() {
1040 if (jSplitPane
== null) {
1041 jSplitPane
= new JSplitPane();
1042 jSplitPane
.setDividerLocation(200);
1043 jSplitPane
.setLeftComponent(getJPanelLibraryLeft());
1044 jSplitPane
.setRightComponent(getJPanelLibraryRight());
1045 jSplitPane
.setPreferredSize(new java
.awt
.Dimension(202,200));
1051 * This method initializes jPanelLibraryLeft
1053 * @return javax.swing.JPanel
1055 private JPanel
getJPanelLibraryLeft() {
1056 if (jPanelLibraryLeft
== null) {
1057 jLabelLibClass
= new JLabel();
1058 jLabelLibClass
.setText("Library Classes Uninstantiated");
1059 jPanelLibraryLeft
= new JPanel();
1060 jPanelLibraryLeft
.add(jLabelLibClass
, null);
1061 jPanelLibraryLeft
.add(getJScrollPaneLibClass(), null);
1063 return jPanelLibraryLeft
;
1067 * This method initializes jPanelLibraryRight
1069 * @return javax.swing.JPanel
1071 private JPanel
getJPanelLibraryRight() {
1072 if (jPanelLibraryRight
== null) {
1073 jLabelQualifiedInstance
= new JLabel();
1074 jLabelQualifiedInstance
.setText("Instances Available");
1075 jPanelLibraryRight
= new JPanel();
1076 jPanelLibraryRight
.add(jLabelQualifiedInstance
, null);
1077 jPanelLibraryRight
.add(getJScrollPaneQualifiedInstance(), null);
1079 return jPanelLibraryRight
;
1083 * This method initializes jScrollPaneSelectedInstances
1085 * @return javax.swing.JScrollPane
1087 private JScrollPane
getJScrollPaneSelectedInstances() {
1088 if (jScrollPaneSelectedInstances
== null) {
1089 jScrollPaneSelectedInstances
= new JScrollPane();
1090 jScrollPaneSelectedInstances
.setPreferredSize(new java
.awt
.Dimension(600,150));
1091 jScrollPaneSelectedInstances
.setViewportView(getJTableSelectedInstances());
1093 return jScrollPaneSelectedInstances
;
1097 * This method initializes jTableSelectedInstances
1099 * @return javax.swing.JTable
1101 private JTable
getJTableSelectedInstances() {
1102 if (jTableSelectedInstances
== null) {
1103 selectedInstancesTableModel
= new IDefaultTableModel();
1104 selectedInstancesTableModel
.addColumn("Name");
1105 selectedInstancesTableModel
.addColumn("ModuleGUID");
1106 selectedInstancesTableModel
.addColumn("ModuleVersion");
1107 selectedInstancesTableModel
.addColumn("PackageGUID");
1108 selectedInstancesTableModel
.addColumn("PackageVersion");
1109 jTableSelectedInstances
= new JTable(selectedInstancesTableModel
);
1110 jTableSelectedInstances
.setRowHeight(20);
1112 jTableSelectedInstances
.getColumnModel().getColumn(0).setMinWidth(250);
1114 jTableSelectedInstances
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_SUBSEQUENT_COLUMNS
);
1115 jTableSelectedInstances
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1118 return jTableSelectedInstances
;
1122 * This method initializes jScrollPaneLibClass
1124 * @return javax.swing.JScrollPane
1126 private JScrollPane
getJScrollPaneLibClass() {
1127 if (jScrollPaneLibClass
== null) {
1128 jScrollPaneLibClass
= new JScrollPane();
1129 jScrollPaneLibClass
.setPreferredSize(new java
.awt
.Dimension(200,170));
1130 jScrollPaneLibClass
.setViewportView(getJTableLibClass());
1132 return jScrollPaneLibClass
;
1136 * This method initializes jTableLibClass
1138 * @return javax.swing.JTable
1140 private JTable
getJTableLibClass() {
1141 if (jTableLibClass
== null) {
1142 libClassTableModel
= new IDefaultTableModel();
1143 libClassTableModel
.addColumn("LibraryClass");
1144 libClassTableModel
.addColumn("Arch");
1145 libClassTableModel
.addColumn("ModType");
1146 jTableLibClass
= new JTable(libClassTableModel
);
1147 jTableLibClass
.setRowHeight(20);
1148 jTableLibClass
.setShowGrid(false);
1149 jTableLibClass
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1151 TableColumn column
= jTableLibClass
.getColumnModel().getColumn(1);
1152 jTableLibClass
.getColumnModel().removeColumn(column
);
1153 column
= jTableLibClass
.getColumnModel().getColumn(1);
1154 jTableLibClass
.getColumnModel().removeColumn(column
);
1156 jTableLibClass
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
1157 public void valueChanged(ListSelectionEvent e
) {
1158 if (e
.getValueIsAdjusting()){
1161 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
1162 if (lsm
.isSelectionEmpty()) {
1166 int selectedRow2
= lsm
.getMinSelectionIndex();
1167 if (selectedRow2
< 0) {
1171 // display potential lib instances according to class selection
1173 libInstanceTableModel
.setRowCount(0);
1174 String cls
= libClassTableModel
.getValueAt(selectedRow2
, 0).toString();
1175 String arch
= libClassTableModel
.getValueAt(selectedRow2
, 1).toString();
1176 String modType
= libClassTableModel
.getValueAt(selectedRow2
, 2).toString();
1177 LibraryClassDescriptor lcd
= new LibraryClassDescriptor(cls
, arch
, modType
);
1178 ArrayList
<String
> al
= classInstanceMap
.get(lcd
);
1180 al
= getInstancesForClass(lcd
, null);
1181 if (al
.size() != 0) {
1182 classInstanceMap
.put(lcd
, al
);
1186 ListIterator
<String
> li
= al
.listIterator();
1187 while(li
.hasNext()) {
1188 String instance
= li
.next();
1189 String
[] s
= {"", "", "", "", ""};
1190 if (WorkspaceProfile
.getModuleId(instance
) != null) {
1191 s
[0] = WorkspaceProfile
.getModuleId(instance
).getName();
1194 String
[] instancePart
= instance
.split(" ");
1195 for (int i
= 0; i
< instancePart
.length
; ++i
){
1196 s
[i
+1] = instancePart
[i
];
1198 libInstanceTableModel
.addRow(s
);
1205 return jTableLibClass
;
1209 * This method initializes jScrollPaneQualifiedInstance
1211 * @return javax.swing.JScrollPane
1213 private JScrollPane
getJScrollPaneQualifiedInstance() {
1214 if (jScrollPaneQualifiedInstance
== null) {
1215 jScrollPaneQualifiedInstance
= new JScrollPane();
1216 jScrollPaneQualifiedInstance
.setPreferredSize(new java
.awt
.Dimension(600,170));
1217 jScrollPaneQualifiedInstance
.setViewportView(getJTableLibInstances());
1219 return jScrollPaneQualifiedInstance
;
1223 * This method initializes jTableLibInstances
1225 * @return javax.swing.JTable
1227 private JTable
getJTableLibInstances() {
1228 if (jTableLibInstances
== null) {
1229 libInstanceTableModel
= new IDefaultTableModel();
1230 libInstanceTableModel
.addColumn("Name");
1231 libInstanceTableModel
.addColumn("ModuleGUID");
1232 libInstanceTableModel
.addColumn("ModuleVersion");
1233 libInstanceTableModel
.addColumn("PackageGUID");
1234 libInstanceTableModel
.addColumn("PackageVersion");
1235 jTableLibInstances
= new JTable(libInstanceTableModel
);
1236 jTableLibInstances
.setRowHeight(20);
1238 jTableLibInstances
.getColumnModel().getColumn(0).setMinWidth(250);
1240 jTableLibInstances
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_SUBSEQUENT_COLUMNS
);
1241 jTableLibInstances
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1244 return jTableLibInstances
;
1248 * This method initializes jPanelLibrarySouth
1250 * @return javax.swing.JPanel
1252 private JPanel
getJPanelLibrarySouth() {
1253 if (jPanelLibrarySouth
== null) {
1254 jPanelLibrarySouth
= new JPanel();
1256 return jPanelLibrarySouth
;
1260 * This method initializes jPanelLibraryCenter
1262 * @return javax.swing.JPanel
1264 private JPanel
getJPanelLibraryCenter() {
1265 if (jPanelLibraryCenter
== null) {
1266 jLabelInstanceHelp
= new JLabel();
1267 jLabelInstanceHelp
.setText("Instance Description");
1268 jLabelSelectedInstances
= new JLabel();
1269 jLabelSelectedInstances
.setText("Selected Instances");
1270 jPanelLibraryCenter
= new JPanel();
1271 jPanelLibraryCenter
.setLayout(new BorderLayout());
1273 jPanelLibraryCenter
.add(getJPanelLibraryCenterC(), java
.awt
.BorderLayout
.CENTER
);
1274 jPanelLibraryCenter
.add(getJPanelLibraryCenterN(), java
.awt
.BorderLayout
.NORTH
);
1277 return jPanelLibraryCenter
;
1281 * This method initializes jScrollPaneInstanceHelp
1283 * @return javax.swing.JScrollPane
1285 private JScrollPane
getJScrollPaneInstanceHelp() {
1286 if (jScrollPaneInstanceHelp
== null) {
1287 jScrollPaneInstanceHelp
= new JScrollPane();
1288 jScrollPaneInstanceHelp
.setPreferredSize(new java
.awt
.Dimension(400,50));
1289 jScrollPaneInstanceHelp
.setViewportView(getJTextAreaInstanceHelp());
1291 return jScrollPaneInstanceHelp
;
1295 * This method initializes jTextAreaInstanceHelp
1297 * @return javax.swing.JTextArea
1299 private JTextArea
getJTextAreaInstanceHelp() {
1300 if (jTextAreaInstanceHelp
== null) {
1301 jTextAreaInstanceHelp
= new JTextArea();
1302 jTextAreaInstanceHelp
.setEditable(false);
1304 return jTextAreaInstanceHelp
;
1308 * This method initializes jButtonAdd
1310 * @return javax.swing.JButton
1312 private JButton
getJButtonAdd() {
1313 if (jButtonAdd
== null) {
1314 jButtonAdd
= new JButton();
1315 jButtonAdd
.setPreferredSize(new java
.awt
.Dimension(80,20));
1316 jButtonAdd
.setText("Add");
1317 jButtonAdd
.addActionListener(new java
.awt
.event
.ActionListener() {
1318 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1319 int row
= jTableLibInstances
.getSelectedRow();
1324 String libInstanceKey
= libInstanceTableModel
.getValueAt(row
, 1) + " " +
1325 libInstanceTableModel
.getValueAt(row
, 2) + " " +
1326 libInstanceTableModel
.getValueAt(row
, 3) + " " +
1327 libInstanceTableModel
.getValueAt(row
, 4);
1328 ModuleIdentification libMi
= WorkspaceProfile
.getModuleId(libInstanceKey
);
1330 addLibInstance (libMi
);
1332 catch (Exception exception
) {
1333 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Adding Instance " + libMi
.getName() + " : \n"+ exception
.getMessage());
1336 docConsole
.setSaved(false);
1337 Object
[] s
= {libInstanceTableModel
.getValueAt(row
, 0), libInstanceTableModel
.getValueAt(row
, 1),
1338 libInstanceTableModel
.getValueAt(row
, 2), libInstanceTableModel
.getValueAt(row
, 3),
1339 libInstanceTableModel
.getValueAt(row
, 4)};
1340 selectedInstancesTableModel
.addRow(s
);
1342 Vector
<LibraryClassDescriptor
> vLcd
= addConsumedClassFromModule (libInstanceKey
);
1343 addProducedClassFromModule (libInstanceKey
);
1345 Vector
<String
> errorMsg
= new Vector
<String
>();
1346 Vector
<ModuleIdentification
> newInstances
= new Vector
<ModuleIdentification
>();
1347 Stack
<LibraryClassDescriptor
> lcdStack
= new Stack
<LibraryClassDescriptor
>();
1348 for (int i
= 0; i
< vLcd
.size(); ++i
) {
1349 LibraryClassDescriptor lcd
= vLcd
.get(i
);
1350 if (!lcdStack
.contains(lcd
)) {
1355 resolveLibraryInstances(lcdStack
, true, errorMsg
, newInstances
);
1357 catch (Exception exp
) {
1358 JOptionPane
.showMessageDialog(FpdModuleSA
.this, exp
.getMessage());
1361 showClassToResolved();
1363 if (errorMsg
.size() > 0) {
1365 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
1366 errors
+= " " + errorMsg
.get(i
) + "\n";
1368 JOptionPane
.showMessageDialog(FpdModuleSA
.this, errors
);
1377 * This method initializes jButton1
1379 * @return javax.swing.JButton
1381 private JButton
getJButtonDeleteInstance() {
1382 if (jButtonDeleteInstance
== null) {
1383 jButtonDeleteInstance
= new JButton();
1384 jButtonDeleteInstance
.setPreferredSize(new java
.awt
.Dimension(80,20));
1385 jButtonDeleteInstance
.setText("Delete");
1386 jButtonDeleteInstance
.addActionListener(new java
.awt
.event
.ActionListener() {
1387 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1388 int row
= jTableSelectedInstances
.getSelectedRow();
1392 docConsole
.setSaved(false);
1393 String instanceKey
= selectedInstancesTableModel
.getValueAt(row
, 1) + " "
1394 + selectedInstancesTableModel
.getValueAt(row
, 2) + " "
1395 + selectedInstancesTableModel
.getValueAt(row
, 3) + " "
1396 + selectedInstancesTableModel
.getValueAt(row
, 4);
1397 removeInstance(instanceKey
);
1399 selectedInstancesTableModel
.setRowCount(0);
1400 int instanceCount
= ffc
.getLibraryInstancesCount(moduleKey
);
1401 if (instanceCount
!= 0) {
1402 String
[][] saa
= new String
[instanceCount
][5];
1403 ffc
.getLibraryInstances(moduleKey
, saa
);
1404 for (int i
= 0; i
< saa
.length
; ++i
) {
1405 String libInstanceKey
= saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4];
1406 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(libInstanceKey
);
1409 // ToDo: verify this instance first.
1411 saa
[i
][0] = mi
.getName();
1412 saa
[i
][2] = mi
.getVersion();
1413 saa
[i
][4] = mi
.getPackageId().getVersion();
1414 selectedInstancesTableModel
.addRow(saa
[i
]);
1418 showClassToResolved();
1422 return jButtonDeleteInstance
;
1426 * This method initializes jButton2
1428 * @return javax.swing.JButton
1430 private JButton
getJButtonOk() {
1431 if (jButtonOk
== null) {
1432 jButtonOk
= new JButton();
1433 jButtonOk
.setPreferredSize(new java
.awt
.Dimension(80,20));
1434 jButtonOk
.setText("Close");
1435 jButtonOk
.addActionListener(this);
1441 * This method initializes jButton3
1443 * @return javax.swing.JButton
1445 private JButton
getJButtonCancel() {
1446 if (jButtonCancel
== null) {
1447 jButtonCancel
= new JButton();
1448 jButtonCancel
.setPreferredSize(new java
.awt
.Dimension(80,20));
1449 jButtonCancel
.setText("Cancel");
1450 jButtonCancel
.setVisible(false);
1452 return jButtonCancel
;
1454 public void actionPerformed(ActionEvent arg0
) {
1456 if (arg0
.getSource() == jButtonOk
) {
1457 if (jTableModuleSaOptions
.isEditing()) {
1458 jTableModuleSaOptions
.getCellEditor().stopCellEditing();
1460 this.setVisible(false);
1464 * This method initializes jPanelModuleSaOpts
1466 * @return javax.swing.JPanel
1468 private JPanel
getJPanelModuleSaOpts() {
1469 if (jPanelModuleSaOpts
== null) {
1470 FlowLayout flowLayout4
= new FlowLayout();
1471 flowLayout4
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1472 jLabelFfsFormatKey
= new JLabel();
1473 jLabelFfsFormatKey
.setText("FFS Format Key");
1474 jLabelFfsFormatKey
.setPreferredSize(new java
.awt
.Dimension(90,16));
1475 jLabelFfsFileGuid
= new JLabel();
1476 jLabelFfsFileGuid
.setText("FFS File GUID");
1477 jLabelFfsFileGuid
.setPreferredSize(new java
.awt
.Dimension(90,16));
1478 jLabelFfsFileGuid
.setVisible(false);
1479 jLabelFvBinding
= new JLabel();
1480 jLabelFvBinding
.setText("FV Binding");
1481 jLabelFvBinding
.setPreferredSize(new java
.awt
.Dimension(90,16));
1482 jPanelModuleSaOpts
= new JPanel();
1483 jPanelModuleSaOpts
.setLayout(flowLayout4
);
1484 jPanelModuleSaOpts
.add(jLabelFvBinding
, null);
1485 jPanelModuleSaOpts
.add(getJTextFieldFvBinding(), null);
1486 jPanelModuleSaOpts
.add(jLabelFfsFileGuid
, null);
1487 jPanelModuleSaOpts
.add(getJTextFieldFileGuid(), null);
1488 jPanelModuleSaOpts
.add(jLabelFfsFormatKey
, null);
1489 jPanelModuleSaOpts
.add(getJTextFieldFfsKey(), null);
1490 jPanelModuleSaOpts
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
1491 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
1492 initFvInfo(moduleKey
);
1496 return jPanelModuleSaOpts
;
1499 private Vector
<String
> getVectorFromString (String s
) {
1500 if (s
== null || s
.equals("null")) {
1503 String
[] sa1
= s
.split(" ");
1504 Vector
<String
> v
= new Vector
<String
>();
1505 for (int i
= 0; i
< sa1
.length
; ++i
) {
1512 * This method initializes jTextField
1514 * @return javax.swing.JTextField
1516 private JTextField
getJTextFieldFvBinding() {
1517 if (jTextFieldFvBinding
== null) {
1518 jTextFieldFvBinding
= new JTextField();
1519 jTextFieldFvBinding
.setPreferredSize(new java
.awt
.Dimension(400,20));
1520 jTextFieldFvBinding
.setEditable(true);
1521 jTextFieldFvBinding
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1522 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1523 String originalFvBinding
= ffc
.getFvBinding(moduleKey
);
1524 String newFvBinding
= jTextFieldFvBinding
.getText();
1525 if (newFvBinding
.equals(originalFvBinding
)) {
1528 if (newFvBinding
.length() == 0 && originalFvBinding
== null) {
1532 Vector
<String
> oldFvList
= getVectorFromString (originalFvBinding
);
1533 Vector
<String
> newFvList
= getVectorFromString (newFvBinding
);
1534 String moduleInfo
[] = moduleKey
.split(" ");
1535 ffc
.setFvBinding(moduleKey
, newFvBinding
);
1537 // remove module from Fvs that not in newFvList now.
1539 oldFvList
.removeAll(newFvList
);
1540 for (int j
= 0; j
< oldFvList
.size(); ++j
) {
1541 ffc
.removeModuleInBuildOptionsUserExtensions(oldFvList
.get(j
), "IMAGES", "1", moduleInfo
[0], moduleInfo
[1], moduleInfo
[2], moduleInfo
[3], moduleInfo
[4]);
1544 // add module to Fvs that were not in oldFvList.
1546 oldFvList
= getVectorFromString (originalFvBinding
);
1547 newFvList
.removeAll(oldFvList
);
1548 for (int i
= 0; i
< newFvList
.size(); ++i
) {
1549 ffc
.addModuleIntoBuildOptionsUserExtensions(newFvList
.get(i
), "IMAGES", "1", moduleInfo
[0], moduleInfo
[1], moduleInfo
[2], moduleInfo
[3], moduleInfo
[4]);
1551 docConsole
.setSaved(false);
1556 return jTextFieldFvBinding
;
1559 * This method initializes jTextField1
1561 * @return javax.swing.JTextField
1563 private JTextField
getJTextFieldFileGuid() {
1564 if (jTextFieldFileGuid
== null) {
1565 jTextFieldFileGuid
= new JTextField();
1566 jTextFieldFileGuid
.setPreferredSize(new java
.awt
.Dimension(300,20));
1567 jTextFieldFileGuid
.setVisible(false);
1568 jTextFieldFileGuid
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1569 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1570 String originalFileGuid
= ffc
.getFfsFileNameGuid(moduleKey
);
1571 String newFileGuid
= jTextFieldFileGuid
.getText();
1572 if (newFileGuid
.equals(originalFileGuid
)) {
1575 if (newFileGuid
.length() == 0 && originalFileGuid
== null) {
1578 if (newFileGuid
.length() > 0) {
1579 if (!DataValidation
.isGuid(newFileGuid
)) {
1580 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "FFS File Guid is NOT GUID Type.");
1585 docConsole
.setSaved(false);
1586 if (newFileGuid
.length() == 0) {
1589 ffc
.setFfsFileNameGuid(moduleKey
, newFileGuid
);
1594 return jTextFieldFileGuid
;
1597 * This method initializes jTextFieldFfsKey
1599 * @return javax.swing.JTextField
1601 private JTextField
getJTextFieldFfsKey() {
1602 if (jTextFieldFfsKey
== null) {
1603 jTextFieldFfsKey
= new JTextField();
1604 jTextFieldFfsKey
.setPreferredSize(new java
.awt
.Dimension(250,20));
1605 jTextFieldFfsKey
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1606 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1607 String originalFfsKey
= ffc
.getFfsFormatKey(moduleKey
);
1608 String newFfsKey
= jTextFieldFfsKey
.getText();
1609 if (newFfsKey
.equals(originalFfsKey
)) {
1612 if (newFfsKey
.length() == 0 && originalFfsKey
== null) {
1615 docConsole
.setSaved(false);
1616 ffc
.setFfsFormatKey(moduleKey
, newFfsKey
);
1621 return jTextFieldFfsKey
;
1624 * This method initializes jScrollPaneModuleSaOptions
1626 * @return javax.swing.JScrollPane
1628 private JScrollPane
getJScrollPaneModuleSaOptions() {
1629 if (jScrollPaneModuleSaOptions
== null) {
1630 jScrollPaneModuleSaOptions
= new JScrollPane();
1631 jScrollPaneModuleSaOptions
.setPreferredSize(new java
.awt
.Dimension(600,350));
1632 jScrollPaneModuleSaOptions
.setViewportView(getJTableModuleSaOptions());
1634 return jScrollPaneModuleSaOptions
;
1637 * This method initializes jTableModuleSaOptions
1639 * @return javax.swing.JTable
1641 private JTable
getJTableModuleSaOptions() {
1642 if (jTableModuleSaOptions
== null) {
1643 optionsTableModel
= new DefaultTableModel();
1644 optionsTableModel
.addColumn("BuildTargets");
1645 optionsTableModel
.addColumn("ToolChainFamily");
1646 optionsTableModel
.addColumn("TagName");
1647 optionsTableModel
.addColumn("ToolCode");
1648 optionsTableModel
.addColumn("SupportedArchs");
1649 optionsTableModel
.addColumn("Contents");
1650 jTableModuleSaOptions
= new JTable(optionsTableModel
);
1651 jTableModuleSaOptions
.setRowHeight(20);
1653 jTableModuleSaOptions
.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth
);
1654 jTableModuleSaOptions
.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth
);
1655 jTableModuleSaOptions
.getColumnModel().getColumn(2).setMinWidth(tagNameWidth
);
1656 jTableModuleSaOptions
.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth
);
1657 jTableModuleSaOptions
.getColumnModel().getColumn(4).setMinWidth(supportArchWidth
);
1658 jTableModuleSaOptions
.getColumnModel().getColumn(5).setMinWidth(argWidth
);
1659 // javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);
1660 // JComboBox cb = new JComboBox();
1661 // cb.addItem("MSFT");
1662 // cb.addItem("GCC");
1663 // cb.addItem("CYGWIN");
1664 // cb.addItem("INTEL");
1665 // cb.addItem("USER_DEFINED");
1666 // toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1668 Vector
<String
> vArch
= new Vector
<String
>();
1675 jTableModuleSaOptions
.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch
, FrameworkWizardUI
.getInstance()));
1677 jTableModuleSaOptions
.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI
.getInstance()));
1679 jTableModuleSaOptions
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1680 jTableModuleSaOptions
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_OFF
);
1681 jTableModuleSaOptions
.getModel().addTableModelListener(new TableModelListener() {
1682 public void tableChanged(TableModelEvent arg0
) {
1683 // TODO Auto-generated method stub
1684 int row
= arg0
.getFirstRow();
1685 TableModel m
= (TableModel
)arg0
.getSource();
1687 if (arg0
.getType() == TableModelEvent
.UPDATE
){
1688 //ToDo Data Validition check.
1689 String targets
= m
.getValueAt(row
, 0) + "";
1690 Vector
<Object
> targetName
= null;
1691 if (targets
.length() > 0) {
1692 targetName
= new Vector
<Object
>();
1693 String
[] sArray
= targets
.split(" ");
1694 for (int i
= 0; i
< sArray
.length
; ++i
) {
1695 targetName
.add(sArray
[i
]);
1699 String toolChain
= m
.getValueAt(row
, 1) + "";
1700 String tagName
= m
.getValueAt(row
, 2) + "";
1701 String toolCode
= m
.getValueAt(row
, 3) + "";
1702 String archs
= m
.getValueAt(row
, 4) + "";
1703 Vector
<Object
> supArch
= null;
1704 if (archs
.length() > 0) {
1705 supArch
= new Vector
<Object
>();
1706 String
[] sArray1
= archs
.split(" ");
1707 for (int i
= 0; i
< sArray1
.length
; ++i
) {
1708 supArch
.add(sArray1
[i
]);
1712 String contents
= m
.getValueAt(row
, 5) + "";
1713 docConsole
.setSaved(false);
1714 ffc
.updateModuleSAOptionsOpt(moduleKey
, row
, targetName
, toolChain
, tagName
, toolCode
, supArch
, contents
);
1719 return jTableModuleSaOptions
;
1722 * This method initializes jButtonNew
1724 * @return javax.swing.JButton
1726 private JButton
getJButtonNew() {
1727 if (jButtonNew
== null) {
1728 jButtonNew
= new JButton();
1729 jButtonNew
.setPreferredSize(new java
.awt
.Dimension(80,20));
1730 jButtonNew
.setText("New");
1731 jButtonNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1732 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1733 String
[] row
= {"", "", "", "", "", ""};
1734 optionsTableModel
.addRow(row
);
1735 Vector
<Object
> v
= null;
1736 Vector
<Object
> v1
= null;
1737 docConsole
.setSaved(false);
1738 ffc
.genModuleSAOptionsOpt(moduleKey
, v
, "", "", "", v1
, "");
1745 * This method initializes jButtonDelete
1747 * @return javax.swing.JButton
1749 private JButton
getJButtonDeleteOption() {
1750 if (jButtonDeleteOption
== null) {
1751 jButtonDeleteOption
= new JButton();
1752 jButtonDeleteOption
.setPreferredSize(new java
.awt
.Dimension(80,20));
1753 jButtonDeleteOption
.setText("Delete");
1754 jButtonDeleteOption
.addActionListener(new java
.awt
.event
.ActionListener() {
1755 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1756 if (jTableModuleSaOptions
.getSelectedRow() < 0) {
1759 docConsole
.setSaved(false);
1760 ffc
.removeModuleSAOptionsOpt(moduleKey
, jTableModuleSaOptions
.getSelectedRow());
1761 optionsTableModel
.removeRow(jTableModuleSaOptions
.getSelectedRow());
1765 return jButtonDeleteOption
;
1769 Start the window at the center of screen
1772 protected void centerWindow(int intWidth
, int intHeight
) {
1773 Dimension d
= Toolkit
.getDefaultToolkit().getScreenSize();
1774 this.setLocation((d
.width
- intWidth
) / 2, (d
.height
- intHeight
) / 2);
1778 Start the window at the center of screen
1781 protected void centerWindow() {
1782 centerWindow(this.getSize().width
, this.getSize().height
);
1785 * This method initializes jPanelPcdFields
1787 * @return javax.swing.JPanel
1789 private JPanel
getJPanelPcdFields() {
1790 if (jPanelPcdFields
== null) {
1791 GridLayout gridLayout
= new GridLayout();
1792 gridLayout
.setRows(3);
1793 gridLayout
.setColumns(2);
1794 jPanelPcdFields
= new JPanel();
1795 jPanelPcdFields
.setLayout(gridLayout
);
1796 jPanelPcdFields
.setPreferredSize(new java
.awt
.Dimension(600,90));
1797 jPanelPcdFields
.add(getJPanelPcdFieldsFirstRow(), null);
1798 jPanelPcdFields
.add(getJPanelPcdFieldsSecondRow(), null);
1799 jPanelPcdFields
.add(getJPanelPcdFieldsThirdRow(), null);
1801 return jPanelPcdFields
;
1804 * This method initializes jPanelPcdFieldsSecondRow
1806 * @return javax.swing.JPanel
1808 private JPanel
getJPanelPcdFieldsSecondRow() {
1809 if (jPanelPcdFieldsSecondRow
== null) {
1810 FlowLayout flowLayout2
= new FlowLayout();
1811 flowLayout2
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1812 jLabelMaxDatumSize
= new JLabel();
1813 jLabelMaxDatumSize
.setText("Max Datum Size");
1814 jPanelPcdFieldsSecondRow
= new JPanel();
1815 jPanelPcdFieldsSecondRow
.setLayout(flowLayout2
);
1816 jPanelPcdFieldsSecondRow
.add(jLabelMaxDatumSize
, null);
1817 jPanelPcdFieldsSecondRow
.add(getJTextFieldMaxDatumSize(), null);
1819 return jPanelPcdFieldsSecondRow
;
1822 * This method initializes jPanelPcdFieldsThirdRow
1824 * @return javax.swing.JPanel
1826 private JPanel
getJPanelPcdFieldsThirdRow() {
1827 if (jPanelPcdFieldsThirdRow
== null) {
1828 FlowLayout flowLayout3
= new FlowLayout();
1829 flowLayout3
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1830 jLabelPcdDefaultValue
= new JLabel();
1831 jLabelPcdDefaultValue
.setText("Default Value");
1832 jLabelPcdDefaultValue
.setPreferredSize(new java
.awt
.Dimension(91,16));
1833 jPanelPcdFieldsThirdRow
= new JPanel();
1834 jPanelPcdFieldsThirdRow
.setLayout(flowLayout3
);
1835 jPanelPcdFieldsThirdRow
.add(jLabelPcdDefaultValue
, null);
1836 jPanelPcdFieldsThirdRow
.add(getJTextFieldPcdDefault(), null);
1837 jPanelPcdFieldsThirdRow
.add(getJComboBoxFeatureFlagValue(), null);
1838 jPanelPcdFieldsThirdRow
.add(getJButtonUpdatePcd(), null);
1840 return jPanelPcdFieldsThirdRow
;
1843 * This method initializes jPanelPcdFieldsFirstRow
1845 * @return javax.swing.JPanel
1847 private JPanel
getJPanelPcdFieldsFirstRow() {
1848 if (jPanelPcdFieldsFirstRow
== null) {
1849 FlowLayout flowLayout1
= new FlowLayout();
1850 flowLayout1
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1851 jLabelItemType
= new JLabel();
1852 jLabelItemType
.setText("Item Type");
1853 jLabelItemType
.setPreferredSize(new java
.awt
.Dimension(91,16));
1854 jPanelPcdFieldsFirstRow
= new JPanel();
1855 jPanelPcdFieldsFirstRow
.setLayout(flowLayout1
);
1856 jPanelPcdFieldsFirstRow
.add(jLabelItemType
, null);
1857 jPanelPcdFieldsFirstRow
.add(getJComboBoxItemType(), null);
1859 return jPanelPcdFieldsFirstRow
;
1862 * This method initializes jComboBoxItemType
1864 * @return javax.swing.JComboBox
1866 private JComboBox
getJComboBoxItemType() {
1867 if (jComboBoxItemType
== null) {
1868 jComboBoxItemType
= new JComboBox();
1869 jComboBoxItemType
.setPreferredSize(new java
.awt
.Dimension(200,20));
1870 jComboBoxItemType
.addItemListener(new java
.awt
.event
.ItemListener() {
1871 public void itemStateChanged(java
.awt
.event
.ItemEvent e
) {
1873 int row
= jTablePcd
.getSelectedRow();
1878 if (jComboBoxItemType
.getSelectedItem() != null && jComboBoxItemType
.getSelectedItem().equals("FIXED_AT_BUILD")) {
1879 jTextFieldPcdDefault
.setEnabled(true);
1882 jTextFieldPcdDefault
.setEnabled(false);
1887 return jComboBoxItemType
;
1890 private void pcdDynamicToNonDynamic(String cName
, String tsGuid
) {
1891 String
[][] saa
= new String
[ffc
.getDynamicPcdBuildDataCount()][5];
1892 ffc
.getDynamicPcdBuildData(saa
);
1893 String maxSize
= "";
1895 for (int i
= 0; i
< saa
.length
; ++i
) {
1896 if (saa
[i
][0].equals(cName
) && saa
[i
][2].equals(tsGuid
)) {
1897 maxSize
= saa
[i
][3];
1898 value
= ffc
.getDynamicPcdBuildDataValue(i
);
1903 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1904 for (int i
= 0; i
< al
.size(); ++i
) {
1905 String mKey
= moduleInfo (al
.get(i
));
1907 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1908 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, maxSize
, value
);
1909 al
.set(i
, mKey
+ " " + itemType
);
1912 ffc
.removeDynamicPcdBuildData(cName
, tsGuid
);
1915 private void pcdNonDynamicToDynamic(String cName
, String tsGuid
) {
1916 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1917 for (int i
= 0; i
< al
.size(); ++i
) {
1918 String mKey
= moduleInfo (al
.get(i
));
1919 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1920 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, jTextFieldMaxDatumSize
.getText(), jTextFieldPcdDefault
.isVisible() ? jTextFieldPcdDefault
.getText() : jComboBoxFeatureFlagValue
.getSelectedItem()+"");
1921 al
.set(i
, mKey
+ " " + itemType
);
1924 ffc
.addDynamicPcdBuildData(cName
, model
.getValueAt(jTablePcd
.getSelectedRow(), 3), tsGuid
, "DYNAMIC", model
.getValueAt(jTablePcd
.getSelectedRow(), 5)+"", jTextFieldPcdDefault
.isVisible() ? jTextFieldPcdDefault
.getText() : jComboBoxFeatureFlagValue
.getSelectedItem()+"");
1927 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "PCD value format: " + e
.getMessage());
1931 private void changePcdTypeWithinSameCategory (String cName
, String tsGuid
) {
1932 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1933 for (int i
= 0; i
< al
.size(); ++i
) {
1934 String mKey
= moduleInfo (al
.get(i
));
1935 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1936 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, null, null);
1937 al
.set(i
, mKey
+ " " + itemType
);
1941 private String
moduleInfo (String pcdInfo
) {
1943 return pcdInfo
.substring(0, pcdInfo
.lastIndexOf(" "));
1947 * This method initializes jTextFieldMaxDatumSize
1949 * @return javax.swing.JTextField
1951 private JTextField
getJTextFieldMaxDatumSize() {
1952 if (jTextFieldMaxDatumSize
== null) {
1953 jTextFieldMaxDatumSize
= new JTextField();
1954 jTextFieldMaxDatumSize
.setPreferredSize(new java
.awt
.Dimension(200,20));
1956 return jTextFieldMaxDatumSize
;
1959 * This method initializes jTextField4
1961 * @return javax.swing.JTextField
1963 private JTextField
getJTextFieldPcdDefault() {
1964 if (jTextFieldPcdDefault
== null) {
1965 jTextFieldPcdDefault
= new JTextField();
1966 jTextFieldPcdDefault
.setPreferredSize(new java
.awt
.Dimension(200,20));
1968 return jTextFieldPcdDefault
;
1971 * This method initializes jButton6
1973 * @return javax.swing.JButton
1975 private JButton
getJButtonUpdatePcd() {
1976 if (jButtonUpdatePcd
== null) {
1977 jButtonUpdatePcd
= new JButton();
1978 jButtonUpdatePcd
.setPreferredSize(new java
.awt
.Dimension(150,20));
1979 jButtonUpdatePcd
.setText("Update PCD Data");
1980 jButtonUpdatePcd
.addActionListener(new java
.awt
.event
.ActionListener() {
1981 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1982 int row
= jTablePcd
.getSelectedRow();
1987 String cName
= model
.getValueAt(row
, 0)+"";
1988 String tsGuid
= model
.getValueAt(row
, 1)+"";
1989 String oldItemType
= model
.getValueAt(row
, 2)+"";
1990 String dataType
= model
.getValueAt(row
, 5)+"";
1991 String newItemType
= jComboBoxItemType
.getSelectedItem()+"";
1992 String newValue
= jTextFieldPcdDefault
.isVisible()? jTextFieldPcdDefault
.getText():jComboBoxFeatureFlagValue
.getSelectedItem()+"";
1993 if (newValue
.length() == 0){
1995 if (dataType
.equals("UINT8") || dataType
.equals("UINT16") || dataType
.equals("UINT32") || dataType
.equals("UINT64")) {
1998 if (dataType
.equals("BOOLEAN")){
2001 if (dataType
.equals("VOID*")) {
2006 String
[] pcdInfo
= {"", "", ""};
2007 Vector
<String
> validPcdTypes
= new Vector
<String
>();
2008 getPcdInfo (moduleKey
, cName
, tsGuid
, pcdInfo
, validPcdTypes
);
2009 if (pcdInfo
[1].equals("FIXED_AT_BUILD") && model
.getValueAt(row
, 5).equals("VOID*")) {
2011 jTextFieldMaxDatumSize
.setText(ffc
.setMaxSizeForPointer(newValue
)+"");
2013 catch (Exception exp
) {
2014 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "PCD Value MalFormed: " + exp
.getMessage());
2018 String newMaxDatumSize
= jTextFieldMaxDatumSize
.getText();
2020 if (!newItemType
.equals(oldItemType
)) {
2021 Vector
<ModuleIdentification
> moduleInfo
= new Vector
<ModuleIdentification
>();
2023 boolean changable
= itemTypeCouldBeChanged (cName
, tsGuid
, newItemType
, moduleInfo
);
2025 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Can NOT Change Pcd Type in: " + moduleInfo
.get(0).getName() + " contained in package " + moduleInfo
.get(0).getPackageId().getName());
2029 catch (Exception exp
) {
2030 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Can NOT Change Pcd Type in: " + moduleInfo
.get(0).getName() + " contained in package " + moduleInfo
.get(0).getPackageId().getName() + " " + exp
.getMessage());
2034 if ((oldItemType
.equals("DYNAMIC") || oldItemType
.equals("DYNAMIC_EX")) && !newItemType
.equals("DYNAMIC") && !newItemType
.equals("DYNAMIC_EX")) {
2035 pcdDynamicToNonDynamic(cName
, tsGuid
);
2037 if (!oldItemType
.equals("DYNAMIC") && !oldItemType
.equals("DYNAMIC_EX") && (newItemType
.equals("DYNAMIC") || newItemType
.equals("DYNAMIC_EX"))) {
2038 pcdNonDynamicToDynamic(cName
, tsGuid
);
2041 changePcdTypeWithinSameCategory (cName
, tsGuid
);
2043 model
.setValueAt(newItemType
, row
, 2);
2046 ffc
.updatePcdData(moduleKey
, cName
, tsGuid
, model
.getValueAt(row
, 2)+"", newMaxDatumSize
, newValue
);
2047 docConsole
.setSaved(false);
2048 model
.setValueAt(newValue
, row
, 6);
2049 model
.setValueAt(newMaxDatumSize
, row
, 4);
2054 return jButtonUpdatePcd
;
2057 private boolean itemTypeCouldBeChanged (String cName
, String tsGuid
, String newItemType
, Vector
<ModuleIdentification
> mi
) throws Exception
{
2058 ArrayList
<String
> pcdConsumers
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
2059 for (int i
= 0; i
< pcdConsumers
.size(); ++i
) {
2060 String consumerInfo
= moduleInfo (pcdConsumers
.get(i
));
2061 mi
.removeAllElements();
2062 mi
.add(WorkspaceProfile
.getModuleId(consumerInfo
));
2063 String
[] sa
= {"", "", ""};
2064 Vector
<String
> validPcdTypes
= new Vector
<String
>();
2065 getPcdInfo (consumerInfo
, cName
, tsGuid
, sa
, validPcdTypes
);
2066 if (validPcdTypes
.size() == 0) {
2069 if (!sa
[1].equals("DYNAMIC")) {
2072 if (!validPcdTypes
.contains(newItemType
)) {
2080 * This method initializes jComboBoxFeatureFlagValue
2082 * @return javax.swing.JComboBox
2084 private JComboBox
getJComboBoxFeatureFlagValue() {
2085 if (jComboBoxFeatureFlagValue
== null) {
2086 jComboBoxFeatureFlagValue
= new JComboBox();
2087 jComboBoxFeatureFlagValue
.setPreferredSize(new java
.awt
.Dimension(100,20));
2088 jComboBoxFeatureFlagValue
.setVisible(false);
2089 jComboBoxFeatureFlagValue
.addItem("TRUE");
2090 jComboBoxFeatureFlagValue
.addItem("FALSE");
2092 return jComboBoxFeatureFlagValue
;
2095 * This method initializes jPanelCustomToolChain
2097 * @return javax.swing.JPanel
2099 private JPanel
getJPanelCustomToolChain() {
2100 if (jPanelCustomToolChain
== null) {
2101 jPanelCustomToolChain
= new JPanel();
2102 jPanelCustomToolChain
.setLayout(new BorderLayout());
2103 jPanelCustomToolChain
.add(getJPanelToolchainS(), java
.awt
.BorderLayout
.SOUTH
);
2104 jPanelCustomToolChain
.add(getJScrollPaneModuleSaOptions(), java
.awt
.BorderLayout
.CENTER
);
2105 jPanelCustomToolChain
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
2106 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
2107 initToolChainOptions(moduleKey
);
2111 return jPanelCustomToolChain
;
2114 * This method initializes jPanelToolchainS
2116 * @return javax.swing.JPanel
2118 private JPanel
getJPanelToolchainS() {
2119 if (jPanelToolchainS
== null) {
2120 jPanelToolchainS
= new JPanel();
2121 jPanelToolchainS
.add(getJButtonNew(), null);
2122 jPanelToolchainS
.add(getJButtonDeleteOption(), null);
2124 return jPanelToolchainS
;
2128 * This method initializes jPanelLibraryCenterN
2130 * @return javax.swing.JPanel
2132 private JPanel
getJPanelLibraryCenterN() {
2133 if (jPanelLibraryCenterN
== null) {
2134 FlowLayout flowLayout5
= new FlowLayout();
2135 flowLayout5
.setAlignment(java
.awt
.FlowLayout
.CENTER
);
2136 flowLayout5
.setHgap(10);
2137 jPanelLibraryCenterN
= new JPanel();
2138 jPanelLibraryCenterN
.setLayout(flowLayout5
);
2139 jPanelLibraryCenterN
.add(jLabelInstanceHelp
, null);
2140 jPanelLibraryCenterN
.add(getJScrollPaneInstanceHelp(), null);
2141 jPanelLibraryCenterN
.add(getJButtonAdd(), null);
2142 jPanelLibraryCenterN
.add(getJButtonDeleteInstance(), null);
2144 return jPanelLibraryCenterN
;
2147 * This method initializes jPanelLibraryCenterC
2149 * @return javax.swing.JPanel
2151 private JPanel
getJPanelLibraryCenterC() {
2152 if (jPanelLibraryCenterC
== null) {
2153 jPanelLibraryCenterC
= new JPanel();
2154 jPanelLibraryCenterC
.add(jLabelSelectedInstances
, null);
2155 jPanelLibraryCenterC
.add(getJScrollPaneSelectedInstances(), null);
2157 return jPanelLibraryCenterC
;
2161 } // @jve:decl-index=0:visual-constraint="10,10"
2163 class MultipleInstanceException
extends Exception
{
2168 private static final long serialVersionUID
= -9148463005930920297L;
2169 private String className
= null;
2170 private String libInstance1
= null;
2171 private String libInstance2
= null;
2173 MultipleInstanceException (String libClass
, String instance1
, String instance2
) {
2175 className
= libClass
;
2176 libInstance1
= instance1
;
2177 libInstance2
= instance2
;
2181 * @see java.lang.Throwable#getMessage()
2184 public String
getMessage() {
2185 // TODO Auto-generated method stub
2186 return " Library Class " + className
+ "is Produced by Two Instances: "
2187 + libInstance1
+ " and " + libInstance2
+ ". Platform Build will Fail.";
2192 class ImproperInstanceException
extends Exception
{
2197 private static final long serialVersionUID
= -5279700566993277033L;
2198 private String className
= null;
2199 private String libInstance
= null;
2200 private String instanceSupArch
= null;
2201 private String instanceSupModType
= null;
2203 ImproperInstanceException (String libClass
, String instance1
, String arch
, String type
) {
2205 className
= libClass
;
2206 libInstance
= instance1
;
2207 instanceSupArch
= arch
;
2208 instanceSupModType
= type
;
2212 * @see java.lang.Throwable#getMessage()
2215 public String
getMessage() {
2216 // TODO Auto-generated method stub
2217 return " Library Class " + className
+ " Produced by Library Instance: "
2218 + libInstance
+ "\nOnly Supports " + instanceSupArch
+ " and Module Type " + instanceSupModType
+ ".\n This instance should be removed.\n";
2223 class NoInstanceException
extends Exception
{
2228 private static final long serialVersionUID
= 1987122786598970598L;
2230 private String className
= null;
2232 NoInstanceException (String libClass
) {
2233 className
= libClass
;
2236 public String
getMessage() {
2237 return "No Applicable Instance for Library Class " + className
2238 + ", Platform Build will Fail.";