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