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 initPcdBuildDefinition(moduleKey
);
163 moduleId
= WorkspaceProfile
.getModuleId(moduleKey
);
164 if (moduleId
== null) {
167 tabIndex
= jTabbedPane
.indexOfTab("Libraries");
168 if (moduleId
.isLibrary()) {
169 jTabbedPane
.setEnabledAt(tabIndex
, false);
172 jTabbedPane
.setEnabledAt(tabIndex
, true);
177 init will be called each time FpdModuleSA object is to be shown.
178 @param key Module information.
180 public void initPcdBuildDefinition(String key
) {
182 // display pcd for key.
184 model
.setRowCount(0);
185 jTextAreaPcdHelp
.setText("");
186 jComboBoxItemType
.setSelectedIndex(-1);
187 jTextFieldMaxDatumSize
.setText("");
188 jTextFieldPcdDefault
.setText("");
189 int pcdCount
= ffc
.getPcdDataCount(key
);
191 String
[][] saa
= new String
[pcdCount
][7];
192 ffc
.getPcdData(key
, saa
);
193 for (int j
= 0; j
< saa
.length
; ++j
) {
194 model
.addRow(saa
[j
]);
199 public void initLibraries(String key
) {
200 libClassTableModel
.setRowCount(0);
201 libInstanceTableModel
.setRowCount(0);
202 selectedInstancesTableModel
.setRowCount(0);
203 Vector
<String
> errorMsg
= new Vector
<String
>();
204 Vector
<ModuleIdentification
> newInstances
= new Vector
<ModuleIdentification
>();
206 addConsumedClassFromModule (key
);
207 addProducedClassFromModule (key
);
209 int instanceCount
= ffc
.getLibraryInstancesCount(key
);
210 if (instanceCount
!= 0) {
211 String
[][] saa
= new String
[instanceCount
][5];
212 ffc
.getLibraryInstances(key
, saa
);
213 for (int i
= 0; i
< saa
.length
; ++i
) {
214 String libInstanceKey
= saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4];
215 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(libInstanceKey
);
218 // ToDo: verify this instance first.
220 saa
[i
][0] = mi
.getName();
221 saa
[i
][2] = mi
.getVersion();
222 saa
[i
][4] = mi
.getPackageId().getVersion();
224 // re-evaluate lib instance usage when adding a already-selected lib instance.
226 addConsumedClassFromModule (libInstanceKey
);
227 addProducedClassFromModule (libInstanceKey
);
228 selectedInstancesTableModel
.addRow(saa
[i
]);
233 Set
<LibraryClassDescriptor
> sLcd
= this.classConsumed
.keySet();
234 Iterator
<LibraryClassDescriptor
> iter
= sLcd
.iterator();
235 Stack
<LibraryClassDescriptor
> lcdStack
= new Stack
<LibraryClassDescriptor
>();
236 while (iter
.hasNext()) {
237 LibraryClassDescriptor lcd
= iter
.next();
238 if (this.classConsumed
.get(lcd
) == null || this.classConsumed
.get(lcd
).size() == 0) {
241 if (isBoundedClass(lcd
, errorMsg
)) {
245 if (!lcdStack
.contains(lcd
)) {
251 resolveLibraryInstances(lcdStack
, true, errorMsg
, newInstances
);
252 } catch (Exception e
) {
253 String exceptionMsg
= e
.getCause() + " " + e
.getMessage();
254 if (!errorMsg
.contains(exceptionMsg
)) {
255 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), e
.getCause() + " " + e
.getMessage());
259 String newInstancesAddedMsg
= "Library instance automatically added to this module :\n";
260 for (int i
= 0; i
< newInstances
.size(); ++i
) {
261 ModuleIdentification libMi
= newInstances
.get(i
);
262 newInstancesAddedMsg
+= libMi
.getName();
263 newInstancesAddedMsg
+= " ";
265 if (newInstances
.size() > 0) {
266 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), newInstancesAddedMsg
);
269 showClassToResolved();
271 if (errorMsg
.size() > 0) {
273 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
274 errors
+= " " + errorMsg
.get(i
) + "\n";
276 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), errors
);
280 public void initFvInfo (String key
) {
282 // display module SA options
284 jTextFieldFvBinding
.setText("");
285 String fvBinding
= ffc
.getFvBinding(key
);
286 if (fvBinding
!= null) {
287 jTextFieldFvBinding
.setText(fvBinding
);
289 jTextFieldFileGuid
.setText("");
290 String fileGuid
= ffc
.getFfsFileNameGuid(key
);
291 if (fileGuid
!= null) {
292 jTextFieldFileGuid
.setText(fileGuid
);
294 jTextFieldFfsKey
.setText("");
295 String ffsKey
= ffc
.getFfsFormatKey(key
);
296 if (ffsKey
!= null) {
297 jTextFieldFfsKey
.setText(ffsKey
);
301 public void initToolChainOptions(String key
) {
303 optionsTableModel
.setRowCount(0);
304 String
[][] saa
= new String
[ffc
.getModuleSAOptionsCount(key
)][6];
305 ffc
.getModuleSAOptions(key
, saa
);
306 for (int i
= 0; i
< saa
.length
; ++i
) {
307 optionsTableModel
.addRow(saa
[i
]);
311 private void filterClassConsumedByArch (Vector
<LibraryClassDescriptor
> v
) {
312 String
[] moduleInfo
= moduleKey
.split(" ");
313 Vector
<String
> vModuleArchs
= new Vector
<String
>();
315 // Skip guid, version information, get archs to check.
317 for (int i
= 4; i
< moduleInfo
.length
; ++i
) {
318 vModuleArchs
.add(moduleInfo
[i
]);
321 // if module will be built on all platforms, no filter needed for lib classes.
323 if (vModuleArchs
.size() == 0) {
327 Iterator
<LibraryClassDescriptor
> iter
= v
.iterator();
328 while (iter
.hasNext()) {
329 LibraryClassDescriptor libInfo
= iter
.next();
331 Vector
<String
> vSupArchs
= libInfo
.getVectorFromString(libInfo
.supArchs
);
333 if (vSupArchs
.size() == 0 || (vSupArchs
.size() == 1 && vSupArchs
.get(0).equalsIgnoreCase(""))) {
335 // update lib info to module archs only.
337 libInfo
.supArchs
= "";
338 for (int i
= 0; i
< vModuleArchs
.size(); ++i
) {
339 libInfo
.supArchs
+= vModuleArchs
.get(i
);
340 libInfo
.supArchs
+= " ";
342 libInfo
.supArchs
.trim();
346 // only retain those lib class used by module archs.
348 vSupArchs
.retainAll(vModuleArchs
);
349 if (vSupArchs
.size() > 0) {
351 // update lib info to reflect which kind of arch need to select instance.
353 libInfo
.supArchs
= "";
354 for (int i
= 0; i
< vSupArchs
.size(); ++i
) {
355 libInfo
.supArchs
+= vSupArchs
.get(i
);
356 libInfo
.supArchs
+= " ";
358 libInfo
.supArchs
.trim();
362 // remove this lib definition if it supports no archs module will be built under.
368 private void addProducedClassFromModule (String key
) {
369 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
370 Vector
<LibraryClassDescriptor
> vClassProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
371 if (this.classProduced
== null) {
372 this.classProduced
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
374 for (int i
= 0; i
< vClassProduced
.size(); ++i
) {
375 ArrayList
<String
> producedBy
= this.classProduced
.get(vClassProduced
.get(i
));
376 if (producedBy
== null) {
377 producedBy
= new ArrayList
<String
>();
380 // class already produced by previous module (lib instance).
382 if (producedBy.size() == 1) {
383 String instanceKey = producedBy.get(0);
384 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
385 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
387 Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
388 while (lcdi.hasNext()) {
389 LibraryClassDescriptor lcd = lcdi.next();
390 if (vClassProduced.get(i).hasInterSectionWith(lcd)) {
391 ArrayList<String> alreadyProducedBy = this.classProduced.get(lcd);
392 String instanceKey = alreadyProducedBy.get(0);
393 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
394 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
401 this.classProduced
.put(vClassProduced
.get(i
), producedBy
);
406 private Vector
<LibraryClassDescriptor
> addConsumedClassFromModule (String key
) {
407 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
408 // PackageIdentification[] depPkgList = null;
411 // Get dependency pkg list into which we will search lib instances.
413 //depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
415 // Get the lib class consumed, produced by this module itself.
417 Vector
<LibraryClassDescriptor
> vClassConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED", mi
);
418 for (int i
= 0; i
< vClassConsumed
.size(); ++i
) {
419 vClassConsumed
.get(i
).supModTypes
= WorkspaceProfile
.getModuleType(moduleId
);
421 filterClassConsumedByArch(vClassConsumed
);
422 if (this.classConsumed
== null) {
423 this.classConsumed
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
426 for (int i
= 0; i
< vClassConsumed
.size(); ++i
) {
427 ArrayList
<String
> consumedBy
= this.classConsumed
.get(vClassConsumed
.get(i
));
428 if (consumedBy
== null) {
429 consumedBy
= new ArrayList
<String
>();
432 this.classConsumed
.put(vClassConsumed
.get(i
), consumedBy
);
435 return vClassConsumed
;
438 private void resolveLibraryInstances(Stack
<LibraryClassDescriptor
> lcdStack
, boolean autoSelectSingleInstance
, Vector
<String
> errorMsg
, Vector
<ModuleIdentification
> newInstances
) throws MultipleInstanceException
, NoInstanceException
{
440 if (classInstanceMap
== null) {
441 classInstanceMap
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
443 while (!lcdStack
.empty()) {
444 LibraryClassDescriptor cls
= lcdStack
.pop();
445 if (isBoundedClass(cls
, errorMsg
)) {
448 ArrayList
<String
> instances
= getInstancesForClass(cls
, null);
449 if (instances
.size() == 0) {
450 // throw new NoInstanceException (cls.className);
451 String exceptionMsg
= new NoInstanceException (cls
.className
).getMessage();
452 if (!errorMsg
.contains(exceptionMsg
)) {
453 errorMsg
.add(exceptionMsg
);
457 classInstanceMap
.put(cls
, instances
);
458 if (instances
.size() == 1 && autoSelectSingleInstance
) {
459 String instanceInfo
= instances
.get(0);
460 ModuleIdentification libMi
= WorkspaceProfile
.getModuleId(instanceInfo
);
462 Object
[] row
= {libMi
.getName(), libMi
.getGuid(), libMi
.getVersion(),
463 libMi
.getPackageId().getGuid(), libMi
.getPackageId().getVersion()};
464 if (!ffc
.instanceExistsInModuleSA(moduleKey
, row
[1]+"", row
[2]+"", row
[3]+"", row
[4]+"")) {
465 addLibInstance(libMi
);
466 newInstances
.add(libMi
);
467 docConsole
.setSaved(false);
468 selectedInstancesTableModel
.addRow(row
);
469 addProducedClassFromModule (instanceInfo
);
470 Vector
<LibraryClassDescriptor
> vLcd
= addConsumedClassFromModule(instanceInfo
);
471 for (int i
= 0; i
< vLcd
.size(); ++i
) {
472 LibraryClassDescriptor lcd
= vLcd
.get(i
);
473 if (!lcdStack
.contains(lcd
)) {
479 catch (Exception e
) {
480 if (!errorMsg
.contains(e
.getMessage())) {
481 errorMsg
.add(e
.getMessage());
489 /**Search classProduced map to see if this class has been produced by some instance (module).
493 private boolean isBoundedClass (LibraryClassDescriptor cls
, Vector
<String
> errorMsg
) {
494 // if (this.classProduced.containsKey(cls)) {
497 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
498 while (lcdi
.hasNext()) {
499 LibraryClassDescriptor lcd
= lcdi
.next();
500 if (cls
.className
.equals(lcd
.className
)) {
501 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)) {
505 ArrayList
<String
> producedBy
= this.classProduced
.get(lcd
);
506 String instancesName
= "";
507 for (int i
= 0; i
< producedBy
.size(); ++i
) {
508 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(producedBy
.get(i
));
509 instancesName
+= mi
.getName();
510 instancesName
+= " ";
512 String msg
= new ImproperInstanceException(lcd
.className
, instancesName
, lcd
.supArchs
, lcd
.supModTypes
).getMessage();
513 if (!errorMsg
.contains(msg
)) {
523 private ArrayList
<String
> getInstancesForClass(LibraryClassDescriptor cls
, PackageIdentification
[] depPkgList
){
524 ArrayList
<String
> al
= new ArrayList
<String
>();
526 // for (int i = 0; i < depPkgList.length; ++i) {
527 Iterator ismi
= GlobalData
.vModuleList
.iterator();
528 while(ismi
.hasNext()) {
529 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
530 // if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
533 Vector
<LibraryClassDescriptor
> clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
535 boolean isPotential
= false;
536 Iterator
<LibraryClassDescriptor
> lcdi
= clsProduced
.iterator();
537 while (lcdi
.hasNext()) {
538 LibraryClassDescriptor lcd
= lcdi
.next();
539 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)){
543 if (isPotential
&& hasBeenProduced(lcd
)) {
549 al
.add(mi
.getGuid() + " " + mi
.getVersion() + " " +
550 mi
.getPackageId().getGuid() + " " + mi
.getPackageId().getVersion());
558 private boolean hasBeenProduced (LibraryClassDescriptor cls
) {
559 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
560 while (lcdi
.hasNext()) {
561 LibraryClassDescriptor lcd
= lcdi
.next();
562 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)) {
569 private ArrayList
<String
> getConsumedBy (String className
) {
570 Iterator
<LibraryClassDescriptor
> lcdi
= this.classConsumed
.keySet().iterator();
571 while (lcdi
.hasNext()) {
572 LibraryClassDescriptor lcd
= lcdi
.next();
573 if ((lcd
.className
!= null) && lcd
.className
.equals(className
)) {
574 return this.classConsumed
.get(lcd
);
580 private ArrayList
<String
> getProducedBy (String className
) {
581 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
582 while (lcdi
.hasNext()) {
583 LibraryClassDescriptor lcd
= lcdi
.next();
584 if ((lcd
.className
!= null) && lcd
.className
.equals(className
)) {
585 return this.classProduced
.get(lcd
);
591 // Get class name list related with instanceKey from HashMap m<LibraryClass, ArrayList<instanceKey>>.
593 private ArrayList
<String
> getLibraryClassList (String instanceKey
, HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> m
) {
594 ArrayList
<String
> libraryClass
= new ArrayList
<String
>();
595 Iterator
<LibraryClassDescriptor
> lcdi
= m
.keySet().iterator();
596 while (lcdi
.hasNext()) {
597 LibraryClassDescriptor lcd
= lcdi
.next();
598 if ((m
.get(lcd
) != null) && m
.get(lcd
).contains(instanceKey
)) {
599 libraryClass
.add(lcd
.className
);
605 private void removeInstance(String key
) {
606 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
608 // remove pcd information of instance from current ModuleSA
609 // Note that Pcd data SHOULD be removed prior to library instance
610 // because Multi-Sourced PCD could not be removed, if we remove library instance first,
611 // it will impact the judgement of whether a PCD entry is Multi-Sourced.
613 ffc
.removePcdData(moduleKey
, mi
);
614 ffc
.removeLibraryInstance(moduleKey
, key
);
616 // remove class produced by this instance and add back these produced class to be bound.
618 Vector
<LibraryClassDescriptor
> clsProduced
= getClassProduced(mi
);
619 for (int i
= 0; i
< clsProduced
.size(); ++i
) {
621 classProduced
.remove(clsProduced
.get(i
));
624 // remove class consumed by this instance. we do not need to bound it now.
626 String
[] clsConsumed
= getClassConsumed(mi
);
627 for (int i
= 0; i
< clsConsumed
.length
; ++i
) {
628 ArrayList
<String
> al
= getConsumedBy (clsConsumed
[i
]);
634 if (al
.size() == 0) {
635 ArrayList
<String
> from
= getProducedBy (clsConsumed
[i
]);
639 boolean noUse
= true;
640 for (int j
= 0; j
< from
.size(); ++j
) {
641 ArrayList
<String
> libClasses
= getLibraryClassList(from
.get(j
), classProduced
);
642 for (int k
= 0; k
< libClasses
.size(); ++k
) {
643 if (getConsumedBy (libClasses
.get(k
)) != null && getConsumedBy (libClasses
.get(k
)).size() > 0) {
648 removeInstance(from
.get(j
));
658 private Vector
<LibraryClassDescriptor
> getClassProduced(ModuleIdentification mi
){
660 Vector
<LibraryClassDescriptor
> clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
662 // String[] sClassProduced = new String[clsProduced.size()];
663 // for (int i = 0; i < clsProduced.size(); ++i) {
664 // sClassProduced[i] = clsProduced.get(i).className;
666 // return sClassProduced;
669 private String
[] getClassConsumed(ModuleIdentification mi
){
671 Vector
<LibraryClassDescriptor
> clsConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED", mi
);
672 String
[] sClassConsumed
= new String
[clsConsumed
.size()];
673 for (int i
= 0; i
< clsConsumed
.size(); ++i
) {
674 sClassConsumed
[i
] = clsConsumed
.get(i
).className
;
676 return sClassConsumed
;
679 private void showClassToResolved(){
680 Vector
<String
> errorMsg
= new Vector
<String
>();
681 libClassTableModel
.setRowCount(0);
682 libInstanceTableModel
.setRowCount(0);
683 if (classConsumed
== null || classConsumed
.size() == 0) {
687 Iterator
<LibraryClassDescriptor
> li
= classConsumed
.keySet().iterator();
689 LibraryClassDescriptor lcd
= li
.next();
690 if (classConsumed
.get(lcd
) == null || classConsumed
.get(lcd
).size() == 0) {
694 if (!isBoundedClass(lcd
, errorMsg
)){
696 String
[] s
= { lcd
.className
, lcd
.supArchs
, lcd
.supModTypes
};
697 libClassTableModel
.addRow(s
);
701 if (errorMsg
.size() > 0) {
703 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
704 errors
+= " " + errorMsg
.get(i
) + "\n";
706 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), errors
);
710 private String
getModuleArch () {
712 String
[] moduleInfo
= moduleKey
.split(" ");
713 for (int i
= 4; i
< moduleInfo
.length
; ++i
) {
714 arch
+= moduleInfo
[i
];
719 private void addLibInstance (ModuleIdentification libMi
) throws Exception
{
722 // Add pcd information of selected instance to current moduleSA
724 ffc
.addFrameworkModulesPcdBuildDefs(libMi
, getModuleArch(), ffc
.getModuleSA(moduleKey
));
726 ffc
.genLibraryInstance(libMi
, moduleKey
);
729 * This method initializes this
733 private void initialize() {
734 this.setSize(877, 555);
735 this.setResizable(false);
738 this.setTitle("Module Settings");
739 this.setContentPane(getJContentPane());
743 * This method initializes jContentPane
745 * @return javax.swing.JPanel
747 private JPanel
getJContentPane() {
748 if (jContentPane
== null) {
749 jContentPane
= new JPanel();
750 jContentPane
.setLayout(new BorderLayout());
751 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
752 jContentPane
.add(getJPanelContentPaneSouth(), java
.awt
.BorderLayout
.SOUTH
);
758 * This method initializes jTabbedPane
760 * @return javax.swing.JTabbedPane
762 private JTabbedPane
getJTabbedPane() {
763 if (jTabbedPane
== null) {
764 jTabbedPane
= new JTabbedPane();
765 jTabbedPane
.addTab("PCD Build Definition", null, getJPanelPcd(), null);
766 jTabbedPane
.addTab("Libraries", null, getJPanelLibrary(), null);
767 jTabbedPane
.addTab("FV Info", null, getJPanelModuleSaOpts(), null);
768 jTabbedPane
.addTab("Custom Toolchain", null, getJPanelCustomToolChain(), null);
775 * This method initializes jPanelPcd
777 * @return javax.swing.JPanel
779 private JPanel
getJPanelPcd() {
780 if (jPanelPcd
== null) {
781 jLabelPcdData
= new JLabel();
782 jLabelPcdData
.setText(" PCD Data");
783 jPanelPcd
= new JPanel();
784 jPanelPcd
.setLayout(new BorderLayout());
785 jPanelPcd
.add(jLabelPcdData
, java
.awt
.BorderLayout
.NORTH
);
786 jPanelPcd
.add(getJScrollPaneTablePcd(), java
.awt
.BorderLayout
.CENTER
);
787 jPanelPcd
.add(getJPanelPcdSouth(), java
.awt
.BorderLayout
.SOUTH
);
788 jPanelPcd
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
789 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
790 initPcdBuildDefinition(moduleKey
);
799 * This method initializes jPanelLibrary
801 * @return javax.swing.JPanel
803 private JPanel
getJPanelLibrary() {
804 if (jPanelLibrary
== null) {
805 jPanelLibrary
= new JPanel();
806 jPanelLibrary
.setLayout(new BorderLayout());
807 jPanelLibrary
.add(getJSplitPane(), java
.awt
.BorderLayout
.NORTH
);
808 jPanelLibrary
.add(getJPanelLibrarySouth(), java
.awt
.BorderLayout
.SOUTH
);
809 jPanelLibrary
.add(getJPanelLibraryCenter(), java
.awt
.BorderLayout
.CENTER
);
810 jPanelLibrary
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
811 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
812 initLibraries(moduleKey
);
816 return jPanelLibrary
;
820 * This method initializes jScrollPaneTablePcd
822 * @return javax.swing.JScrollPane
824 private JScrollPane
getJScrollPaneTablePcd() {
825 if (jScrollPaneTablePcd
== null) {
826 jScrollPaneTablePcd
= new JScrollPane();
827 jScrollPaneTablePcd
.setViewportView(getJTablePcd());
829 return jScrollPaneTablePcd
;
833 * This method initializes jTable
835 * @return javax.swing.JTable
837 private JTable
getJTablePcd() {
838 if (jTablePcd
== null) {
839 model
= new IDefaultTableModel();
840 jTablePcd
= new JTable(model
);
841 jTablePcd
.setRowHeight(20);
842 jTablePcd
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_ALL_COLUMNS
);
843 model
.addColumn("CName");
844 model
.addColumn("TokenSpaceGUID");
845 model
.addColumn("ItemType");
846 model
.addColumn("Token");
847 model
.addColumn("MaxDatumSize");
848 model
.addColumn("DataType");
849 model
.addColumn("DefaultValue");
851 jTablePcd
.getColumnModel().getColumn(0).setMinWidth(250);
853 TableColumn tokenColumn
= jTablePcd
.getColumnModel().getColumn(3);
854 jTablePcd
.removeColumn(tokenColumn
);
856 jTablePcd
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
857 jTablePcd
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
858 public void valueChanged(ListSelectionEvent e
) {
860 if (e
.getValueIsAdjusting()){
863 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
864 if (lsm
.isSelectionEmpty()) {
868 int selectedRow
= lsm
.getMinSelectionIndex();
869 String cName
= model
.getValueAt(selectedRow
, 0)+"";
870 String tsGuid
= model
.getValueAt(selectedRow
, 1)+"";
871 String itemType
= model
.getValueAt(selectedRow
, 2)+"";
873 // array for pcd related information: helpText, itemType, moduleType.
875 String
[] pcdInfo
= {"", "", ""};
876 Vector
<String
> validPcdTypes
= new Vector
<String
>();
877 getPcdInfo(moduleKey
, cName
, tsGuid
, pcdInfo
, validPcdTypes
);
878 jTextAreaPcdHelp
.setText(pcdInfo
[0]);
879 initComboBox(pcdInfo
[1], pcdInfo
[2], validPcdTypes
);
880 jComboBoxItemType
.setSelectedItem(itemType
);
881 jTextFieldMaxDatumSize
.setEnabled(true);
882 jTextFieldMaxDatumSize
.setVisible(true);
883 jTextFieldMaxDatumSize
.setText(model
.getValueAt(selectedRow
, 4)+"");
884 jTextFieldPcdDefault
.setEnabled(true);
885 jTextFieldPcdDefault
.setText(model
.getValueAt(selectedRow
, 6)+"");
886 if ((model
.getValueAt(selectedRow
, 5) != null) && model
.getValueAt(selectedRow
, 5).equals("VOID*")) {
887 if (pcdInfo
[1].equals("FEATURE_FLAG")) {
888 jTextFieldMaxDatumSize
.setVisible(false);
890 else if (pcdInfo
[1].equals("FIXED_AT_BUILD")) {
892 jTextFieldMaxDatumSize
.setEnabled(false);
893 jTextFieldMaxDatumSize
.setText(ffc
.setMaxSizeForPointer(model
.getValueAt(selectedRow
, 6)+"")+"");
895 catch(Exception except
){
896 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Unacceptable PCD Value: " + except
.getMessage());
900 jTextFieldMaxDatumSize
.setText(model
.getValueAt(selectedRow
, 4)+"");
904 jTextFieldMaxDatumSize
.setEnabled(false);
907 if (!model
.getValueAt(selectedRow
, 2).equals("DYNAMIC") && !model
.getValueAt(selectedRow
, 2).equals("DYNAMIC_EX")) {
908 jTextFieldPcdDefault
.setText(model
.getValueAt(selectedRow
, 6)+"");
909 if (model
.getValueAt(selectedRow
, 2).equals("FEATURE_FLAG")){
910 jTextFieldPcdDefault
.setVisible(false);
911 jComboBoxFeatureFlagValue
.setVisible(true);
912 jComboBoxFeatureFlagValue
.setSelectedItem(model
.getValueAt(selectedRow
, 6)+"");
915 jTextFieldPcdDefault
.setVisible(true);
916 jTextFieldPcdDefault
.setEnabled(true);
917 jComboBoxFeatureFlagValue
.setVisible(false);
921 jTextFieldPcdDefault
.setEnabled(false);
933 private void initComboBox(String originalType
, String mType
, Vector
<String
> validPcdTypes
) {
934 jComboBoxItemType
.removeAllItems();
936 if (originalType
.equals("DYNAMIC")) {
937 for (int i
= 0; i
< validPcdTypes
.size(); ++i
) {
938 jComboBoxItemType
.addItem(validPcdTypes
.get(i
));
942 jComboBoxItemType
.addItem(originalType
);
949 * @param sa sa[0]: HelpText; sa[1]: itemType in Msa; sa[2]: isBinary;
951 private void getPcdInfo(String moduleKey
, String cName
, String tsGuid
, String
[] sa
, Vector
<String
> validPcdTypes
) {
952 String
[][] saa
= new String
[ffc
.getLibraryInstancesCount(moduleKey
)][5];
953 ffc
.getLibraryInstances(moduleKey
, saa
);
956 if (ffc
.getPcdBuildDataInfo(WorkspaceProfile
.getModuleId(moduleKey
), cName
, tsGuid
, sa
, validPcdTypes
)) {
959 for (int j
= 0; j
< saa
.length
; ++j
) {
960 if (ffc
.getPcdBuildDataInfo(WorkspaceProfile
.getModuleId(saa
[j
][1] + " " + saa
[j
][2] + " " + saa
[j
][3] + " " + saa
[j
][4]),
961 cName
, tsGuid
, sa
, validPcdTypes
)) {
967 JOptionPane
.showMessageDialog(this, "Get PCD details fail: " + e
.getMessage());
972 * This method initializes jPanelPcdSouth
974 * @return javax.swing.JPanel
976 private JPanel
getJPanelPcdSouth() {
977 if (jPanelPcdSouth
== null) {
978 jLabelPcdHelp
= new JLabel();
979 jLabelPcdHelp
.setText("PCD Description");
980 jPanelPcdSouth
= new JPanel();
981 jPanelPcdSouth
.setPreferredSize(new java
.awt
.Dimension(607,200));
982 jPanelPcdSouth
.add(jLabelPcdHelp
, null);
983 jPanelPcdSouth
.add(getJScrollPanePcdHelp(), null);
984 jPanelPcdSouth
.add(getJPanelPcdFields(), null);
986 return jPanelPcdSouth
;
990 * This method initializes jScrollPanePcdHelp
992 * @return javax.swing.JScrollPane
994 private JScrollPane
getJScrollPanePcdHelp() {
995 if (jScrollPanePcdHelp
== null) {
996 jScrollPanePcdHelp
= new JScrollPane();
997 jScrollPanePcdHelp
.setPreferredSize(new java
.awt
.Dimension(500,100));
998 jScrollPanePcdHelp
.setViewportView(getJTextAreaPcdHelp());
1000 return jScrollPanePcdHelp
;
1004 * This method initializes jTextAreaPcdHelp
1006 * @return javax.swing.JTextArea
1008 private JTextArea
getJTextAreaPcdHelp() {
1009 if (jTextAreaPcdHelp
== null) {
1010 jTextAreaPcdHelp
= new JTextArea();
1011 jTextAreaPcdHelp
.setEditable(false);
1013 return jTextAreaPcdHelp
;
1017 * This method initializes jPanelContentPaneSouth
1019 * @return javax.swing.JPanel
1021 private JPanel
getJPanelContentPaneSouth() {
1022 if (jPanelContentPaneSouth
== null) {
1023 FlowLayout flowLayout
= new FlowLayout();
1024 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
1025 jPanelContentPaneSouth
= new JPanel();
1026 jPanelContentPaneSouth
.setLayout(flowLayout
);
1027 jPanelContentPaneSouth
.add(getJButtonOk(), null);
1028 jPanelContentPaneSouth
.add(getJButtonCancel(), null);
1030 return jPanelContentPaneSouth
;
1034 * This method initializes jSplitPane
1036 * @return javax.swing.JSplitPane
1038 private JSplitPane
getJSplitPane() {
1039 if (jSplitPane
== null) {
1040 jSplitPane
= new JSplitPane();
1041 jSplitPane
.setDividerLocation(200);
1042 jSplitPane
.setLeftComponent(getJPanelLibraryLeft());
1043 jSplitPane
.setRightComponent(getJPanelLibraryRight());
1044 jSplitPane
.setPreferredSize(new java
.awt
.Dimension(202,200));
1050 * This method initializes jPanelLibraryLeft
1052 * @return javax.swing.JPanel
1054 private JPanel
getJPanelLibraryLeft() {
1055 if (jPanelLibraryLeft
== null) {
1056 jLabelLibClass
= new JLabel();
1057 jLabelLibClass
.setText("Library Classes Uninstantiated");
1058 jPanelLibraryLeft
= new JPanel();
1059 jPanelLibraryLeft
.add(jLabelLibClass
, null);
1060 jPanelLibraryLeft
.add(getJScrollPaneLibClass(), null);
1062 return jPanelLibraryLeft
;
1066 * This method initializes jPanelLibraryRight
1068 * @return javax.swing.JPanel
1070 private JPanel
getJPanelLibraryRight() {
1071 if (jPanelLibraryRight
== null) {
1072 jLabelQualifiedInstance
= new JLabel();
1073 jLabelQualifiedInstance
.setText("Instances Available");
1074 jPanelLibraryRight
= new JPanel();
1075 jPanelLibraryRight
.add(jLabelQualifiedInstance
, null);
1076 jPanelLibraryRight
.add(getJScrollPaneQualifiedInstance(), null);
1078 return jPanelLibraryRight
;
1082 * This method initializes jScrollPaneSelectedInstances
1084 * @return javax.swing.JScrollPane
1086 private JScrollPane
getJScrollPaneSelectedInstances() {
1087 if (jScrollPaneSelectedInstances
== null) {
1088 jScrollPaneSelectedInstances
= new JScrollPane();
1089 jScrollPaneSelectedInstances
.setPreferredSize(new java
.awt
.Dimension(600,150));
1090 jScrollPaneSelectedInstances
.setViewportView(getJTableSelectedInstances());
1092 return jScrollPaneSelectedInstances
;
1096 * This method initializes jTableSelectedInstances
1098 * @return javax.swing.JTable
1100 private JTable
getJTableSelectedInstances() {
1101 if (jTableSelectedInstances
== null) {
1102 selectedInstancesTableModel
= new IDefaultTableModel();
1103 selectedInstancesTableModel
.addColumn("Name");
1104 selectedInstancesTableModel
.addColumn("ModuleGUID");
1105 selectedInstancesTableModel
.addColumn("ModuleVersion");
1106 selectedInstancesTableModel
.addColumn("PackageGUID");
1107 selectedInstancesTableModel
.addColumn("PackageVersion");
1108 jTableSelectedInstances
= new JTable(selectedInstancesTableModel
);
1109 jTableSelectedInstances
.setRowHeight(20);
1111 jTableSelectedInstances
.getColumnModel().getColumn(0).setMinWidth(250);
1113 jTableSelectedInstances
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_SUBSEQUENT_COLUMNS
);
1114 jTableSelectedInstances
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1117 return jTableSelectedInstances
;
1121 * This method initializes jScrollPaneLibClass
1123 * @return javax.swing.JScrollPane
1125 private JScrollPane
getJScrollPaneLibClass() {
1126 if (jScrollPaneLibClass
== null) {
1127 jScrollPaneLibClass
= new JScrollPane();
1128 jScrollPaneLibClass
.setPreferredSize(new java
.awt
.Dimension(200,170));
1129 jScrollPaneLibClass
.setViewportView(getJTableLibClass());
1131 return jScrollPaneLibClass
;
1135 * This method initializes jTableLibClass
1137 * @return javax.swing.JTable
1139 private JTable
getJTableLibClass() {
1140 if (jTableLibClass
== null) {
1141 libClassTableModel
= new IDefaultTableModel();
1142 libClassTableModel
.addColumn("LibraryClass");
1143 libClassTableModel
.addColumn("Arch");
1144 libClassTableModel
.addColumn("ModType");
1145 jTableLibClass
= new JTable(libClassTableModel
);
1146 jTableLibClass
.setRowHeight(20);
1147 jTableLibClass
.setShowGrid(false);
1148 jTableLibClass
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1150 TableColumn column
= jTableLibClass
.getColumnModel().getColumn(1);
1151 jTableLibClass
.getColumnModel().removeColumn(column
);
1152 column
= jTableLibClass
.getColumnModel().getColumn(1);
1153 jTableLibClass
.getColumnModel().removeColumn(column
);
1155 jTableLibClass
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
1156 public void valueChanged(ListSelectionEvent e
) {
1157 if (e
.getValueIsAdjusting()){
1160 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
1161 if (lsm
.isSelectionEmpty()) {
1165 int selectedRow2
= lsm
.getMinSelectionIndex();
1166 if (selectedRow2
< 0) {
1170 // display potential lib instances according to class selection
1172 libInstanceTableModel
.setRowCount(0);
1173 String cls
= libClassTableModel
.getValueAt(selectedRow2
, 0).toString();
1174 String arch
= libClassTableModel
.getValueAt(selectedRow2
, 1).toString();
1175 String modType
= libClassTableModel
.getValueAt(selectedRow2
, 2).toString();
1176 LibraryClassDescriptor lcd
= new LibraryClassDescriptor(cls
, arch
, modType
);
1177 ArrayList
<String
> al
= classInstanceMap
.get(lcd
);
1179 al
= getInstancesForClass(lcd
, null);
1180 if (al
.size() != 0) {
1181 classInstanceMap
.put(lcd
, al
);
1185 ListIterator
<String
> li
= al
.listIterator();
1186 while(li
.hasNext()) {
1187 String instance
= li
.next();
1188 String
[] s
= {"", "", "", "", ""};
1189 if (WorkspaceProfile
.getModuleId(instance
) != null) {
1190 s
[0] = WorkspaceProfile
.getModuleId(instance
).getName();
1193 String
[] instancePart
= instance
.split(" ");
1194 for (int i
= 0; i
< instancePart
.length
; ++i
){
1195 s
[i
+1] = instancePart
[i
];
1197 libInstanceTableModel
.addRow(s
);
1204 return jTableLibClass
;
1208 * This method initializes jScrollPaneQualifiedInstance
1210 * @return javax.swing.JScrollPane
1212 private JScrollPane
getJScrollPaneQualifiedInstance() {
1213 if (jScrollPaneQualifiedInstance
== null) {
1214 jScrollPaneQualifiedInstance
= new JScrollPane();
1215 jScrollPaneQualifiedInstance
.setPreferredSize(new java
.awt
.Dimension(600,170));
1216 jScrollPaneQualifiedInstance
.setViewportView(getJTableLibInstances());
1218 return jScrollPaneQualifiedInstance
;
1222 * This method initializes jTableLibInstances
1224 * @return javax.swing.JTable
1226 private JTable
getJTableLibInstances() {
1227 if (jTableLibInstances
== null) {
1228 libInstanceTableModel
= new IDefaultTableModel();
1229 libInstanceTableModel
.addColumn("Name");
1230 libInstanceTableModel
.addColumn("ModuleGUID");
1231 libInstanceTableModel
.addColumn("ModuleVersion");
1232 libInstanceTableModel
.addColumn("PackageGUID");
1233 libInstanceTableModel
.addColumn("PackageVersion");
1234 jTableLibInstances
= new JTable(libInstanceTableModel
);
1235 jTableLibInstances
.setRowHeight(20);
1237 jTableLibInstances
.getColumnModel().getColumn(0).setMinWidth(250);
1239 jTableLibInstances
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_SUBSEQUENT_COLUMNS
);
1240 jTableLibInstances
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1243 return jTableLibInstances
;
1247 * This method initializes jPanelLibrarySouth
1249 * @return javax.swing.JPanel
1251 private JPanel
getJPanelLibrarySouth() {
1252 if (jPanelLibrarySouth
== null) {
1253 jPanelLibrarySouth
= new JPanel();
1255 return jPanelLibrarySouth
;
1259 * This method initializes jPanelLibraryCenter
1261 * @return javax.swing.JPanel
1263 private JPanel
getJPanelLibraryCenter() {
1264 if (jPanelLibraryCenter
== null) {
1265 jLabelInstanceHelp
= new JLabel();
1266 jLabelInstanceHelp
.setText("Instance Description");
1267 jLabelSelectedInstances
= new JLabel();
1268 jLabelSelectedInstances
.setText("Selected Instances");
1269 jPanelLibraryCenter
= new JPanel();
1270 jPanelLibraryCenter
.setLayout(new BorderLayout());
1272 jPanelLibraryCenter
.add(getJPanelLibraryCenterC(), java
.awt
.BorderLayout
.CENTER
);
1273 jPanelLibraryCenter
.add(getJPanelLibraryCenterN(), java
.awt
.BorderLayout
.NORTH
);
1276 return jPanelLibraryCenter
;
1280 * This method initializes jScrollPaneInstanceHelp
1282 * @return javax.swing.JScrollPane
1284 private JScrollPane
getJScrollPaneInstanceHelp() {
1285 if (jScrollPaneInstanceHelp
== null) {
1286 jScrollPaneInstanceHelp
= new JScrollPane();
1287 jScrollPaneInstanceHelp
.setPreferredSize(new java
.awt
.Dimension(400,50));
1288 jScrollPaneInstanceHelp
.setViewportView(getJTextAreaInstanceHelp());
1290 return jScrollPaneInstanceHelp
;
1294 * This method initializes jTextAreaInstanceHelp
1296 * @return javax.swing.JTextArea
1298 private JTextArea
getJTextAreaInstanceHelp() {
1299 if (jTextAreaInstanceHelp
== null) {
1300 jTextAreaInstanceHelp
= new JTextArea();
1301 jTextAreaInstanceHelp
.setEditable(false);
1303 return jTextAreaInstanceHelp
;
1307 * This method initializes jButtonAdd
1309 * @return javax.swing.JButton
1311 private JButton
getJButtonAdd() {
1312 if (jButtonAdd
== null) {
1313 jButtonAdd
= new JButton();
1314 jButtonAdd
.setPreferredSize(new java
.awt
.Dimension(80,20));
1315 jButtonAdd
.setText("Add");
1316 jButtonAdd
.addActionListener(new java
.awt
.event
.ActionListener() {
1317 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1318 int row
= jTableLibInstances
.getSelectedRow();
1323 String libInstanceKey
= libInstanceTableModel
.getValueAt(row
, 1) + " " +
1324 libInstanceTableModel
.getValueAt(row
, 2) + " " +
1325 libInstanceTableModel
.getValueAt(row
, 3) + " " +
1326 libInstanceTableModel
.getValueAt(row
, 4);
1327 ModuleIdentification libMi
= WorkspaceProfile
.getModuleId(libInstanceKey
);
1329 addLibInstance (libMi
);
1331 catch (Exception exception
) {
1332 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Adding Instance " + libMi
.getName() + " : \n"+ exception
.getMessage());
1335 docConsole
.setSaved(false);
1336 Object
[] s
= {libInstanceTableModel
.getValueAt(row
, 0), libInstanceTableModel
.getValueAt(row
, 1),
1337 libInstanceTableModel
.getValueAt(row
, 2), libInstanceTableModel
.getValueAt(row
, 3),
1338 libInstanceTableModel
.getValueAt(row
, 4)};
1339 selectedInstancesTableModel
.addRow(s
);
1341 Vector
<LibraryClassDescriptor
> vLcd
= addConsumedClassFromModule (libInstanceKey
);
1342 addProducedClassFromModule (libInstanceKey
);
1344 Vector
<String
> errorMsg
= new Vector
<String
>();
1345 Vector
<ModuleIdentification
> newInstances
= new Vector
<ModuleIdentification
>();
1346 Stack
<LibraryClassDescriptor
> lcdStack
= new Stack
<LibraryClassDescriptor
>();
1347 for (int i
= 0; i
< vLcd
.size(); ++i
) {
1348 LibraryClassDescriptor lcd
= vLcd
.get(i
);
1349 if (!lcdStack
.contains(lcd
)) {
1354 resolveLibraryInstances(lcdStack
, true, errorMsg
, newInstances
);
1356 catch (Exception exp
) {
1357 JOptionPane
.showMessageDialog(FpdModuleSA
.this, exp
.getMessage());
1360 showClassToResolved();
1362 if (errorMsg
.size() > 0) {
1364 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
1365 errors
+= " " + errorMsg
.get(i
) + "\n";
1367 JOptionPane
.showMessageDialog(FpdModuleSA
.this, errors
);
1376 * This method initializes jButton1
1378 * @return javax.swing.JButton
1380 private JButton
getJButtonDeleteInstance() {
1381 if (jButtonDeleteInstance
== null) {
1382 jButtonDeleteInstance
= new JButton();
1383 jButtonDeleteInstance
.setPreferredSize(new java
.awt
.Dimension(80,20));
1384 jButtonDeleteInstance
.setText("Delete");
1385 jButtonDeleteInstance
.addActionListener(new java
.awt
.event
.ActionListener() {
1386 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1387 int row
= jTableSelectedInstances
.getSelectedRow();
1391 docConsole
.setSaved(false);
1392 String instanceKey
= selectedInstancesTableModel
.getValueAt(row
, 1) + " "
1393 + selectedInstancesTableModel
.getValueAt(row
, 2) + " "
1394 + selectedInstancesTableModel
.getValueAt(row
, 3) + " "
1395 + selectedInstancesTableModel
.getValueAt(row
, 4);
1396 removeInstance(instanceKey
);
1398 selectedInstancesTableModel
.setRowCount(0);
1399 int instanceCount
= ffc
.getLibraryInstancesCount(moduleKey
);
1400 if (instanceCount
!= 0) {
1401 String
[][] saa
= new String
[instanceCount
][5];
1402 ffc
.getLibraryInstances(moduleKey
, saa
);
1403 for (int i
= 0; i
< saa
.length
; ++i
) {
1404 String libInstanceKey
= saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4];
1405 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(libInstanceKey
);
1408 // ToDo: verify this instance first.
1410 saa
[i
][0] = mi
.getName();
1411 saa
[i
][2] = mi
.getVersion();
1412 saa
[i
][4] = mi
.getPackageId().getVersion();
1413 selectedInstancesTableModel
.addRow(saa
[i
]);
1417 showClassToResolved();
1421 return jButtonDeleteInstance
;
1425 * This method initializes jButton2
1427 * @return javax.swing.JButton
1429 private JButton
getJButtonOk() {
1430 if (jButtonOk
== null) {
1431 jButtonOk
= new JButton();
1432 jButtonOk
.setPreferredSize(new java
.awt
.Dimension(80,20));
1433 jButtonOk
.setText("Close");
1434 jButtonOk
.addActionListener(this);
1440 * This method initializes jButton3
1442 * @return javax.swing.JButton
1444 private JButton
getJButtonCancel() {
1445 if (jButtonCancel
== null) {
1446 jButtonCancel
= new JButton();
1447 jButtonCancel
.setPreferredSize(new java
.awt
.Dimension(80,20));
1448 jButtonCancel
.setText("Cancel");
1449 jButtonCancel
.setVisible(false);
1451 return jButtonCancel
;
1453 public void actionPerformed(ActionEvent arg0
) {
1455 if (arg0
.getSource() == jButtonOk
) {
1456 if (jTableModuleSaOptions
.isEditing()) {
1457 jTableModuleSaOptions
.getCellEditor().stopCellEditing();
1459 this.setVisible(false);
1463 * This method initializes jPanelModuleSaOpts
1465 * @return javax.swing.JPanel
1467 private JPanel
getJPanelModuleSaOpts() {
1468 if (jPanelModuleSaOpts
== null) {
1469 FlowLayout flowLayout4
= new FlowLayout();
1470 flowLayout4
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1471 jLabelFfsFormatKey
= new JLabel();
1472 jLabelFfsFormatKey
.setText("FFS Format Key");
1473 jLabelFfsFormatKey
.setPreferredSize(new java
.awt
.Dimension(90,16));
1474 jLabelFfsFileGuid
= new JLabel();
1475 jLabelFfsFileGuid
.setText("FFS File GUID");
1476 jLabelFfsFileGuid
.setPreferredSize(new java
.awt
.Dimension(90,16));
1477 jLabelFfsFileGuid
.setVisible(false);
1478 jLabelFvBinding
= new JLabel();
1479 jLabelFvBinding
.setText("FV Binding");
1480 jLabelFvBinding
.setPreferredSize(new java
.awt
.Dimension(90,16));
1481 jPanelModuleSaOpts
= new JPanel();
1482 jPanelModuleSaOpts
.setLayout(flowLayout4
);
1483 jPanelModuleSaOpts
.add(jLabelFvBinding
, null);
1484 jPanelModuleSaOpts
.add(getJTextFieldFvBinding(), null);
1485 jPanelModuleSaOpts
.add(jLabelFfsFileGuid
, null);
1486 jPanelModuleSaOpts
.add(getJTextFieldFileGuid(), null);
1487 jPanelModuleSaOpts
.add(jLabelFfsFormatKey
, null);
1488 jPanelModuleSaOpts
.add(getJTextFieldFfsKey(), null);
1489 jPanelModuleSaOpts
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
1490 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
1491 initFvInfo(moduleKey
);
1495 return jPanelModuleSaOpts
;
1498 private Vector
<String
> getVectorFromString (String s
) {
1499 if (s
== null || s
.equals("null")) {
1502 String
[] sa1
= s
.split(" ");
1503 Vector
<String
> v
= new Vector
<String
>();
1504 for (int i
= 0; i
< sa1
.length
; ++i
) {
1511 * This method initializes jTextField
1513 * @return javax.swing.JTextField
1515 private JTextField
getJTextFieldFvBinding() {
1516 if (jTextFieldFvBinding
== null) {
1517 jTextFieldFvBinding
= new JTextField();
1518 jTextFieldFvBinding
.setPreferredSize(new java
.awt
.Dimension(400,20));
1519 jTextFieldFvBinding
.setEditable(true);
1520 jTextFieldFvBinding
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1521 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1522 String originalFvBinding
= ffc
.getFvBinding(moduleKey
);
1523 String newFvBinding
= jTextFieldFvBinding
.getText();
1524 if (newFvBinding
.equals(originalFvBinding
)) {
1527 if (newFvBinding
.length() == 0 && originalFvBinding
== null) {
1531 Vector
<String
> oldFvList
= getVectorFromString (originalFvBinding
);
1532 Vector
<String
> newFvList
= getVectorFromString (newFvBinding
);
1533 String moduleInfo
[] = moduleKey
.split(" ");
1534 ffc
.setFvBinding(moduleKey
, newFvBinding
);
1536 // remove module from Fvs that not in newFvList now.
1538 oldFvList
.removeAll(newFvList
);
1539 for (int j
= 0; j
< oldFvList
.size(); ++j
) {
1540 ffc
.removeModuleInBuildOptionsUserExtensions(oldFvList
.get(j
), "IMAGES", "1", moduleInfo
[0], moduleInfo
[1], moduleInfo
[2], moduleInfo
[3], moduleInfo
[4]);
1543 // add module to Fvs that were not in oldFvList.
1545 oldFvList
= getVectorFromString (originalFvBinding
);
1546 newFvList
.removeAll(oldFvList
);
1547 for (int i
= 0; i
< newFvList
.size(); ++i
) {
1548 ffc
.addModuleIntoBuildOptionsUserExtensions(newFvList
.get(i
), "IMAGES", "1", moduleInfo
[0], moduleInfo
[1], moduleInfo
[2], moduleInfo
[3], moduleInfo
[4]);
1550 docConsole
.setSaved(false);
1555 return jTextFieldFvBinding
;
1558 * This method initializes jTextField1
1560 * @return javax.swing.JTextField
1562 private JTextField
getJTextFieldFileGuid() {
1563 if (jTextFieldFileGuid
== null) {
1564 jTextFieldFileGuid
= new JTextField();
1565 jTextFieldFileGuid
.setPreferredSize(new java
.awt
.Dimension(300,20));
1566 jTextFieldFileGuid
.setVisible(false);
1567 jTextFieldFileGuid
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1568 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1569 String originalFileGuid
= ffc
.getFfsFileNameGuid(moduleKey
);
1570 String newFileGuid
= jTextFieldFileGuid
.getText();
1571 if (newFileGuid
.equals(originalFileGuid
)) {
1574 if (newFileGuid
.length() == 0 && originalFileGuid
== null) {
1577 if (newFileGuid
.length() > 0) {
1578 if (!DataValidation
.isGuid(newFileGuid
)) {
1579 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "FFS File Guid is NOT GUID Type.");
1584 docConsole
.setSaved(false);
1585 if (newFileGuid
.length() == 0) {
1588 ffc
.setFfsFileNameGuid(moduleKey
, newFileGuid
);
1593 return jTextFieldFileGuid
;
1596 * This method initializes jTextFieldFfsKey
1598 * @return javax.swing.JTextField
1600 private JTextField
getJTextFieldFfsKey() {
1601 if (jTextFieldFfsKey
== null) {
1602 jTextFieldFfsKey
= new JTextField();
1603 jTextFieldFfsKey
.setPreferredSize(new java
.awt
.Dimension(250,20));
1604 jTextFieldFfsKey
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1605 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1606 String originalFfsKey
= ffc
.getFfsFormatKey(moduleKey
);
1607 String newFfsKey
= jTextFieldFfsKey
.getText();
1608 if (newFfsKey
.equals(originalFfsKey
)) {
1611 if (newFfsKey
.length() == 0 && originalFfsKey
== null) {
1614 docConsole
.setSaved(false);
1615 ffc
.setFfsFormatKey(moduleKey
, newFfsKey
);
1620 return jTextFieldFfsKey
;
1623 * This method initializes jScrollPaneModuleSaOptions
1625 * @return javax.swing.JScrollPane
1627 private JScrollPane
getJScrollPaneModuleSaOptions() {
1628 if (jScrollPaneModuleSaOptions
== null) {
1629 jScrollPaneModuleSaOptions
= new JScrollPane();
1630 jScrollPaneModuleSaOptions
.setPreferredSize(new java
.awt
.Dimension(600,350));
1631 jScrollPaneModuleSaOptions
.setViewportView(getJTableModuleSaOptions());
1633 return jScrollPaneModuleSaOptions
;
1636 * This method initializes jTableModuleSaOptions
1638 * @return javax.swing.JTable
1640 private JTable
getJTableModuleSaOptions() {
1641 if (jTableModuleSaOptions
== null) {
1642 optionsTableModel
= new DefaultTableModel();
1643 optionsTableModel
.addColumn("BuildTargets");
1644 optionsTableModel
.addColumn("ToolChainFamily");
1645 optionsTableModel
.addColumn("TagName");
1646 optionsTableModel
.addColumn("ToolCode");
1647 optionsTableModel
.addColumn("SupportedArchs");
1648 optionsTableModel
.addColumn("Contents");
1649 jTableModuleSaOptions
= new JTable(optionsTableModel
);
1650 jTableModuleSaOptions
.setRowHeight(20);
1652 jTableModuleSaOptions
.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth
);
1653 jTableModuleSaOptions
.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth
);
1654 jTableModuleSaOptions
.getColumnModel().getColumn(2).setMinWidth(tagNameWidth
);
1655 jTableModuleSaOptions
.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth
);
1656 jTableModuleSaOptions
.getColumnModel().getColumn(4).setMinWidth(supportArchWidth
);
1657 jTableModuleSaOptions
.getColumnModel().getColumn(5).setMinWidth(argWidth
);
1658 // javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);
1659 // JComboBox cb = new JComboBox();
1660 // cb.addItem("MSFT");
1661 // cb.addItem("GCC");
1662 // cb.addItem("CYGWIN");
1663 // cb.addItem("INTEL");
1664 // cb.addItem("USER_DEFINED");
1665 // toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1667 Vector
<String
> vArch
= new Vector
<String
>();
1674 jTableModuleSaOptions
.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch
, FrameworkWizardUI
.getInstance()));
1676 jTableModuleSaOptions
.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI
.getInstance()));
1678 jTableModuleSaOptions
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1679 jTableModuleSaOptions
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_OFF
);
1680 jTableModuleSaOptions
.getModel().addTableModelListener(new TableModelListener() {
1681 public void tableChanged(TableModelEvent arg0
) {
1682 // TODO Auto-generated method stub
1683 int row
= arg0
.getFirstRow();
1684 TableModel m
= (TableModel
)arg0
.getSource();
1686 if (arg0
.getType() == TableModelEvent
.UPDATE
){
1687 //ToDo Data Validition check.
1688 String targets
= m
.getValueAt(row
, 0) + "";
1689 Vector
<Object
> targetName
= null;
1690 if (targets
.length() > 0) {
1691 targetName
= new Vector
<Object
>();
1692 String
[] sArray
= targets
.split(" ");
1693 for (int i
= 0; i
< sArray
.length
; ++i
) {
1694 targetName
.add(sArray
[i
]);
1698 String toolChain
= m
.getValueAt(row
, 1) + "";
1699 String tagName
= m
.getValueAt(row
, 2) + "";
1700 String toolCode
= m
.getValueAt(row
, 3) + "";
1701 String archs
= m
.getValueAt(row
, 4) + "";
1702 Vector
<Object
> supArch
= null;
1703 if (archs
.length() > 0) {
1704 supArch
= new Vector
<Object
>();
1705 String
[] sArray1
= archs
.split(" ");
1706 for (int i
= 0; i
< sArray1
.length
; ++i
) {
1707 supArch
.add(sArray1
[i
]);
1711 String contents
= m
.getValueAt(row
, 5) + "";
1712 docConsole
.setSaved(false);
1713 ffc
.updateModuleSAOptionsOpt(moduleKey
, row
, targetName
, toolChain
, tagName
, toolCode
, supArch
, contents
);
1718 return jTableModuleSaOptions
;
1721 * This method initializes jButtonNew
1723 * @return javax.swing.JButton
1725 private JButton
getJButtonNew() {
1726 if (jButtonNew
== null) {
1727 jButtonNew
= new JButton();
1728 jButtonNew
.setPreferredSize(new java
.awt
.Dimension(80,20));
1729 jButtonNew
.setText("New");
1730 jButtonNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1731 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1732 String
[] row
= {"", "", "", "", "", ""};
1733 optionsTableModel
.addRow(row
);
1734 Vector
<Object
> v
= null;
1735 Vector
<Object
> v1
= null;
1736 docConsole
.setSaved(false);
1737 ffc
.genModuleSAOptionsOpt(moduleKey
, v
, "", "", "", v1
, "");
1744 * This method initializes jButtonDelete
1746 * @return javax.swing.JButton
1748 private JButton
getJButtonDeleteOption() {
1749 if (jButtonDeleteOption
== null) {
1750 jButtonDeleteOption
= new JButton();
1751 jButtonDeleteOption
.setPreferredSize(new java
.awt
.Dimension(80,20));
1752 jButtonDeleteOption
.setText("Delete");
1753 jButtonDeleteOption
.addActionListener(new java
.awt
.event
.ActionListener() {
1754 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1755 if (jTableModuleSaOptions
.getSelectedRow() < 0) {
1758 docConsole
.setSaved(false);
1759 ffc
.removeModuleSAOptionsOpt(moduleKey
, jTableModuleSaOptions
.getSelectedRow());
1760 optionsTableModel
.removeRow(jTableModuleSaOptions
.getSelectedRow());
1764 return jButtonDeleteOption
;
1768 Start the window at the center of screen
1771 protected void centerWindow(int intWidth
, int intHeight
) {
1772 Dimension d
= Toolkit
.getDefaultToolkit().getScreenSize();
1773 this.setLocation((d
.width
- intWidth
) / 2, (d
.height
- intHeight
) / 2);
1777 Start the window at the center of screen
1780 protected void centerWindow() {
1781 centerWindow(this.getSize().width
, this.getSize().height
);
1784 * This method initializes jPanelPcdFields
1786 * @return javax.swing.JPanel
1788 private JPanel
getJPanelPcdFields() {
1789 if (jPanelPcdFields
== null) {
1790 GridLayout gridLayout
= new GridLayout();
1791 gridLayout
.setRows(3);
1792 gridLayout
.setColumns(2);
1793 jPanelPcdFields
= new JPanel();
1794 jPanelPcdFields
.setLayout(gridLayout
);
1795 jPanelPcdFields
.setPreferredSize(new java
.awt
.Dimension(600,90));
1796 jPanelPcdFields
.add(getJPanelPcdFieldsFirstRow(), null);
1797 jPanelPcdFields
.add(getJPanelPcdFieldsSecondRow(), null);
1798 jPanelPcdFields
.add(getJPanelPcdFieldsThirdRow(), null);
1800 return jPanelPcdFields
;
1803 * This method initializes jPanelPcdFieldsSecondRow
1805 * @return javax.swing.JPanel
1807 private JPanel
getJPanelPcdFieldsSecondRow() {
1808 if (jPanelPcdFieldsSecondRow
== null) {
1809 FlowLayout flowLayout2
= new FlowLayout();
1810 flowLayout2
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1811 jLabelMaxDatumSize
= new JLabel();
1812 jLabelMaxDatumSize
.setText("Max Datum Size");
1813 jPanelPcdFieldsSecondRow
= new JPanel();
1814 jPanelPcdFieldsSecondRow
.setLayout(flowLayout2
);
1815 jPanelPcdFieldsSecondRow
.add(jLabelMaxDatumSize
, null);
1816 jPanelPcdFieldsSecondRow
.add(getJTextFieldMaxDatumSize(), null);
1818 return jPanelPcdFieldsSecondRow
;
1821 * This method initializes jPanelPcdFieldsThirdRow
1823 * @return javax.swing.JPanel
1825 private JPanel
getJPanelPcdFieldsThirdRow() {
1826 if (jPanelPcdFieldsThirdRow
== null) {
1827 FlowLayout flowLayout3
= new FlowLayout();
1828 flowLayout3
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1829 jLabelPcdDefaultValue
= new JLabel();
1830 jLabelPcdDefaultValue
.setText("Default Value");
1831 jLabelPcdDefaultValue
.setPreferredSize(new java
.awt
.Dimension(91,16));
1832 jPanelPcdFieldsThirdRow
= new JPanel();
1833 jPanelPcdFieldsThirdRow
.setLayout(flowLayout3
);
1834 jPanelPcdFieldsThirdRow
.add(jLabelPcdDefaultValue
, null);
1835 jPanelPcdFieldsThirdRow
.add(getJTextFieldPcdDefault(), null);
1836 jPanelPcdFieldsThirdRow
.add(getJComboBoxFeatureFlagValue(), null);
1837 jPanelPcdFieldsThirdRow
.add(getJButtonUpdatePcd(), null);
1839 return jPanelPcdFieldsThirdRow
;
1842 * This method initializes jPanelPcdFieldsFirstRow
1844 * @return javax.swing.JPanel
1846 private JPanel
getJPanelPcdFieldsFirstRow() {
1847 if (jPanelPcdFieldsFirstRow
== null) {
1848 FlowLayout flowLayout1
= new FlowLayout();
1849 flowLayout1
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1850 jLabelItemType
= new JLabel();
1851 jLabelItemType
.setText("Item Type");
1852 jLabelItemType
.setPreferredSize(new java
.awt
.Dimension(91,16));
1853 jPanelPcdFieldsFirstRow
= new JPanel();
1854 jPanelPcdFieldsFirstRow
.setLayout(flowLayout1
);
1855 jPanelPcdFieldsFirstRow
.add(jLabelItemType
, null);
1856 jPanelPcdFieldsFirstRow
.add(getJComboBoxItemType(), null);
1858 return jPanelPcdFieldsFirstRow
;
1861 * This method initializes jComboBoxItemType
1863 * @return javax.swing.JComboBox
1865 private JComboBox
getJComboBoxItemType() {
1866 if (jComboBoxItemType
== null) {
1867 jComboBoxItemType
= new JComboBox();
1868 jComboBoxItemType
.setPreferredSize(new java
.awt
.Dimension(200,20));
1869 jComboBoxItemType
.addItemListener(new java
.awt
.event
.ItemListener() {
1870 public void itemStateChanged(java
.awt
.event
.ItemEvent e
) {
1872 int row
= jTablePcd
.getSelectedRow();
1877 if (jComboBoxItemType
.getSelectedItem() != null && jComboBoxItemType
.getSelectedItem().equals("FIXED_AT_BUILD")) {
1878 jTextFieldPcdDefault
.setEnabled(true);
1881 jTextFieldPcdDefault
.setEnabled(false);
1886 return jComboBoxItemType
;
1889 private void pcdDynamicToNonDynamic(String cName
, String tsGuid
) {
1890 String
[][] saa
= new String
[ffc
.getDynamicPcdBuildDataCount()][5];
1891 ffc
.getDynamicPcdBuildData(saa
);
1892 String maxSize
= "";
1894 for (int i
= 0; i
< saa
.length
; ++i
) {
1895 if (saa
[i
][0].equals(cName
) && saa
[i
][2].equals(tsGuid
)) {
1896 maxSize
= saa
[i
][3];
1897 value
= ffc
.getDynamicPcdBuildDataValue(i
);
1902 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1903 for (int i
= 0; i
< al
.size(); ++i
) {
1904 String mKey
= moduleInfo (al
.get(i
));
1906 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1907 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, maxSize
, value
);
1908 al
.set(i
, mKey
+ " " + itemType
);
1911 ffc
.removeDynamicPcdBuildData(cName
, tsGuid
);
1914 private void pcdNonDynamicToDynamic(String cName
, String tsGuid
) {
1915 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1916 for (int i
= 0; i
< al
.size(); ++i
) {
1917 String mKey
= moduleInfo (al
.get(i
));
1918 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1919 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, jTextFieldMaxDatumSize
.getText(), jTextFieldPcdDefault
.isVisible() ? jTextFieldPcdDefault
.getText() : jComboBoxFeatureFlagValue
.getSelectedItem()+"");
1920 al
.set(i
, mKey
+ " " + itemType
);
1923 ffc
.addDynamicPcdBuildData(cName
, model
.getValueAt(jTablePcd
.getSelectedRow(), 3), tsGuid
, "DYNAMIC", model
.getValueAt(jTablePcd
.getSelectedRow(), 5)+"", jTextFieldPcdDefault
.isVisible() ? jTextFieldPcdDefault
.getText() : jComboBoxFeatureFlagValue
.getSelectedItem()+"");
1926 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "PCD value format: " + e
.getMessage());
1930 private void changePcdTypeWithinSameCategory (String cName
, String tsGuid
) {
1931 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1932 for (int i
= 0; i
< al
.size(); ++i
) {
1933 String mKey
= moduleInfo (al
.get(i
));
1934 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1935 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, null, null);
1936 al
.set(i
, mKey
+ " " + itemType
);
1940 private String
moduleInfo (String pcdInfo
) {
1942 return pcdInfo
.substring(0, pcdInfo
.lastIndexOf(" "));
1946 * This method initializes jTextFieldMaxDatumSize
1948 * @return javax.swing.JTextField
1950 private JTextField
getJTextFieldMaxDatumSize() {
1951 if (jTextFieldMaxDatumSize
== null) {
1952 jTextFieldMaxDatumSize
= new JTextField();
1953 jTextFieldMaxDatumSize
.setPreferredSize(new java
.awt
.Dimension(200,20));
1955 return jTextFieldMaxDatumSize
;
1958 * This method initializes jTextField4
1960 * @return javax.swing.JTextField
1962 private JTextField
getJTextFieldPcdDefault() {
1963 if (jTextFieldPcdDefault
== null) {
1964 jTextFieldPcdDefault
= new JTextField();
1965 jTextFieldPcdDefault
.setPreferredSize(new java
.awt
.Dimension(200,20));
1967 return jTextFieldPcdDefault
;
1970 * This method initializes jButton6
1972 * @return javax.swing.JButton
1974 private JButton
getJButtonUpdatePcd() {
1975 if (jButtonUpdatePcd
== null) {
1976 jButtonUpdatePcd
= new JButton();
1977 jButtonUpdatePcd
.setPreferredSize(new java
.awt
.Dimension(150,20));
1978 jButtonUpdatePcd
.setText("Update PCD Data");
1979 jButtonUpdatePcd
.addActionListener(new java
.awt
.event
.ActionListener() {
1980 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1981 int row
= jTablePcd
.getSelectedRow();
1986 String cName
= model
.getValueAt(row
, 0)+"";
1987 String tsGuid
= model
.getValueAt(row
, 1)+"";
1988 String oldItemType
= model
.getValueAt(row
, 2)+"";
1989 String dataType
= model
.getValueAt(row
, 5)+"";
1990 String newItemType
= jComboBoxItemType
.getSelectedItem()+"";
1991 String newValue
= jTextFieldPcdDefault
.isVisible()? jTextFieldPcdDefault
.getText():jComboBoxFeatureFlagValue
.getSelectedItem()+"";
1992 if (newValue
.length() == 0){
1994 if (dataType
.equals("UINT8") || dataType
.equals("UINT16") || dataType
.equals("UINT32") || dataType
.equals("UINT64")) {
1997 if (dataType
.equals("BOOLEAN")){
2000 if (dataType
.equals("VOID*")) {
2005 String
[] pcdInfo
= {"", "", ""};
2006 Vector
<String
> validPcdTypes
= new Vector
<String
>();
2007 getPcdInfo (moduleKey
, cName
, tsGuid
, pcdInfo
, validPcdTypes
);
2008 if (pcdInfo
[1].equals("FIXED_AT_BUILD") && model
.getValueAt(row
, 5).equals("VOID*")) {
2010 jTextFieldMaxDatumSize
.setText(ffc
.setMaxSizeForPointer(newValue
)+"");
2012 catch (Exception exp
) {
2013 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "PCD Value MalFormed: " + exp
.getMessage());
2017 String newMaxDatumSize
= jTextFieldMaxDatumSize
.getText();
2019 if (!newItemType
.equals(oldItemType
)) {
2020 Vector
<ModuleIdentification
> moduleInfo
= new Vector
<ModuleIdentification
>();
2022 boolean changable
= itemTypeCouldBeChanged (cName
, tsGuid
, newItemType
, moduleInfo
);
2024 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Can NOT Change Pcd Type in: " + moduleInfo
.get(0).getName() + " contained in package " + moduleInfo
.get(0).getPackageId().getName());
2028 catch (Exception exp
) {
2029 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Can NOT Change Pcd Type in: " + moduleInfo
.get(0).getName() + " contained in package " + moduleInfo
.get(0).getPackageId().getName() + " " + exp
.getMessage());
2033 if ((oldItemType
.equals("DYNAMIC") || oldItemType
.equals("DYNAMIC_EX")) && !newItemType
.equals("DYNAMIC") && !newItemType
.equals("DYNAMIC_EX")) {
2034 pcdDynamicToNonDynamic(cName
, tsGuid
);
2036 if (!oldItemType
.equals("DYNAMIC") && !oldItemType
.equals("DYNAMIC_EX") && (newItemType
.equals("DYNAMIC") || newItemType
.equals("DYNAMIC_EX"))) {
2037 pcdNonDynamicToDynamic(cName
, tsGuid
);
2040 changePcdTypeWithinSameCategory (cName
, tsGuid
);
2042 model
.setValueAt(newItemType
, row
, 2);
2045 ffc
.updatePcdData(moduleKey
, cName
, tsGuid
, model
.getValueAt(row
, 2)+"", newMaxDatumSize
, newValue
);
2046 docConsole
.setSaved(false);
2047 model
.setValueAt(newValue
, row
, 6);
2048 model
.setValueAt(newMaxDatumSize
, row
, 4);
2053 return jButtonUpdatePcd
;
2056 private boolean itemTypeCouldBeChanged (String cName
, String tsGuid
, String newItemType
, Vector
<ModuleIdentification
> mi
) throws Exception
{
2057 ArrayList
<String
> pcdConsumers
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
2058 for (int i
= 0; i
< pcdConsumers
.size(); ++i
) {
2059 String consumerInfo
= moduleInfo (pcdConsumers
.get(i
));
2060 mi
.removeAllElements();
2061 mi
.add(WorkspaceProfile
.getModuleId(consumerInfo
));
2062 String
[] sa
= {"", "", ""};
2063 Vector
<String
> validPcdTypes
= new Vector
<String
>();
2064 getPcdInfo (consumerInfo
, cName
, tsGuid
, sa
, validPcdTypes
);
2065 if (validPcdTypes
.size() == 0) {
2068 if (!sa
[1].equals("DYNAMIC")) {
2071 if (!validPcdTypes
.contains(newItemType
)) {
2079 * This method initializes jComboBoxFeatureFlagValue
2081 * @return javax.swing.JComboBox
2083 private JComboBox
getJComboBoxFeatureFlagValue() {
2084 if (jComboBoxFeatureFlagValue
== null) {
2085 jComboBoxFeatureFlagValue
= new JComboBox();
2086 jComboBoxFeatureFlagValue
.setPreferredSize(new java
.awt
.Dimension(100,20));
2087 jComboBoxFeatureFlagValue
.setVisible(false);
2088 jComboBoxFeatureFlagValue
.addItem("TRUE");
2089 jComboBoxFeatureFlagValue
.addItem("FALSE");
2091 return jComboBoxFeatureFlagValue
;
2094 * This method initializes jPanelCustomToolChain
2096 * @return javax.swing.JPanel
2098 private JPanel
getJPanelCustomToolChain() {
2099 if (jPanelCustomToolChain
== null) {
2100 jPanelCustomToolChain
= new JPanel();
2101 jPanelCustomToolChain
.setLayout(new BorderLayout());
2102 jPanelCustomToolChain
.add(getJPanelToolchainS(), java
.awt
.BorderLayout
.SOUTH
);
2103 jPanelCustomToolChain
.add(getJScrollPaneModuleSaOptions(), java
.awt
.BorderLayout
.CENTER
);
2104 jPanelCustomToolChain
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
2105 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
2106 initToolChainOptions(moduleKey
);
2110 return jPanelCustomToolChain
;
2113 * This method initializes jPanelToolchainS
2115 * @return javax.swing.JPanel
2117 private JPanel
getJPanelToolchainS() {
2118 if (jPanelToolchainS
== null) {
2119 jPanelToolchainS
= new JPanel();
2120 jPanelToolchainS
.add(getJButtonNew(), null);
2121 jPanelToolchainS
.add(getJButtonDeleteOption(), null);
2123 return jPanelToolchainS
;
2127 * This method initializes jPanelLibraryCenterN
2129 * @return javax.swing.JPanel
2131 private JPanel
getJPanelLibraryCenterN() {
2132 if (jPanelLibraryCenterN
== null) {
2133 FlowLayout flowLayout5
= new FlowLayout();
2134 flowLayout5
.setAlignment(java
.awt
.FlowLayout
.CENTER
);
2135 flowLayout5
.setHgap(10);
2136 jPanelLibraryCenterN
= new JPanel();
2137 jPanelLibraryCenterN
.setLayout(flowLayout5
);
2138 jPanelLibraryCenterN
.add(jLabelInstanceHelp
, null);
2139 jPanelLibraryCenterN
.add(getJScrollPaneInstanceHelp(), null);
2140 jPanelLibraryCenterN
.add(getJButtonAdd(), null);
2141 jPanelLibraryCenterN
.add(getJButtonDeleteInstance(), null);
2143 return jPanelLibraryCenterN
;
2146 * This method initializes jPanelLibraryCenterC
2148 * @return javax.swing.JPanel
2150 private JPanel
getJPanelLibraryCenterC() {
2151 if (jPanelLibraryCenterC
== null) {
2152 jPanelLibraryCenterC
= new JPanel();
2153 jPanelLibraryCenterC
.add(jLabelSelectedInstances
, null);
2154 jPanelLibraryCenterC
.add(getJScrollPaneSelectedInstances(), null);
2156 return jPanelLibraryCenterC
;
2160 } // @jve:decl-index=0:visual-constraint="10,10"
2162 class MultipleInstanceException
extends Exception
{
2167 private static final long serialVersionUID
= -9148463005930920297L;
2168 private String className
= null;
2169 private String libInstance1
= null;
2170 private String libInstance2
= null;
2172 MultipleInstanceException (String libClass
, String instance1
, String instance2
) {
2174 className
= libClass
;
2175 libInstance1
= instance1
;
2176 libInstance2
= instance2
;
2180 * @see java.lang.Throwable#getMessage()
2183 public String
getMessage() {
2184 // TODO Auto-generated method stub
2185 return " Library Class " + className
+ "is Produced by Two Instances: "
2186 + libInstance1
+ " and " + libInstance2
+ ". Platform Build will Fail.";
2191 class ImproperInstanceException
extends Exception
{
2196 private static final long serialVersionUID
= -5279700566993277033L;
2197 private String className
= null;
2198 private String libInstance
= null;
2199 private String instanceSupArch
= null;
2200 private String instanceSupModType
= null;
2202 ImproperInstanceException (String libClass
, String instance1
, String arch
, String type
) {
2204 className
= libClass
;
2205 libInstance
= instance1
;
2206 instanceSupArch
= arch
;
2207 instanceSupModType
= type
;
2211 * @see java.lang.Throwable#getMessage()
2214 public String
getMessage() {
2215 // TODO Auto-generated method stub
2216 return " Library Class " + className
+ " Produced by Library Instance: "
2217 + libInstance
+ "\nOnly Supports " + instanceSupArch
+ " and Module Type " + instanceSupModType
+ ".\n This instance should be removed.\n";
2222 class NoInstanceException
extends Exception
{
2227 private static final long serialVersionUID
= 1987122786598970598L;
2229 private String className
= null;
2231 NoInstanceException (String libClass
) {
2232 className
= libClass
;
2235 public String
getMessage() {
2236 return "No Applicable Instance for Library Class " + className
2237 + ", Platform Build will Fail.";