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 jTabbedPane
.setSelectedIndex(0);
161 initPcdBuildDefinition(moduleKey
);
162 moduleId
= WorkspaceProfile
.getModuleId(moduleKey
);
163 if (moduleId
== null) {
166 int tabIndex
= jTabbedPane
.indexOfTab("Libraries");
167 if (moduleId
.isLibrary()) {
168 jTabbedPane
.setEnabledAt(tabIndex
, false);
171 jTabbedPane
.setEnabledAt(tabIndex
, true);
176 init will be called each time FpdModuleSA object is to be shown.
177 @param key Module information.
179 public void initPcdBuildDefinition(String key
) {
181 // display pcd for key.
183 model
.setRowCount(0);
184 jTextAreaPcdHelp
.setText("");
185 jComboBoxItemType
.setSelectedIndex(-1);
186 jTextFieldMaxDatumSize
.setText("");
187 jTextFieldPcdDefault
.setText("");
188 int pcdCount
= ffc
.getPcdDataCount(key
);
190 String
[][] saa
= new String
[pcdCount
][7];
191 ffc
.getPcdData(key
, saa
);
192 for (int j
= 0; j
< saa
.length
; ++j
) {
193 model
.addRow(saa
[j
]);
198 public void initLibraries(String key
) {
199 libClassTableModel
.setRowCount(0);
200 libInstanceTableModel
.setRowCount(0);
201 selectedInstancesTableModel
.setRowCount(0);
202 Vector
<String
> errorMsg
= new Vector
<String
>();
203 Vector
<ModuleIdentification
> newInstances
= new Vector
<ModuleIdentification
>();
205 addConsumedClassFromModule (key
);
206 addProducedClassFromModule (key
);
208 int instanceCount
= ffc
.getLibraryInstancesCount(key
);
209 if (instanceCount
!= 0) {
210 String
[][] saa
= new String
[instanceCount
][5];
211 ffc
.getLibraryInstances(key
, saa
);
212 for (int i
= 0; i
< saa
.length
; ++i
) {
213 String libInstanceKey
= saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4];
214 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(libInstanceKey
);
217 // ToDo: verify this instance first.
219 saa
[i
][0] = mi
.getName();
220 saa
[i
][2] = mi
.getVersion();
221 saa
[i
][4] = mi
.getPackageId().getVersion();
223 // re-evaluate lib instance usage when adding a already-selected lib instance.
225 addConsumedClassFromModule (libInstanceKey
);
226 addProducedClassFromModule (libInstanceKey
);
227 selectedInstancesTableModel
.addRow(saa
[i
]);
232 Set
<LibraryClassDescriptor
> sLcd
= this.classConsumed
.keySet();
233 Iterator
<LibraryClassDescriptor
> iter
= sLcd
.iterator();
234 Stack
<LibraryClassDescriptor
> lcdStack
= new Stack
<LibraryClassDescriptor
>();
235 while (iter
.hasNext()) {
236 LibraryClassDescriptor lcd
= iter
.next();
237 if (this.classConsumed
.get(lcd
) == null || this.classConsumed
.get(lcd
).size() == 0) {
240 if (isBoundedClass(lcd
, errorMsg
)) {
244 if (!lcdStack
.contains(lcd
)) {
250 resolveLibraryInstances(lcdStack
, true, errorMsg
, newInstances
);
251 } catch (Exception e
) {
252 String exceptionMsg
= e
.getCause() + " " + e
.getMessage();
253 if (!errorMsg
.contains(exceptionMsg
)) {
254 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), e
.getCause() + " " + e
.getMessage());
258 String newInstancesAddedMsg
= "Library instance automatically added to this module :\n";
259 for (int i
= 0; i
< newInstances
.size(); ++i
) {
260 ModuleIdentification libMi
= newInstances
.get(i
);
261 newInstancesAddedMsg
+= libMi
.getName();
262 newInstancesAddedMsg
+= " ";
264 if (newInstances
.size() > 0) {
265 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), newInstancesAddedMsg
);
268 showClassToResolved();
270 if (errorMsg
.size() > 0) {
272 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
273 errors
+= " " + errorMsg
.get(i
) + "\n";
275 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), errors
);
279 public void initFvInfo (String key
) {
281 // display module SA options
283 jTextFieldFvBinding
.setText("");
284 String fvBinding
= ffc
.getFvBinding(key
);
285 if (fvBinding
!= null) {
286 jTextFieldFvBinding
.setText(fvBinding
);
288 jTextFieldFileGuid
.setText("");
289 String fileGuid
= ffc
.getFfsFileNameGuid(key
);
290 if (fileGuid
!= null) {
291 jTextFieldFileGuid
.setText(fileGuid
);
293 jTextFieldFfsKey
.setText("");
294 String ffsKey
= ffc
.getFfsFormatKey(key
);
295 if (ffsKey
!= null) {
296 jTextFieldFfsKey
.setText(ffsKey
);
300 public void initToolChainOptions(String key
) {
302 optionsTableModel
.setRowCount(0);
303 String
[][] saa
= new String
[ffc
.getModuleSAOptionsCount(key
)][6];
304 ffc
.getModuleSAOptions(key
, saa
);
305 for (int i
= 0; i
< saa
.length
; ++i
) {
306 optionsTableModel
.addRow(saa
[i
]);
310 private void filterClassConsumedByArch (Vector
<LibraryClassDescriptor
> v
) {
311 String
[] moduleInfo
= moduleKey
.split(" ");
312 Vector
<String
> vModuleArchs
= new Vector
<String
>();
314 // Skip guid, version information, get archs to check.
316 for (int i
= 4; i
< moduleInfo
.length
; ++i
) {
317 vModuleArchs
.add(moduleInfo
[i
]);
320 // if module will be built on all platforms, no filter needed for lib classes.
322 if (vModuleArchs
.size() == 0) {
326 Iterator
<LibraryClassDescriptor
> iter
= v
.iterator();
327 while (iter
.hasNext()) {
328 LibraryClassDescriptor libInfo
= iter
.next();
330 Vector
<String
> vSupArchs
= libInfo
.getVectorFromString(libInfo
.supArchs
);
332 if (vSupArchs
.size() == 0 || (vSupArchs
.size() == 1 && vSupArchs
.get(0).equalsIgnoreCase(""))) {
334 // update lib info to module archs only.
336 libInfo
.supArchs
= "";
337 for (int i
= 0; i
< vModuleArchs
.size(); ++i
) {
338 libInfo
.supArchs
+= vModuleArchs
.get(i
);
339 libInfo
.supArchs
+= " ";
341 libInfo
.supArchs
.trim();
345 // only retain those lib class used by module archs.
347 vSupArchs
.retainAll(vModuleArchs
);
348 if (vSupArchs
.size() > 0) {
350 // update lib info to reflect which kind of arch need to select instance.
352 libInfo
.supArchs
= "";
353 for (int i
= 0; i
< vSupArchs
.size(); ++i
) {
354 libInfo
.supArchs
+= vSupArchs
.get(i
);
355 libInfo
.supArchs
+= " ";
357 libInfo
.supArchs
.trim();
361 // remove this lib definition if it supports no archs module will be built under.
367 private void addProducedClassFromModule (String key
) {
368 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
369 Vector
<LibraryClassDescriptor
> vClassProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
370 if (this.classProduced
== null) {
371 this.classProduced
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
373 for (int i
= 0; i
< vClassProduced
.size(); ++i
) {
374 ArrayList
<String
> producedBy
= this.classProduced
.get(vClassProduced
.get(i
));
375 if (producedBy
== null) {
376 producedBy
= new ArrayList
<String
>();
379 // class already produced by previous module (lib instance).
381 if (producedBy.size() == 1) {
382 String instanceKey = producedBy.get(0);
383 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
384 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
386 Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
387 while (lcdi.hasNext()) {
388 LibraryClassDescriptor lcd = lcdi.next();
389 if (vClassProduced.get(i).hasInterSectionWith(lcd)) {
390 ArrayList<String> alreadyProducedBy = this.classProduced.get(lcd);
391 String instanceKey = alreadyProducedBy.get(0);
392 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
393 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
400 this.classProduced
.put(vClassProduced
.get(i
), producedBy
);
405 private Vector
<LibraryClassDescriptor
> addConsumedClassFromModule (String key
) {
406 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
407 // PackageIdentification[] depPkgList = null;
410 // Get dependency pkg list into which we will search lib instances.
412 //depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
414 // Get the lib class consumed, produced by this module itself.
416 Vector
<LibraryClassDescriptor
> vClassConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED", mi
);
417 for (int i
= 0; i
< vClassConsumed
.size(); ++i
) {
418 vClassConsumed
.get(i
).supModTypes
= WorkspaceProfile
.getModuleType(moduleId
);
420 filterClassConsumedByArch(vClassConsumed
);
421 if (this.classConsumed
== null) {
422 this.classConsumed
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
425 for (int i
= 0; i
< vClassConsumed
.size(); ++i
) {
426 ArrayList
<String
> consumedBy
= this.classConsumed
.get(vClassConsumed
.get(i
));
427 if (consumedBy
== null) {
428 consumedBy
= new ArrayList
<String
>();
431 this.classConsumed
.put(vClassConsumed
.get(i
), consumedBy
);
434 return vClassConsumed
;
437 private void resolveLibraryInstances(Stack
<LibraryClassDescriptor
> lcdStack
, boolean autoSelectSingleInstance
, Vector
<String
> errorMsg
, Vector
<ModuleIdentification
> newInstances
) throws MultipleInstanceException
, NoInstanceException
{
439 if (classInstanceMap
== null) {
440 classInstanceMap
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
442 while (!lcdStack
.empty()) {
443 LibraryClassDescriptor cls
= lcdStack
.pop();
444 if (isBoundedClass(cls
, errorMsg
)) {
447 ArrayList
<String
> instances
= getInstancesForClass(cls
, null);
448 if (instances
.size() == 0) {
449 // throw new NoInstanceException (cls.className);
450 String exceptionMsg
= new NoInstanceException (cls
.className
).getMessage();
451 if (!errorMsg
.contains(exceptionMsg
)) {
452 errorMsg
.add(exceptionMsg
);
456 classInstanceMap
.put(cls
, instances
);
457 if (instances
.size() == 1 && autoSelectSingleInstance
) {
458 String instanceInfo
= instances
.get(0);
459 ModuleIdentification libMi
= WorkspaceProfile
.getModuleId(instanceInfo
);
461 Object
[] row
= {libMi
.getName(), libMi
.getGuid(), libMi
.getVersion(),
462 libMi
.getPackageId().getGuid(), libMi
.getPackageId().getVersion()};
463 if (!ffc
.instanceExistsInModuleSA(moduleKey
, row
[1]+"", row
[2]+"", row
[3]+"", row
[4]+"")) {
464 addLibInstance(libMi
);
465 newInstances
.add(libMi
);
466 docConsole
.setSaved(false);
467 selectedInstancesTableModel
.addRow(row
);
468 addProducedClassFromModule (instanceInfo
);
469 Vector
<LibraryClassDescriptor
> vLcd
= addConsumedClassFromModule(instanceInfo
);
470 for (int i
= 0; i
< vLcd
.size(); ++i
) {
471 LibraryClassDescriptor lcd
= vLcd
.get(i
);
472 if (!lcdStack
.contains(lcd
)) {
478 catch (Exception e
) {
479 if (!errorMsg
.contains(e
.getMessage())) {
480 errorMsg
.add(e
.getMessage());
488 /**Search classProduced map to see if this class has been produced by some instance (module).
492 private boolean isBoundedClass (LibraryClassDescriptor cls
, Vector
<String
> errorMsg
) {
493 // if (this.classProduced.containsKey(cls)) {
496 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
497 while (lcdi
.hasNext()) {
498 LibraryClassDescriptor lcd
= lcdi
.next();
499 if (cls
.className
.equals(lcd
.className
)) {
500 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)) {
504 ArrayList
<String
> producedBy
= this.classProduced
.get(lcd
);
505 String instancesName
= "";
506 for (int i
= 0; i
< producedBy
.size(); ++i
) {
507 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(producedBy
.get(i
));
508 instancesName
+= mi
.getName();
509 instancesName
+= " ";
511 String msg
= new ImproperInstanceException(lcd
.className
, instancesName
, lcd
.supArchs
, lcd
.supModTypes
).getMessage();
512 if (!errorMsg
.contains(msg
)) {
522 private ArrayList
<String
> getInstancesForClass(LibraryClassDescriptor cls
, PackageIdentification
[] depPkgList
){
523 ArrayList
<String
> al
= new ArrayList
<String
>();
525 // for (int i = 0; i < depPkgList.length; ++i) {
526 Iterator ismi
= GlobalData
.vModuleList
.iterator();
527 while(ismi
.hasNext()) {
528 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
529 // if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
532 Vector
<LibraryClassDescriptor
> clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
534 boolean isPotential
= false;
535 Iterator
<LibraryClassDescriptor
> lcdi
= clsProduced
.iterator();
536 while (lcdi
.hasNext()) {
537 LibraryClassDescriptor lcd
= lcdi
.next();
538 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)){
542 if (isPotential
&& hasBeenProduced(lcd
)) {
548 al
.add(mi
.getGuid() + " " + mi
.getVersion() + " " +
549 mi
.getPackageId().getGuid() + " " + mi
.getPackageId().getVersion());
557 private boolean hasBeenProduced (LibraryClassDescriptor cls
) {
558 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
559 while (lcdi
.hasNext()) {
560 LibraryClassDescriptor lcd
= lcdi
.next();
561 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)) {
568 private ArrayList
<String
> getConsumedBy (String className
) {
569 Iterator
<LibraryClassDescriptor
> lcdi
= this.classConsumed
.keySet().iterator();
570 while (lcdi
.hasNext()) {
571 LibraryClassDescriptor lcd
= lcdi
.next();
572 if ((lcd
.className
!= null) && lcd
.className
.equals(className
)) {
573 return this.classConsumed
.get(lcd
);
579 private ArrayList
<String
> getProducedBy (String className
) {
580 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
581 while (lcdi
.hasNext()) {
582 LibraryClassDescriptor lcd
= lcdi
.next();
583 if ((lcd
.className
!= null) && lcd
.className
.equals(className
)) {
584 return this.classProduced
.get(lcd
);
590 // Get class name list related with instanceKey from HashMap m<LibraryClass, ArrayList<instanceKey>>.
592 private ArrayList
<String
> getLibraryClassList (String instanceKey
, HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> m
) {
593 ArrayList
<String
> libraryClass
= new ArrayList
<String
>();
594 Iterator
<LibraryClassDescriptor
> lcdi
= m
.keySet().iterator();
595 while (lcdi
.hasNext()) {
596 LibraryClassDescriptor lcd
= lcdi
.next();
597 if ((m
.get(lcd
) != null) && m
.get(lcd
).contains(instanceKey
)) {
598 libraryClass
.add(lcd
.className
);
604 private void removeInstance(String key
) {
605 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
607 // remove pcd information of instance from current ModuleSA
608 // Note that Pcd data SHOULD be removed prior to library instance
609 // because Multi-Sourced PCD could not be removed, if we remove library instance first,
610 // it will impact the judgement of whether a PCD entry is Multi-Sourced.
612 ffc
.removePcdData(moduleKey
, mi
);
613 ffc
.removeLibraryInstance(moduleKey
, key
);
615 // remove class produced by this instance and add back these produced class to be bound.
617 Vector
<LibraryClassDescriptor
> clsProduced
= getClassProduced(mi
);
618 for (int i
= 0; i
< clsProduced
.size(); ++i
) {
620 classProduced
.remove(clsProduced
.get(i
));
623 // remove class consumed by this instance. we do not need to bound it now.
625 String
[] clsConsumed
= getClassConsumed(mi
);
626 for (int i
= 0; i
< clsConsumed
.length
; ++i
) {
627 ArrayList
<String
> al
= getConsumedBy (clsConsumed
[i
]);
633 if (al
.size() == 0) {
634 ArrayList
<String
> from
= getProducedBy (clsConsumed
[i
]);
638 boolean noUse
= true;
639 for (int j
= 0; j
< from
.size(); ++j
) {
640 ArrayList
<String
> libClasses
= getLibraryClassList(from
.get(j
), classProduced
);
641 for (int k
= 0; k
< libClasses
.size(); ++k
) {
642 if (getConsumedBy (libClasses
.get(k
)) != null && getConsumedBy (libClasses
.get(k
)).size() > 0) {
647 removeInstance(from
.get(j
));
657 private Vector
<LibraryClassDescriptor
> getClassProduced(ModuleIdentification mi
){
659 Vector
<LibraryClassDescriptor
> clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
661 // String[] sClassProduced = new String[clsProduced.size()];
662 // for (int i = 0; i < clsProduced.size(); ++i) {
663 // sClassProduced[i] = clsProduced.get(i).className;
665 // return sClassProduced;
668 private String
[] getClassConsumed(ModuleIdentification mi
){
670 Vector
<LibraryClassDescriptor
> clsConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED", mi
);
671 String
[] sClassConsumed
= new String
[clsConsumed
.size()];
672 for (int i
= 0; i
< clsConsumed
.size(); ++i
) {
673 sClassConsumed
[i
] = clsConsumed
.get(i
).className
;
675 return sClassConsumed
;
678 private void showClassToResolved(){
679 Vector
<String
> errorMsg
= new Vector
<String
>();
680 libClassTableModel
.setRowCount(0);
681 libInstanceTableModel
.setRowCount(0);
682 if (classConsumed
== null || classConsumed
.size() == 0) {
686 Iterator
<LibraryClassDescriptor
> li
= classConsumed
.keySet().iterator();
688 LibraryClassDescriptor lcd
= li
.next();
689 if (classConsumed
.get(lcd
) == null || classConsumed
.get(lcd
).size() == 0) {
693 if (!isBoundedClass(lcd
, errorMsg
)){
695 String
[] s
= { lcd
.className
, lcd
.supArchs
, lcd
.supModTypes
};
696 libClassTableModel
.addRow(s
);
700 if (errorMsg
.size() > 0) {
702 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
703 errors
+= " " + errorMsg
.get(i
) + "\n";
705 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), errors
);
709 private String
getModuleArch () {
711 String
[] moduleInfo
= moduleKey
.split(" ");
712 for (int i
= 4; i
< moduleInfo
.length
; ++i
) {
713 arch
+= moduleInfo
[i
];
718 private void addLibInstance (ModuleIdentification libMi
) throws Exception
{
721 // Add pcd information of selected instance to current moduleSA
723 ffc
.addFrameworkModulesPcdBuildDefs(libMi
, getModuleArch(), ffc
.getModuleSA(moduleKey
));
725 ffc
.genLibraryInstance(libMi
, moduleKey
);
728 * This method initializes this
732 private void initialize() {
733 this.setSize(877, 555);
734 this.setResizable(false);
737 this.setTitle("Module Settings");
738 this.setContentPane(getJContentPane());
742 * This method initializes jContentPane
744 * @return javax.swing.JPanel
746 private JPanel
getJContentPane() {
747 if (jContentPane
== null) {
748 jContentPane
= new JPanel();
749 jContentPane
.setLayout(new BorderLayout());
750 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
751 jContentPane
.add(getJPanelContentPaneSouth(), java
.awt
.BorderLayout
.SOUTH
);
757 * This method initializes jTabbedPane
759 * @return javax.swing.JTabbedPane
761 private JTabbedPane
getJTabbedPane() {
762 if (jTabbedPane
== null) {
763 jTabbedPane
= new JTabbedPane();
764 jTabbedPane
.addTab("PCD Build Definition", null, getJPanelPcd(), null);
765 jTabbedPane
.addTab("Libraries", null, getJPanelLibrary(), null);
766 jTabbedPane
.addTab("FV Info", null, getJPanelModuleSaOpts(), null);
767 jTabbedPane
.addTab("Custom Toolchain", null, getJPanelCustomToolChain(), null);
774 * This method initializes jPanelPcd
776 * @return javax.swing.JPanel
778 private JPanel
getJPanelPcd() {
779 if (jPanelPcd
== null) {
780 jLabelPcdData
= new JLabel();
781 jLabelPcdData
.setText(" PCD Data");
782 jPanelPcd
= new JPanel();
783 jPanelPcd
.setLayout(new BorderLayout());
784 jPanelPcd
.add(jLabelPcdData
, java
.awt
.BorderLayout
.NORTH
);
785 jPanelPcd
.add(getJScrollPaneTablePcd(), java
.awt
.BorderLayout
.CENTER
);
786 jPanelPcd
.add(getJPanelPcdSouth(), java
.awt
.BorderLayout
.SOUTH
);
787 jPanelPcd
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
788 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
789 initPcdBuildDefinition(moduleKey
);
798 * This method initializes jPanelLibrary
800 * @return javax.swing.JPanel
802 private JPanel
getJPanelLibrary() {
803 if (jPanelLibrary
== null) {
804 jPanelLibrary
= new JPanel();
805 jPanelLibrary
.setLayout(new BorderLayout());
806 jPanelLibrary
.add(getJSplitPane(), java
.awt
.BorderLayout
.NORTH
);
807 jPanelLibrary
.add(getJPanelLibrarySouth(), java
.awt
.BorderLayout
.SOUTH
);
808 jPanelLibrary
.add(getJPanelLibraryCenter(), java
.awt
.BorderLayout
.CENTER
);
809 jPanelLibrary
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
810 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
811 initLibraries(moduleKey
);
815 return jPanelLibrary
;
819 * This method initializes jScrollPaneTablePcd
821 * @return javax.swing.JScrollPane
823 private JScrollPane
getJScrollPaneTablePcd() {
824 if (jScrollPaneTablePcd
== null) {
825 jScrollPaneTablePcd
= new JScrollPane();
826 jScrollPaneTablePcd
.setViewportView(getJTablePcd());
828 return jScrollPaneTablePcd
;
832 * This method initializes jTable
834 * @return javax.swing.JTable
836 private JTable
getJTablePcd() {
837 if (jTablePcd
== null) {
838 model
= new IDefaultTableModel();
839 jTablePcd
= new JTable(model
);
840 jTablePcd
.setRowHeight(20);
841 jTablePcd
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_ALL_COLUMNS
);
842 model
.addColumn("CName");
843 model
.addColumn("TokenSpaceGUID");
844 model
.addColumn("ItemType");
845 model
.addColumn("Token");
846 model
.addColumn("MaxDatumSize");
847 model
.addColumn("DataType");
848 model
.addColumn("DefaultValue");
850 jTablePcd
.getColumnModel().getColumn(0).setMinWidth(250);
852 TableColumn tokenColumn
= jTablePcd
.getColumnModel().getColumn(3);
853 jTablePcd
.removeColumn(tokenColumn
);
855 jTablePcd
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
856 jTablePcd
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
857 public void valueChanged(ListSelectionEvent e
) {
859 if (e
.getValueIsAdjusting()){
862 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
863 if (lsm
.isSelectionEmpty()) {
867 int selectedRow
= lsm
.getMinSelectionIndex();
868 String cName
= model
.getValueAt(selectedRow
, 0)+"";
869 String tsGuid
= model
.getValueAt(selectedRow
, 1)+"";
870 String itemType
= model
.getValueAt(selectedRow
, 2)+"";
872 // array for pcd related information: helpText, itemType, moduleType.
874 String
[] pcdInfo
= {"", "", ""};
875 Vector
<String
> validPcdTypes
= new Vector
<String
>();
876 getPcdInfo(moduleKey
, cName
, tsGuid
, pcdInfo
, validPcdTypes
);
877 jTextAreaPcdHelp
.setText(pcdInfo
[0]);
878 initComboBox(pcdInfo
[1], pcdInfo
[2], validPcdTypes
);
879 jComboBoxItemType
.setSelectedItem(itemType
);
880 jTextFieldMaxDatumSize
.setEnabled(true);
881 jTextFieldMaxDatumSize
.setVisible(true);
882 jTextFieldMaxDatumSize
.setText(model
.getValueAt(selectedRow
, 4)+"");
883 jTextFieldPcdDefault
.setEnabled(true);
884 jTextFieldPcdDefault
.setText(model
.getValueAt(selectedRow
, 6)+"");
885 if ((model
.getValueAt(selectedRow
, 5) != null) && model
.getValueAt(selectedRow
, 5).equals("VOID*")) {
886 if (pcdInfo
[1].equals("FEATURE_FLAG")) {
887 jTextFieldMaxDatumSize
.setVisible(false);
889 else if (pcdInfo
[1].equals("FIXED_AT_BUILD")) {
891 jTextFieldMaxDatumSize
.setEnabled(false);
892 jTextFieldMaxDatumSize
.setText(ffc
.setMaxSizeForPointer(model
.getValueAt(selectedRow
, 6)+"")+"");
894 catch(Exception except
){
895 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Unacceptable PCD Value: " + except
.getMessage());
899 jTextFieldMaxDatumSize
.setText(model
.getValueAt(selectedRow
, 4)+"");
903 jTextFieldMaxDatumSize
.setEnabled(false);
906 if (!model
.getValueAt(selectedRow
, 2).equals("DYNAMIC") && !model
.getValueAt(selectedRow
, 2).equals("DYNAMIC_EX")) {
907 jTextFieldPcdDefault
.setText(model
.getValueAt(selectedRow
, 6)+"");
908 if (model
.getValueAt(selectedRow
, 2).equals("FEATURE_FLAG")){
909 jTextFieldPcdDefault
.setVisible(false);
910 jComboBoxFeatureFlagValue
.setVisible(true);
911 jComboBoxFeatureFlagValue
.setSelectedItem(model
.getValueAt(selectedRow
, 6)+"");
914 jTextFieldPcdDefault
.setVisible(true);
915 jTextFieldPcdDefault
.setEnabled(true);
916 jComboBoxFeatureFlagValue
.setVisible(false);
920 jTextFieldPcdDefault
.setEnabled(false);
932 private void initComboBox(String originalType
, String mType
, Vector
<String
> validPcdTypes
) {
933 jComboBoxItemType
.removeAllItems();
935 if (originalType
.equals("DYNAMIC")) {
936 for (int i
= 0; i
< validPcdTypes
.size(); ++i
) {
937 jComboBoxItemType
.addItem(validPcdTypes
.get(i
));
941 jComboBoxItemType
.addItem(originalType
);
948 * @param sa sa[0]: HelpText; sa[1]: itemType in Msa; sa[2]: isBinary;
950 private void getPcdInfo(String moduleKey
, String cName
, String tsGuid
, String
[] sa
, Vector
<String
> validPcdTypes
) {
951 String
[][] saa
= new String
[ffc
.getLibraryInstancesCount(moduleKey
)][5];
952 ffc
.getLibraryInstances(moduleKey
, saa
);
955 if (ffc
.getPcdBuildDataInfo(WorkspaceProfile
.getModuleId(moduleKey
), cName
, tsGuid
, sa
, validPcdTypes
)) {
958 for (int j
= 0; j
< saa
.length
; ++j
) {
959 if (ffc
.getPcdBuildDataInfo(WorkspaceProfile
.getModuleId(saa
[j
][1] + " " + saa
[j
][2] + " " + saa
[j
][3] + " " + saa
[j
][4]),
960 cName
, tsGuid
, sa
, validPcdTypes
)) {
966 JOptionPane
.showMessageDialog(this, "Get PCD details fail: " + e
.getMessage());
971 * This method initializes jPanelPcdSouth
973 * @return javax.swing.JPanel
975 private JPanel
getJPanelPcdSouth() {
976 if (jPanelPcdSouth
== null) {
977 jLabelPcdHelp
= new JLabel();
978 jLabelPcdHelp
.setText("PCD Description");
979 jPanelPcdSouth
= new JPanel();
980 jPanelPcdSouth
.setPreferredSize(new java
.awt
.Dimension(607,200));
981 jPanelPcdSouth
.add(jLabelPcdHelp
, null);
982 jPanelPcdSouth
.add(getJScrollPanePcdHelp(), null);
983 jPanelPcdSouth
.add(getJPanelPcdFields(), null);
985 return jPanelPcdSouth
;
989 * This method initializes jScrollPanePcdHelp
991 * @return javax.swing.JScrollPane
993 private JScrollPane
getJScrollPanePcdHelp() {
994 if (jScrollPanePcdHelp
== null) {
995 jScrollPanePcdHelp
= new JScrollPane();
996 jScrollPanePcdHelp
.setPreferredSize(new java
.awt
.Dimension(500,100));
997 jScrollPanePcdHelp
.setViewportView(getJTextAreaPcdHelp());
999 return jScrollPanePcdHelp
;
1003 * This method initializes jTextAreaPcdHelp
1005 * @return javax.swing.JTextArea
1007 private JTextArea
getJTextAreaPcdHelp() {
1008 if (jTextAreaPcdHelp
== null) {
1009 jTextAreaPcdHelp
= new JTextArea();
1010 jTextAreaPcdHelp
.setEditable(false);
1012 return jTextAreaPcdHelp
;
1016 * This method initializes jPanelContentPaneSouth
1018 * @return javax.swing.JPanel
1020 private JPanel
getJPanelContentPaneSouth() {
1021 if (jPanelContentPaneSouth
== null) {
1022 FlowLayout flowLayout
= new FlowLayout();
1023 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
1024 jPanelContentPaneSouth
= new JPanel();
1025 jPanelContentPaneSouth
.setLayout(flowLayout
);
1026 jPanelContentPaneSouth
.add(getJButtonOk(), null);
1027 jPanelContentPaneSouth
.add(getJButtonCancel(), null);
1029 return jPanelContentPaneSouth
;
1033 * This method initializes jSplitPane
1035 * @return javax.swing.JSplitPane
1037 private JSplitPane
getJSplitPane() {
1038 if (jSplitPane
== null) {
1039 jSplitPane
= new JSplitPane();
1040 jSplitPane
.setDividerLocation(200);
1041 jSplitPane
.setLeftComponent(getJPanelLibraryLeft());
1042 jSplitPane
.setRightComponent(getJPanelLibraryRight());
1043 jSplitPane
.setPreferredSize(new java
.awt
.Dimension(202,200));
1049 * This method initializes jPanelLibraryLeft
1051 * @return javax.swing.JPanel
1053 private JPanel
getJPanelLibraryLeft() {
1054 if (jPanelLibraryLeft
== null) {
1055 jLabelLibClass
= new JLabel();
1056 jLabelLibClass
.setText("Library Classes Uninstantiated");
1057 jPanelLibraryLeft
= new JPanel();
1058 jPanelLibraryLeft
.add(jLabelLibClass
, null);
1059 jPanelLibraryLeft
.add(getJScrollPaneLibClass(), null);
1061 return jPanelLibraryLeft
;
1065 * This method initializes jPanelLibraryRight
1067 * @return javax.swing.JPanel
1069 private JPanel
getJPanelLibraryRight() {
1070 if (jPanelLibraryRight
== null) {
1071 jLabelQualifiedInstance
= new JLabel();
1072 jLabelQualifiedInstance
.setText("Instances Available");
1073 jPanelLibraryRight
= new JPanel();
1074 jPanelLibraryRight
.add(jLabelQualifiedInstance
, null);
1075 jPanelLibraryRight
.add(getJScrollPaneQualifiedInstance(), null);
1077 return jPanelLibraryRight
;
1081 * This method initializes jScrollPaneSelectedInstances
1083 * @return javax.swing.JScrollPane
1085 private JScrollPane
getJScrollPaneSelectedInstances() {
1086 if (jScrollPaneSelectedInstances
== null) {
1087 jScrollPaneSelectedInstances
= new JScrollPane();
1088 jScrollPaneSelectedInstances
.setPreferredSize(new java
.awt
.Dimension(600,150));
1089 jScrollPaneSelectedInstances
.setViewportView(getJTableSelectedInstances());
1091 return jScrollPaneSelectedInstances
;
1095 * This method initializes jTableSelectedInstances
1097 * @return javax.swing.JTable
1099 private JTable
getJTableSelectedInstances() {
1100 if (jTableSelectedInstances
== null) {
1101 selectedInstancesTableModel
= new IDefaultTableModel();
1102 selectedInstancesTableModel
.addColumn("Name");
1103 selectedInstancesTableModel
.addColumn("ModuleGUID");
1104 selectedInstancesTableModel
.addColumn("ModuleVersion");
1105 selectedInstancesTableModel
.addColumn("PackageGUID");
1106 selectedInstancesTableModel
.addColumn("PackageVersion");
1107 jTableSelectedInstances
= new JTable(selectedInstancesTableModel
);
1108 jTableSelectedInstances
.setRowHeight(20);
1110 jTableSelectedInstances
.getColumnModel().getColumn(0).setMinWidth(250);
1112 jTableSelectedInstances
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_SUBSEQUENT_COLUMNS
);
1113 jTableSelectedInstances
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1116 return jTableSelectedInstances
;
1120 * This method initializes jScrollPaneLibClass
1122 * @return javax.swing.JScrollPane
1124 private JScrollPane
getJScrollPaneLibClass() {
1125 if (jScrollPaneLibClass
== null) {
1126 jScrollPaneLibClass
= new JScrollPane();
1127 jScrollPaneLibClass
.setPreferredSize(new java
.awt
.Dimension(200,170));
1128 jScrollPaneLibClass
.setViewportView(getJTableLibClass());
1130 return jScrollPaneLibClass
;
1134 * This method initializes jTableLibClass
1136 * @return javax.swing.JTable
1138 private JTable
getJTableLibClass() {
1139 if (jTableLibClass
== null) {
1140 libClassTableModel
= new IDefaultTableModel();
1141 libClassTableModel
.addColumn("LibraryClass");
1142 libClassTableModel
.addColumn("Arch");
1143 libClassTableModel
.addColumn("ModType");
1144 jTableLibClass
= new JTable(libClassTableModel
);
1145 jTableLibClass
.setRowHeight(20);
1146 jTableLibClass
.setShowGrid(false);
1147 jTableLibClass
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1149 TableColumn column
= jTableLibClass
.getColumnModel().getColumn(1);
1150 jTableLibClass
.getColumnModel().removeColumn(column
);
1151 column
= jTableLibClass
.getColumnModel().getColumn(1);
1152 jTableLibClass
.getColumnModel().removeColumn(column
);
1154 jTableLibClass
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
1155 public void valueChanged(ListSelectionEvent e
) {
1156 if (e
.getValueIsAdjusting()){
1159 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
1160 if (lsm
.isSelectionEmpty()) {
1164 int selectedRow2
= lsm
.getMinSelectionIndex();
1165 if (selectedRow2
< 0) {
1169 // display potential lib instances according to class selection
1171 libInstanceTableModel
.setRowCount(0);
1172 String cls
= libClassTableModel
.getValueAt(selectedRow2
, 0).toString();
1173 String arch
= libClassTableModel
.getValueAt(selectedRow2
, 1).toString();
1174 String modType
= libClassTableModel
.getValueAt(selectedRow2
, 2).toString();
1175 LibraryClassDescriptor lcd
= new LibraryClassDescriptor(cls
, arch
, modType
);
1176 ArrayList
<String
> al
= classInstanceMap
.get(lcd
);
1178 al
= getInstancesForClass(lcd
, null);
1179 if (al
.size() != 0) {
1180 classInstanceMap
.put(lcd
, al
);
1184 ListIterator
<String
> li
= al
.listIterator();
1185 while(li
.hasNext()) {
1186 String instance
= li
.next();
1187 String
[] s
= {"", "", "", "", ""};
1188 if (WorkspaceProfile
.getModuleId(instance
) != null) {
1189 s
[0] = WorkspaceProfile
.getModuleId(instance
).getName();
1192 String
[] instancePart
= instance
.split(" ");
1193 for (int i
= 0; i
< instancePart
.length
; ++i
){
1194 s
[i
+1] = instancePart
[i
];
1196 libInstanceTableModel
.addRow(s
);
1203 return jTableLibClass
;
1207 * This method initializes jScrollPaneQualifiedInstance
1209 * @return javax.swing.JScrollPane
1211 private JScrollPane
getJScrollPaneQualifiedInstance() {
1212 if (jScrollPaneQualifiedInstance
== null) {
1213 jScrollPaneQualifiedInstance
= new JScrollPane();
1214 jScrollPaneQualifiedInstance
.setPreferredSize(new java
.awt
.Dimension(600,170));
1215 jScrollPaneQualifiedInstance
.setViewportView(getJTableLibInstances());
1217 return jScrollPaneQualifiedInstance
;
1221 * This method initializes jTableLibInstances
1223 * @return javax.swing.JTable
1225 private JTable
getJTableLibInstances() {
1226 if (jTableLibInstances
== null) {
1227 libInstanceTableModel
= new IDefaultTableModel();
1228 libInstanceTableModel
.addColumn("Name");
1229 libInstanceTableModel
.addColumn("ModuleGUID");
1230 libInstanceTableModel
.addColumn("ModuleVersion");
1231 libInstanceTableModel
.addColumn("PackageGUID");
1232 libInstanceTableModel
.addColumn("PackageVersion");
1233 jTableLibInstances
= new JTable(libInstanceTableModel
);
1234 jTableLibInstances
.setRowHeight(20);
1236 jTableLibInstances
.getColumnModel().getColumn(0).setMinWidth(250);
1238 jTableLibInstances
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_SUBSEQUENT_COLUMNS
);
1239 jTableLibInstances
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1242 return jTableLibInstances
;
1246 * This method initializes jPanelLibrarySouth
1248 * @return javax.swing.JPanel
1250 private JPanel
getJPanelLibrarySouth() {
1251 if (jPanelLibrarySouth
== null) {
1252 jPanelLibrarySouth
= new JPanel();
1254 return jPanelLibrarySouth
;
1258 * This method initializes jPanelLibraryCenter
1260 * @return javax.swing.JPanel
1262 private JPanel
getJPanelLibraryCenter() {
1263 if (jPanelLibraryCenter
== null) {
1264 jLabelInstanceHelp
= new JLabel();
1265 jLabelInstanceHelp
.setText("Instance Description");
1266 jLabelSelectedInstances
= new JLabel();
1267 jLabelSelectedInstances
.setText("Selected Instances");
1268 jPanelLibraryCenter
= new JPanel();
1269 jPanelLibraryCenter
.setLayout(new BorderLayout());
1271 jPanelLibraryCenter
.add(getJPanelLibraryCenterC(), java
.awt
.BorderLayout
.CENTER
);
1272 jPanelLibraryCenter
.add(getJPanelLibraryCenterN(), java
.awt
.BorderLayout
.NORTH
);
1275 return jPanelLibraryCenter
;
1279 * This method initializes jScrollPaneInstanceHelp
1281 * @return javax.swing.JScrollPane
1283 private JScrollPane
getJScrollPaneInstanceHelp() {
1284 if (jScrollPaneInstanceHelp
== null) {
1285 jScrollPaneInstanceHelp
= new JScrollPane();
1286 jScrollPaneInstanceHelp
.setPreferredSize(new java
.awt
.Dimension(400,50));
1287 jScrollPaneInstanceHelp
.setViewportView(getJTextAreaInstanceHelp());
1289 return jScrollPaneInstanceHelp
;
1293 * This method initializes jTextAreaInstanceHelp
1295 * @return javax.swing.JTextArea
1297 private JTextArea
getJTextAreaInstanceHelp() {
1298 if (jTextAreaInstanceHelp
== null) {
1299 jTextAreaInstanceHelp
= new JTextArea();
1300 jTextAreaInstanceHelp
.setEditable(false);
1302 return jTextAreaInstanceHelp
;
1306 * This method initializes jButtonAdd
1308 * @return javax.swing.JButton
1310 private JButton
getJButtonAdd() {
1311 if (jButtonAdd
== null) {
1312 jButtonAdd
= new JButton();
1313 jButtonAdd
.setPreferredSize(new java
.awt
.Dimension(80,20));
1314 jButtonAdd
.setText("Add");
1315 jButtonAdd
.addActionListener(new java
.awt
.event
.ActionListener() {
1316 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1317 int row
= jTableLibInstances
.getSelectedRow();
1322 String libInstanceKey
= libInstanceTableModel
.getValueAt(row
, 1) + " " +
1323 libInstanceTableModel
.getValueAt(row
, 2) + " " +
1324 libInstanceTableModel
.getValueAt(row
, 3) + " " +
1325 libInstanceTableModel
.getValueAt(row
, 4);
1326 ModuleIdentification libMi
= WorkspaceProfile
.getModuleId(libInstanceKey
);
1328 addLibInstance (libMi
);
1330 catch (Exception exception
) {
1331 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Adding Instance " + libMi
.getName() + " : \n"+ exception
.getMessage());
1334 docConsole
.setSaved(false);
1335 Object
[] s
= {libInstanceTableModel
.getValueAt(row
, 0), libInstanceTableModel
.getValueAt(row
, 1),
1336 libInstanceTableModel
.getValueAt(row
, 2), libInstanceTableModel
.getValueAt(row
, 3),
1337 libInstanceTableModel
.getValueAt(row
, 4)};
1338 selectedInstancesTableModel
.addRow(s
);
1340 Vector
<LibraryClassDescriptor
> vLcd
= addConsumedClassFromModule (libInstanceKey
);
1341 addProducedClassFromModule (libInstanceKey
);
1343 Vector
<String
> errorMsg
= new Vector
<String
>();
1344 Vector
<ModuleIdentification
> newInstances
= new Vector
<ModuleIdentification
>();
1345 Stack
<LibraryClassDescriptor
> lcdStack
= new Stack
<LibraryClassDescriptor
>();
1346 for (int i
= 0; i
< vLcd
.size(); ++i
) {
1347 LibraryClassDescriptor lcd
= vLcd
.get(i
);
1348 if (!lcdStack
.contains(lcd
)) {
1353 resolveLibraryInstances(lcdStack
, true, errorMsg
, newInstances
);
1355 catch (Exception exp
) {
1356 JOptionPane
.showMessageDialog(FpdModuleSA
.this, exp
.getMessage());
1359 showClassToResolved();
1361 if (errorMsg
.size() > 0) {
1363 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
1364 errors
+= " " + errorMsg
.get(i
) + "\n";
1366 JOptionPane
.showMessageDialog(FpdModuleSA
.this, errors
);
1375 * This method initializes jButton1
1377 * @return javax.swing.JButton
1379 private JButton
getJButtonDeleteInstance() {
1380 if (jButtonDeleteInstance
== null) {
1381 jButtonDeleteInstance
= new JButton();
1382 jButtonDeleteInstance
.setPreferredSize(new java
.awt
.Dimension(80,20));
1383 jButtonDeleteInstance
.setText("Delete");
1384 jButtonDeleteInstance
.addActionListener(new java
.awt
.event
.ActionListener() {
1385 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1386 int row
= jTableSelectedInstances
.getSelectedRow();
1390 docConsole
.setSaved(false);
1391 String instanceKey
= selectedInstancesTableModel
.getValueAt(row
, 1) + " "
1392 + selectedInstancesTableModel
.getValueAt(row
, 2) + " "
1393 + selectedInstancesTableModel
.getValueAt(row
, 3) + " "
1394 + selectedInstancesTableModel
.getValueAt(row
, 4);
1395 removeInstance(instanceKey
);
1397 selectedInstancesTableModel
.setRowCount(0);
1398 int instanceCount
= ffc
.getLibraryInstancesCount(moduleKey
);
1399 if (instanceCount
!= 0) {
1400 String
[][] saa
= new String
[instanceCount
][5];
1401 ffc
.getLibraryInstances(moduleKey
, saa
);
1402 for (int i
= 0; i
< saa
.length
; ++i
) {
1403 String libInstanceKey
= saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4];
1404 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(libInstanceKey
);
1407 // ToDo: verify this instance first.
1409 saa
[i
][0] = mi
.getName();
1410 saa
[i
][2] = mi
.getVersion();
1411 saa
[i
][4] = mi
.getPackageId().getVersion();
1412 selectedInstancesTableModel
.addRow(saa
[i
]);
1416 showClassToResolved();
1420 return jButtonDeleteInstance
;
1424 * This method initializes jButton2
1426 * @return javax.swing.JButton
1428 private JButton
getJButtonOk() {
1429 if (jButtonOk
== null) {
1430 jButtonOk
= new JButton();
1431 jButtonOk
.setPreferredSize(new java
.awt
.Dimension(80,20));
1432 jButtonOk
.setText("Close");
1433 jButtonOk
.addActionListener(this);
1439 * This method initializes jButton3
1441 * @return javax.swing.JButton
1443 private JButton
getJButtonCancel() {
1444 if (jButtonCancel
== null) {
1445 jButtonCancel
= new JButton();
1446 jButtonCancel
.setPreferredSize(new java
.awt
.Dimension(80,20));
1447 jButtonCancel
.setText("Cancel");
1448 jButtonCancel
.setVisible(false);
1450 return jButtonCancel
;
1452 public void actionPerformed(ActionEvent arg0
) {
1454 if (arg0
.getSource() == jButtonOk
) {
1455 if (jTableModuleSaOptions
.isEditing()) {
1456 jTableModuleSaOptions
.getCellEditor().stopCellEditing();
1458 this.setVisible(false);
1462 * This method initializes jPanelModuleSaOpts
1464 * @return javax.swing.JPanel
1466 private JPanel
getJPanelModuleSaOpts() {
1467 if (jPanelModuleSaOpts
== null) {
1468 FlowLayout flowLayout4
= new FlowLayout();
1469 flowLayout4
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1470 jLabelFfsFormatKey
= new JLabel();
1471 jLabelFfsFormatKey
.setText("FFS Format Key");
1472 jLabelFfsFormatKey
.setPreferredSize(new java
.awt
.Dimension(90,16));
1473 jLabelFfsFileGuid
= new JLabel();
1474 jLabelFfsFileGuid
.setText("FFS File GUID");
1475 jLabelFfsFileGuid
.setPreferredSize(new java
.awt
.Dimension(90,16));
1476 jLabelFfsFileGuid
.setVisible(false);
1477 jLabelFvBinding
= new JLabel();
1478 jLabelFvBinding
.setText("FV Binding");
1479 jLabelFvBinding
.setPreferredSize(new java
.awt
.Dimension(90,16));
1480 jPanelModuleSaOpts
= new JPanel();
1481 jPanelModuleSaOpts
.setLayout(flowLayout4
);
1482 jPanelModuleSaOpts
.add(jLabelFvBinding
, null);
1483 jPanelModuleSaOpts
.add(getJTextFieldFvBinding(), null);
1484 jPanelModuleSaOpts
.add(jLabelFfsFileGuid
, null);
1485 jPanelModuleSaOpts
.add(getJTextFieldFileGuid(), null);
1486 jPanelModuleSaOpts
.add(jLabelFfsFormatKey
, null);
1487 jPanelModuleSaOpts
.add(getJTextFieldFfsKey(), null);
1488 jPanelModuleSaOpts
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
1489 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
1490 initFvInfo(moduleKey
);
1494 return jPanelModuleSaOpts
;
1497 private Vector
<String
> getVectorFromString (String s
) {
1498 if (s
== null || s
.equals("null")) {
1501 String
[] sa1
= s
.split(" ");
1502 Vector
<String
> v
= new Vector
<String
>();
1503 for (int i
= 0; i
< sa1
.length
; ++i
) {
1510 * This method initializes jTextField
1512 * @return javax.swing.JTextField
1514 private JTextField
getJTextFieldFvBinding() {
1515 if (jTextFieldFvBinding
== null) {
1516 jTextFieldFvBinding
= new JTextField();
1517 jTextFieldFvBinding
.setPreferredSize(new java
.awt
.Dimension(400,20));
1518 jTextFieldFvBinding
.setEditable(true);
1519 jTextFieldFvBinding
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1520 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1521 String originalFvBinding
= ffc
.getFvBinding(moduleKey
);
1522 String newFvBinding
= jTextFieldFvBinding
.getText();
1523 if (newFvBinding
.equals(originalFvBinding
)) {
1526 if (newFvBinding
.length() == 0 && originalFvBinding
== null) {
1530 Vector
<String
> oldFvList
= getVectorFromString (originalFvBinding
);
1531 Vector
<String
> newFvList
= getVectorFromString (newFvBinding
);
1532 String moduleInfo
[] = moduleKey
.split(" ");
1533 ffc
.setFvBinding(moduleKey
, newFvBinding
);
1535 // remove module from Fvs that not in newFvList now.
1537 oldFvList
.removeAll(newFvList
);
1538 for (int j
= 0; j
< oldFvList
.size(); ++j
) {
1539 ffc
.removeModuleInBuildOptionsUserExtensions(oldFvList
.get(j
), "IMAGES", "1", moduleInfo
[0], moduleInfo
[1], moduleInfo
[2], moduleInfo
[3], moduleInfo
[4]);
1542 // add module to Fvs that were not in oldFvList.
1544 oldFvList
= getVectorFromString (originalFvBinding
);
1545 newFvList
.removeAll(oldFvList
);
1546 for (int i
= 0; i
< newFvList
.size(); ++i
) {
1547 ffc
.addModuleIntoBuildOptionsUserExtensions(newFvList
.get(i
), "IMAGES", "1", moduleInfo
[0], moduleInfo
[1], moduleInfo
[2], moduleInfo
[3], moduleInfo
[4]);
1549 docConsole
.setSaved(false);
1554 return jTextFieldFvBinding
;
1557 * This method initializes jTextField1
1559 * @return javax.swing.JTextField
1561 private JTextField
getJTextFieldFileGuid() {
1562 if (jTextFieldFileGuid
== null) {
1563 jTextFieldFileGuid
= new JTextField();
1564 jTextFieldFileGuid
.setPreferredSize(new java
.awt
.Dimension(300,20));
1565 jTextFieldFileGuid
.setVisible(false);
1566 jTextFieldFileGuid
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1567 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1568 String originalFileGuid
= ffc
.getFfsFileNameGuid(moduleKey
);
1569 String newFileGuid
= jTextFieldFileGuid
.getText();
1570 if (newFileGuid
.equals(originalFileGuid
)) {
1573 if (newFileGuid
.length() == 0 && originalFileGuid
== null) {
1576 if (newFileGuid
.length() > 0) {
1577 if (!DataValidation
.isGuid(newFileGuid
)) {
1578 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "FFS File Guid is NOT GUID Type.");
1583 docConsole
.setSaved(false);
1584 if (newFileGuid
.length() == 0) {
1587 ffc
.setFfsFileNameGuid(moduleKey
, newFileGuid
);
1592 return jTextFieldFileGuid
;
1595 * This method initializes jTextFieldFfsKey
1597 * @return javax.swing.JTextField
1599 private JTextField
getJTextFieldFfsKey() {
1600 if (jTextFieldFfsKey
== null) {
1601 jTextFieldFfsKey
= new JTextField();
1602 jTextFieldFfsKey
.setPreferredSize(new java
.awt
.Dimension(250,20));
1603 jTextFieldFfsKey
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1604 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1605 String originalFfsKey
= ffc
.getFfsFormatKey(moduleKey
);
1606 String newFfsKey
= jTextFieldFfsKey
.getText();
1607 if (newFfsKey
.equals(originalFfsKey
)) {
1610 if (newFfsKey
.length() == 0 && originalFfsKey
== null) {
1613 docConsole
.setSaved(false);
1614 ffc
.setFfsFormatKey(moduleKey
, newFfsKey
);
1619 return jTextFieldFfsKey
;
1622 * This method initializes jScrollPaneModuleSaOptions
1624 * @return javax.swing.JScrollPane
1626 private JScrollPane
getJScrollPaneModuleSaOptions() {
1627 if (jScrollPaneModuleSaOptions
== null) {
1628 jScrollPaneModuleSaOptions
= new JScrollPane();
1629 jScrollPaneModuleSaOptions
.setPreferredSize(new java
.awt
.Dimension(600,350));
1630 jScrollPaneModuleSaOptions
.setViewportView(getJTableModuleSaOptions());
1632 return jScrollPaneModuleSaOptions
;
1635 * This method initializes jTableModuleSaOptions
1637 * @return javax.swing.JTable
1639 private JTable
getJTableModuleSaOptions() {
1640 if (jTableModuleSaOptions
== null) {
1641 optionsTableModel
= new DefaultTableModel();
1642 optionsTableModel
.addColumn("BuildTargets");
1643 optionsTableModel
.addColumn("ToolChainFamily");
1644 optionsTableModel
.addColumn("TagName");
1645 optionsTableModel
.addColumn("ToolCode");
1646 optionsTableModel
.addColumn("SupportedArchs");
1647 optionsTableModel
.addColumn("Contents");
1648 jTableModuleSaOptions
= new JTable(optionsTableModel
);
1649 jTableModuleSaOptions
.setRowHeight(20);
1651 jTableModuleSaOptions
.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth
);
1652 jTableModuleSaOptions
.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth
);
1653 jTableModuleSaOptions
.getColumnModel().getColumn(2).setMinWidth(tagNameWidth
);
1654 jTableModuleSaOptions
.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth
);
1655 jTableModuleSaOptions
.getColumnModel().getColumn(4).setMinWidth(supportArchWidth
);
1656 jTableModuleSaOptions
.getColumnModel().getColumn(5).setMinWidth(argWidth
);
1657 // javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);
1658 // JComboBox cb = new JComboBox();
1659 // cb.addItem("MSFT");
1660 // cb.addItem("GCC");
1661 // cb.addItem("CYGWIN");
1662 // cb.addItem("INTEL");
1663 // cb.addItem("USER_DEFINED");
1664 // toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1666 Vector
<String
> vArch
= new Vector
<String
>();
1673 jTableModuleSaOptions
.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch
, FrameworkWizardUI
.getInstance()));
1675 jTableModuleSaOptions
.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI
.getInstance()));
1677 jTableModuleSaOptions
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1678 jTableModuleSaOptions
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_OFF
);
1679 jTableModuleSaOptions
.getModel().addTableModelListener(new TableModelListener() {
1680 public void tableChanged(TableModelEvent arg0
) {
1681 // TODO Auto-generated method stub
1682 int row
= arg0
.getFirstRow();
1683 TableModel m
= (TableModel
)arg0
.getSource();
1685 if (arg0
.getType() == TableModelEvent
.UPDATE
){
1686 //ToDo Data Validition check.
1687 String targets
= m
.getValueAt(row
, 0) + "";
1688 Vector
<Object
> targetName
= null;
1689 if (targets
.length() > 0) {
1690 targetName
= new Vector
<Object
>();
1691 String
[] sArray
= targets
.split(" ");
1692 for (int i
= 0; i
< sArray
.length
; ++i
) {
1693 targetName
.add(sArray
[i
]);
1697 String toolChain
= m
.getValueAt(row
, 1) + "";
1698 String tagName
= m
.getValueAt(row
, 2) + "";
1699 String toolCode
= m
.getValueAt(row
, 3) + "";
1700 String archs
= m
.getValueAt(row
, 4) + "";
1701 Vector
<Object
> supArch
= null;
1702 if (archs
.length() > 0) {
1703 supArch
= new Vector
<Object
>();
1704 String
[] sArray1
= archs
.split(" ");
1705 for (int i
= 0; i
< sArray1
.length
; ++i
) {
1706 supArch
.add(sArray1
[i
]);
1710 String contents
= m
.getValueAt(row
, 5) + "";
1711 docConsole
.setSaved(false);
1712 ffc
.updateModuleSAOptionsOpt(moduleKey
, row
, targetName
, toolChain
, tagName
, toolCode
, supArch
, contents
);
1717 return jTableModuleSaOptions
;
1720 * This method initializes jButtonNew
1722 * @return javax.swing.JButton
1724 private JButton
getJButtonNew() {
1725 if (jButtonNew
== null) {
1726 jButtonNew
= new JButton();
1727 jButtonNew
.setPreferredSize(new java
.awt
.Dimension(80,20));
1728 jButtonNew
.setText("New");
1729 jButtonNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1730 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1731 String
[] row
= {"", "", "", "", "", ""};
1732 optionsTableModel
.addRow(row
);
1733 Vector
<Object
> v
= null;
1734 Vector
<Object
> v1
= null;
1735 docConsole
.setSaved(false);
1736 ffc
.genModuleSAOptionsOpt(moduleKey
, v
, "", "", "", v1
, "");
1743 * This method initializes jButtonDelete
1745 * @return javax.swing.JButton
1747 private JButton
getJButtonDeleteOption() {
1748 if (jButtonDeleteOption
== null) {
1749 jButtonDeleteOption
= new JButton();
1750 jButtonDeleteOption
.setPreferredSize(new java
.awt
.Dimension(80,20));
1751 jButtonDeleteOption
.setText("Delete");
1752 jButtonDeleteOption
.addActionListener(new java
.awt
.event
.ActionListener() {
1753 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1754 if (jTableModuleSaOptions
.getSelectedRow() < 0) {
1757 docConsole
.setSaved(false);
1758 ffc
.removeModuleSAOptionsOpt(moduleKey
, jTableModuleSaOptions
.getSelectedRow());
1759 optionsTableModel
.removeRow(jTableModuleSaOptions
.getSelectedRow());
1763 return jButtonDeleteOption
;
1767 Start the window at the center of screen
1770 protected void centerWindow(int intWidth
, int intHeight
) {
1771 Dimension d
= Toolkit
.getDefaultToolkit().getScreenSize();
1772 this.setLocation((d
.width
- intWidth
) / 2, (d
.height
- intHeight
) / 2);
1776 Start the window at the center of screen
1779 protected void centerWindow() {
1780 centerWindow(this.getSize().width
, this.getSize().height
);
1783 * This method initializes jPanelPcdFields
1785 * @return javax.swing.JPanel
1787 private JPanel
getJPanelPcdFields() {
1788 if (jPanelPcdFields
== null) {
1789 GridLayout gridLayout
= new GridLayout();
1790 gridLayout
.setRows(3);
1791 gridLayout
.setColumns(2);
1792 jPanelPcdFields
= new JPanel();
1793 jPanelPcdFields
.setLayout(gridLayout
);
1794 jPanelPcdFields
.setPreferredSize(new java
.awt
.Dimension(600,90));
1795 jPanelPcdFields
.add(getJPanelPcdFieldsFirstRow(), null);
1796 jPanelPcdFields
.add(getJPanelPcdFieldsSecondRow(), null);
1797 jPanelPcdFields
.add(getJPanelPcdFieldsThirdRow(), null);
1799 return jPanelPcdFields
;
1802 * This method initializes jPanelPcdFieldsSecondRow
1804 * @return javax.swing.JPanel
1806 private JPanel
getJPanelPcdFieldsSecondRow() {
1807 if (jPanelPcdFieldsSecondRow
== null) {
1808 FlowLayout flowLayout2
= new FlowLayout();
1809 flowLayout2
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1810 jLabelMaxDatumSize
= new JLabel();
1811 jLabelMaxDatumSize
.setText("Max Datum Size");
1812 jPanelPcdFieldsSecondRow
= new JPanel();
1813 jPanelPcdFieldsSecondRow
.setLayout(flowLayout2
);
1814 jPanelPcdFieldsSecondRow
.add(jLabelMaxDatumSize
, null);
1815 jPanelPcdFieldsSecondRow
.add(getJTextFieldMaxDatumSize(), null);
1817 return jPanelPcdFieldsSecondRow
;
1820 * This method initializes jPanelPcdFieldsThirdRow
1822 * @return javax.swing.JPanel
1824 private JPanel
getJPanelPcdFieldsThirdRow() {
1825 if (jPanelPcdFieldsThirdRow
== null) {
1826 FlowLayout flowLayout3
= new FlowLayout();
1827 flowLayout3
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1828 jLabelPcdDefaultValue
= new JLabel();
1829 jLabelPcdDefaultValue
.setText("Default Value");
1830 jLabelPcdDefaultValue
.setPreferredSize(new java
.awt
.Dimension(91,16));
1831 jPanelPcdFieldsThirdRow
= new JPanel();
1832 jPanelPcdFieldsThirdRow
.setLayout(flowLayout3
);
1833 jPanelPcdFieldsThirdRow
.add(jLabelPcdDefaultValue
, null);
1834 jPanelPcdFieldsThirdRow
.add(getJTextFieldPcdDefault(), null);
1835 jPanelPcdFieldsThirdRow
.add(getJComboBoxFeatureFlagValue(), null);
1836 jPanelPcdFieldsThirdRow
.add(getJButtonUpdatePcd(), null);
1838 return jPanelPcdFieldsThirdRow
;
1841 * This method initializes jPanelPcdFieldsFirstRow
1843 * @return javax.swing.JPanel
1845 private JPanel
getJPanelPcdFieldsFirstRow() {
1846 if (jPanelPcdFieldsFirstRow
== null) {
1847 FlowLayout flowLayout1
= new FlowLayout();
1848 flowLayout1
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1849 jLabelItemType
= new JLabel();
1850 jLabelItemType
.setText("Item Type");
1851 jLabelItemType
.setPreferredSize(new java
.awt
.Dimension(91,16));
1852 jPanelPcdFieldsFirstRow
= new JPanel();
1853 jPanelPcdFieldsFirstRow
.setLayout(flowLayout1
);
1854 jPanelPcdFieldsFirstRow
.add(jLabelItemType
, null);
1855 jPanelPcdFieldsFirstRow
.add(getJComboBoxItemType(), null);
1857 return jPanelPcdFieldsFirstRow
;
1860 * This method initializes jComboBoxItemType
1862 * @return javax.swing.JComboBox
1864 private JComboBox
getJComboBoxItemType() {
1865 if (jComboBoxItemType
== null) {
1866 jComboBoxItemType
= new JComboBox();
1867 jComboBoxItemType
.setPreferredSize(new java
.awt
.Dimension(200,20));
1868 jComboBoxItemType
.addItemListener(new java
.awt
.event
.ItemListener() {
1869 public void itemStateChanged(java
.awt
.event
.ItemEvent e
) {
1871 int row
= jTablePcd
.getSelectedRow();
1876 if (jComboBoxItemType
.getSelectedItem() != null && jComboBoxItemType
.getSelectedItem().equals("FIXED_AT_BUILD")) {
1877 jTextFieldPcdDefault
.setEnabled(true);
1880 jTextFieldPcdDefault
.setEnabled(false);
1885 return jComboBoxItemType
;
1888 private void pcdDynamicToNonDynamic(String cName
, String tsGuid
) {
1889 String
[][] saa
= new String
[ffc
.getDynamicPcdBuildDataCount()][5];
1890 ffc
.getDynamicPcdBuildData(saa
);
1891 String maxSize
= "";
1893 for (int i
= 0; i
< saa
.length
; ++i
) {
1894 if (saa
[i
][0].equals(cName
) && saa
[i
][2].equals(tsGuid
)) {
1895 maxSize
= saa
[i
][3];
1896 value
= ffc
.getDynamicPcdBuildDataValue(i
);
1901 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1902 for (int i
= 0; i
< al
.size(); ++i
) {
1903 String mKey
= moduleInfo (al
.get(i
));
1905 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1906 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, maxSize
, value
);
1907 al
.set(i
, mKey
+ " " + itemType
);
1910 ffc
.removeDynamicPcdBuildData(cName
, tsGuid
);
1913 private void pcdNonDynamicToDynamic(String cName
, String tsGuid
) {
1914 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1915 for (int i
= 0; i
< al
.size(); ++i
) {
1916 String mKey
= moduleInfo (al
.get(i
));
1917 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1918 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, jTextFieldMaxDatumSize
.getText(), jTextFieldPcdDefault
.isVisible() ? jTextFieldPcdDefault
.getText() : jComboBoxFeatureFlagValue
.getSelectedItem()+"");
1919 al
.set(i
, mKey
+ " " + itemType
);
1922 ffc
.addDynamicPcdBuildData(cName
, model
.getValueAt(jTablePcd
.getSelectedRow(), 3), tsGuid
, "DYNAMIC", model
.getValueAt(jTablePcd
.getSelectedRow(), 5)+"", jTextFieldPcdDefault
.isVisible() ? jTextFieldPcdDefault
.getText() : jComboBoxFeatureFlagValue
.getSelectedItem()+"");
1925 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "PCD value format: " + e
.getMessage());
1929 private void changePcdTypeWithinSameCategory (String cName
, String tsGuid
) {
1930 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1931 for (int i
= 0; i
< al
.size(); ++i
) {
1932 String mKey
= moduleInfo (al
.get(i
));
1933 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1934 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, null, null);
1935 al
.set(i
, mKey
+ " " + itemType
);
1939 private String
moduleInfo (String pcdInfo
) {
1941 return pcdInfo
.substring(0, pcdInfo
.lastIndexOf(" "));
1945 * This method initializes jTextFieldMaxDatumSize
1947 * @return javax.swing.JTextField
1949 private JTextField
getJTextFieldMaxDatumSize() {
1950 if (jTextFieldMaxDatumSize
== null) {
1951 jTextFieldMaxDatumSize
= new JTextField();
1952 jTextFieldMaxDatumSize
.setPreferredSize(new java
.awt
.Dimension(200,20));
1954 return jTextFieldMaxDatumSize
;
1957 * This method initializes jTextField4
1959 * @return javax.swing.JTextField
1961 private JTextField
getJTextFieldPcdDefault() {
1962 if (jTextFieldPcdDefault
== null) {
1963 jTextFieldPcdDefault
= new JTextField();
1964 jTextFieldPcdDefault
.setPreferredSize(new java
.awt
.Dimension(200,20));
1966 return jTextFieldPcdDefault
;
1969 * This method initializes jButton6
1971 * @return javax.swing.JButton
1973 private JButton
getJButtonUpdatePcd() {
1974 if (jButtonUpdatePcd
== null) {
1975 jButtonUpdatePcd
= new JButton();
1976 jButtonUpdatePcd
.setPreferredSize(new java
.awt
.Dimension(150,20));
1977 jButtonUpdatePcd
.setText("Update PCD Data");
1978 jButtonUpdatePcd
.addActionListener(new java
.awt
.event
.ActionListener() {
1979 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1980 int row
= jTablePcd
.getSelectedRow();
1985 String cName
= model
.getValueAt(row
, 0)+"";
1986 String tsGuid
= model
.getValueAt(row
, 1)+"";
1987 String oldItemType
= model
.getValueAt(row
, 2)+"";
1988 String dataType
= model
.getValueAt(row
, 5)+"";
1989 String newItemType
= jComboBoxItemType
.getSelectedItem()+"";
1990 String newValue
= jTextFieldPcdDefault
.isVisible()? jTextFieldPcdDefault
.getText():jComboBoxFeatureFlagValue
.getSelectedItem()+"";
1991 if (newValue
.length() == 0){
1993 if (dataType
.equals("UINT8") || dataType
.equals("UINT16") || dataType
.equals("UINT32") || dataType
.equals("UINT64")) {
1996 if (dataType
.equals("BOOLEAN")){
1999 if (dataType
.equals("VOID*")) {
2004 String
[] pcdInfo
= {"", "", ""};
2005 Vector
<String
> validPcdTypes
= new Vector
<String
>();
2006 getPcdInfo (moduleKey
, cName
, tsGuid
, pcdInfo
, validPcdTypes
);
2007 if (pcdInfo
[1].equals("FIXED_AT_BUILD") && model
.getValueAt(row
, 5).equals("VOID*")) {
2009 jTextFieldMaxDatumSize
.setText(ffc
.setMaxSizeForPointer(newValue
)+"");
2011 catch (Exception exp
) {
2012 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "PCD Value MalFormed: " + exp
.getMessage());
2016 String newMaxDatumSize
= jTextFieldMaxDatumSize
.getText();
2018 if (!newItemType
.equals(oldItemType
)) {
2019 Vector
<ModuleIdentification
> moduleInfo
= new Vector
<ModuleIdentification
>();
2021 boolean changable
= itemTypeCouldBeChanged (cName
, tsGuid
, newItemType
, moduleInfo
);
2023 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Can NOT Change Pcd Type in: " + moduleInfo
.get(0).getName() + " contained in package " + moduleInfo
.get(0).getPackageId().getName());
2027 catch (Exception exp
) {
2028 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Can NOT Change Pcd Type in: " + moduleInfo
.get(0).getName() + " contained in package " + moduleInfo
.get(0).getPackageId().getName() + " " + exp
.getMessage());
2032 if ((oldItemType
.equals("DYNAMIC") || oldItemType
.equals("DYNAMIC_EX")) && !newItemType
.equals("DYNAMIC") && !newItemType
.equals("DYNAMIC_EX")) {
2033 pcdDynamicToNonDynamic(cName
, tsGuid
);
2035 if (!oldItemType
.equals("DYNAMIC") && !oldItemType
.equals("DYNAMIC_EX") && (newItemType
.equals("DYNAMIC") || newItemType
.equals("DYNAMIC_EX"))) {
2036 pcdNonDynamicToDynamic(cName
, tsGuid
);
2039 changePcdTypeWithinSameCategory (cName
, tsGuid
);
2041 model
.setValueAt(newItemType
, row
, 2);
2044 ffc
.updatePcdData(moduleKey
, cName
, tsGuid
, model
.getValueAt(row
, 2)+"", newMaxDatumSize
, newValue
);
2045 docConsole
.setSaved(false);
2046 model
.setValueAt(newValue
, row
, 6);
2047 model
.setValueAt(newMaxDatumSize
, row
, 4);
2052 return jButtonUpdatePcd
;
2055 private boolean itemTypeCouldBeChanged (String cName
, String tsGuid
, String newItemType
, Vector
<ModuleIdentification
> mi
) throws Exception
{
2056 ArrayList
<String
> pcdConsumers
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
2057 for (int i
= 0; i
< pcdConsumers
.size(); ++i
) {
2058 String consumerInfo
= moduleInfo (pcdConsumers
.get(i
));
2059 mi
.removeAllElements();
2060 mi
.add(WorkspaceProfile
.getModuleId(consumerInfo
));
2061 String
[] sa
= {"", "", ""};
2062 Vector
<String
> validPcdTypes
= new Vector
<String
>();
2063 getPcdInfo (consumerInfo
, cName
, tsGuid
, sa
, validPcdTypes
);
2064 if (validPcdTypes
.size() == 0) {
2067 if (!sa
[1].equals("DYNAMIC")) {
2070 if (!validPcdTypes
.contains(newItemType
)) {
2078 * This method initializes jComboBoxFeatureFlagValue
2080 * @return javax.swing.JComboBox
2082 private JComboBox
getJComboBoxFeatureFlagValue() {
2083 if (jComboBoxFeatureFlagValue
== null) {
2084 jComboBoxFeatureFlagValue
= new JComboBox();
2085 jComboBoxFeatureFlagValue
.setPreferredSize(new java
.awt
.Dimension(100,20));
2086 jComboBoxFeatureFlagValue
.setVisible(false);
2087 jComboBoxFeatureFlagValue
.addItem("TRUE");
2088 jComboBoxFeatureFlagValue
.addItem("FALSE");
2090 return jComboBoxFeatureFlagValue
;
2093 * This method initializes jPanelCustomToolChain
2095 * @return javax.swing.JPanel
2097 private JPanel
getJPanelCustomToolChain() {
2098 if (jPanelCustomToolChain
== null) {
2099 jPanelCustomToolChain
= new JPanel();
2100 jPanelCustomToolChain
.setLayout(new BorderLayout());
2101 jPanelCustomToolChain
.add(getJPanelToolchainS(), java
.awt
.BorderLayout
.SOUTH
);
2102 jPanelCustomToolChain
.add(getJScrollPaneModuleSaOptions(), java
.awt
.BorderLayout
.CENTER
);
2103 jPanelCustomToolChain
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
2104 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
2105 initToolChainOptions(moduleKey
);
2109 return jPanelCustomToolChain
;
2112 * This method initializes jPanelToolchainS
2114 * @return javax.swing.JPanel
2116 private JPanel
getJPanelToolchainS() {
2117 if (jPanelToolchainS
== null) {
2118 jPanelToolchainS
= new JPanel();
2119 jPanelToolchainS
.add(getJButtonNew(), null);
2120 jPanelToolchainS
.add(getJButtonDeleteOption(), null);
2122 return jPanelToolchainS
;
2126 * This method initializes jPanelLibraryCenterN
2128 * @return javax.swing.JPanel
2130 private JPanel
getJPanelLibraryCenterN() {
2131 if (jPanelLibraryCenterN
== null) {
2132 FlowLayout flowLayout5
= new FlowLayout();
2133 flowLayout5
.setAlignment(java
.awt
.FlowLayout
.CENTER
);
2134 flowLayout5
.setHgap(10);
2135 jPanelLibraryCenterN
= new JPanel();
2136 jPanelLibraryCenterN
.setLayout(flowLayout5
);
2137 jPanelLibraryCenterN
.add(jLabelInstanceHelp
, null);
2138 jPanelLibraryCenterN
.add(getJScrollPaneInstanceHelp(), null);
2139 jPanelLibraryCenterN
.add(getJButtonAdd(), null);
2140 jPanelLibraryCenterN
.add(getJButtonDeleteInstance(), null);
2142 return jPanelLibraryCenterN
;
2145 * This method initializes jPanelLibraryCenterC
2147 * @return javax.swing.JPanel
2149 private JPanel
getJPanelLibraryCenterC() {
2150 if (jPanelLibraryCenterC
== null) {
2151 jPanelLibraryCenterC
= new JPanel();
2152 jPanelLibraryCenterC
.add(jLabelSelectedInstances
, null);
2153 jPanelLibraryCenterC
.add(getJScrollPaneSelectedInstances(), null);
2155 return jPanelLibraryCenterC
;
2159 } // @jve:decl-index=0:visual-constraint="10,10"
2161 class MultipleInstanceException
extends Exception
{
2166 private static final long serialVersionUID
= -9148463005930920297L;
2167 private String className
= null;
2168 private String libInstance1
= null;
2169 private String libInstance2
= null;
2171 MultipleInstanceException (String libClass
, String instance1
, String instance2
) {
2173 className
= libClass
;
2174 libInstance1
= instance1
;
2175 libInstance2
= instance2
;
2179 * @see java.lang.Throwable#getMessage()
2182 public String
getMessage() {
2183 // TODO Auto-generated method stub
2184 return " Library Class " + className
+ "is Produced by Two Instances: "
2185 + libInstance1
+ " and " + libInstance2
+ ". Platform Build will Fail.";
2190 class ImproperInstanceException
extends Exception
{
2195 private static final long serialVersionUID
= -5279700566993277033L;
2196 private String className
= null;
2197 private String libInstance
= null;
2198 private String instanceSupArch
= null;
2199 private String instanceSupModType
= null;
2201 ImproperInstanceException (String libClass
, String instance1
, String arch
, String type
) {
2203 className
= libClass
;
2204 libInstance
= instance1
;
2205 instanceSupArch
= arch
;
2206 instanceSupModType
= type
;
2210 * @see java.lang.Throwable#getMessage()
2213 public String
getMessage() {
2214 // TODO Auto-generated method stub
2215 return " Library Class " + className
+ " Produced by Library Instance: "
2216 + libInstance
+ "\nOnly Supports " + instanceSupArch
+ " and Module Type " + instanceSupModType
+ ".\n This instance should be removed.\n";
2221 class NoInstanceException
extends Exception
{
2226 private static final long serialVersionUID
= 1987122786598970598L;
2228 private String className
= null;
2230 NoInstanceException (String libClass
) {
2231 className
= libClass
;
2234 public String
getMessage() {
2235 return "No Applicable Instance for Library Class " + className
2236 + ", Platform Build will Fail.";