3 The file is used to provide Find funtions in workspace
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.common
.find
;
17 import java
.util
.Vector
;
19 import org
.tianocore
.LibraryClassDefinitionsDocument
.LibraryClassDefinitions
;
20 import org
.tianocore
.ModuleSurfaceAreaDocument
.ModuleSurfaceArea
;
21 import org
.tianocore
.PackageSurfaceAreaDocument
.PackageSurfaceArea
;
22 import org
.tianocore
.frameworkwizard
.common
.DataType
;
23 import org
.tianocore
.frameworkwizard
.common
.GlobalData
;
24 import org
.tianocore
.frameworkwizard
.common
.Sort
;
25 import org
.tianocore
.frameworkwizard
.common
.Tools
;
26 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
27 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Guids
.GuidsIdentification
;
28 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Guids
.GuidsVector
;
29 import org
.tianocore
.frameworkwizard
.module
.Identifications
.LibraryClass
.LibraryClassIdentification
;
30 import org
.tianocore
.frameworkwizard
.module
.Identifications
.LibraryClass
.LibraryClassVector
;
31 import org
.tianocore
.frameworkwizard
.module
.Identifications
.PcdCoded
.PcdCodedIdentification
;
32 import org
.tianocore
.frameworkwizard
.module
.Identifications
.PcdCoded
.PcdCodedVector
;
33 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Ppis
.PpisIdentification
;
34 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Ppis
.PpisVector
;
35 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Protocols
.ProtocolsIdentification
;
36 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Protocols
.ProtocolsVector
;
37 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
41 private final static String SEPERATOR
= ".";
44 Get all ppi entries from workspace
49 public static PpisVector
getAllPpisVector() {
50 PpisVector pv
= new PpisVector();
51 ModuleSurfaceArea msa
= null;
52 ModuleIdentification mid
= null;
53 PpisIdentification pid
= null;
56 // Go through each module one by one
58 if (GlobalData
.openingModuleList
.size() > 0) {
59 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
60 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
61 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
63 if (msa
.getPPIs() != null) {
64 if (msa
.getPPIs().getPpiList().size() > 0) {
65 for (int index
= 0; index
< msa
.getPPIs().getPpiList().size(); index
++) {
66 String arg0
= msa
.getPPIs().getPpiList().get(index
).getPpiCName();
67 String arg1
= DataType
.PPI_TYPE_PPI
;
69 if (msa
.getPPIs().getPpiList().get(index
).getUsage() != null) {
70 arg2
= msa
.getPPIs().getPpiList().get(index
).getUsage().toString();
73 String arg3
= msa
.getPPIs().getPpiList().get(index
).getFeatureFlag();
74 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getPPIs().getPpiList().get(index
)
76 String arg5
= msa
.getPPIs().getPpiList().get(index
).getHelpText();
78 pid
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
79 pid
.setBelongModule(mid
);
82 // Find which package declares it
84 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
85 PackageSurfaceArea spd
= GlobalData
.openingPackageList
86 .getOpeningPackageByIndex(
89 PackageIdentification packageId
= GlobalData
.openingPackageList
90 .getOpeningPackageByIndex(
93 if (spd
.getPpiDeclarations() != null) {
94 for (int indexOfPpis
= 0; indexOfPpis
< spd
.getPpiDeclarations().getEntryList()
95 .size(); indexOfPpis
++) {
96 if (spd
.getPpiDeclarations().getEntryList().get(indexOfPpis
).getCName()
98 pid
.setDeclaredBy(packageId
);
104 if (pid
.getDeclaredBy() == null) {
105 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
111 if (msa
.getPPIs().getPpiNotifyList().size() > 0) {
112 for (int index
= 0; index
< msa
.getPPIs().getPpiNotifyList().size(); index
++) {
113 String arg0
= msa
.getPPIs().getPpiNotifyList().get(index
).getPpiNotifyCName();
114 String arg1
= DataType
.PPI_TYPE_PPI_NOTIFY
;
116 if (msa
.getPPIs().getPpiNotifyList().get(index
).getUsage() != null) {
117 arg2
= msa
.getPPIs().getPpiNotifyList().get(index
).getUsage().toString();
120 String arg3
= msa
.getPPIs().getPpiNotifyList().get(index
).getFeatureFlag();
121 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getPPIs().getPpiNotifyList().get(index
)
123 String arg5
= msa
.getPPIs().getPpiNotifyList().get(index
).getHelpText();
125 pid
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
126 pid
.setBelongModule(mid
);
129 // Find which package declares it
131 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
132 PackageSurfaceArea spd
= GlobalData
.openingPackageList
133 .getOpeningPackageByIndex(
136 PackageIdentification packageId
= GlobalData
.openingPackageList
137 .getOpeningPackageByIndex(
140 if (spd
.getPpiDeclarations() != null) {
141 for (int indexOfPpis
= 0; indexOfPpis
< spd
.getPpiDeclarations().getEntryList()
142 .size(); indexOfPpis
++) {
143 if (spd
.getPpiDeclarations().getEntryList().get(indexOfPpis
).getCName()
145 pid
.setDeclaredBy(packageId
);
151 if (pid
.getDeclaredBy() == null) {
152 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
161 Sort
.sortPpis(pv
, DataType
.SORT_TYPE_ASCENDING
);
166 Re-org all ppi entries for find table
171 public static Vector
<PpiId
> getAllPpisForFind() {
172 Vector
<PpiId
> ppi
= new Vector
<PpiId
>();
173 PpisVector pv
= Find
.getAllPpisVector();
174 boolean isAdded
= false;
175 boolean isProduced
= false;
178 // Go through pv to add item as new format to ppi one by one
180 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
182 PpisIdentification pvId
= pv
.getPpis(indexOfPv
);
185 // First check if produced or not
187 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
188 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
190 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
191 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
196 // Get the sting "PackageName.ModuleName"
198 String tmp
= pvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ pvId
.getBelongModule().getName();
201 // Check if the item has been added in
202 // If added, append package name and new module name
203 // If not added, add a new one first
205 for (int indexOfPpi
= 0; indexOfPpi
< ppi
.size(); indexOfPpi
++) {
206 PpiId ppiId
= ppi
.get(indexOfPpi
);
208 if (pvId
.getName().equals(ppiId
.getName())) {
210 ppi
.get(indexOfPpi
).setProducedModules(ppiId
.getProducedModules() + "<br>" + tmp
);
211 } else if (!isProduced
) {
212 ppi
.get(indexOfPpi
).setConsumedModules(ppiId
.getConsumedModules() + "<br>" + tmp
);
225 .addElement(new PpiId(pvId
.getName(), pvId
.getType(), tmp
, null, pvId
.getDeclaredBy().getName()));
226 } else if (!isProduced
) {
228 .addElement(new PpiId(pvId
.getName(), pvId
.getType(), null, tmp
, pvId
.getDeclaredBy().getName()));
237 Get all protocol entries from workspace
242 public static ProtocolsVector
getAllProtocolsVector() {
243 ProtocolsVector pv
= new ProtocolsVector();
244 ModuleSurfaceArea msa
= null;
245 ModuleIdentification mid
= null;
246 ProtocolsIdentification pid
= null;
249 // Go through each module one by one
251 if (GlobalData
.openingModuleList
.size() > 0) {
252 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
253 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
254 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
256 if (msa
.getProtocols() != null) {
257 if (msa
.getProtocols().getProtocolList().size() > 0) {
258 for (int index
= 0; index
< msa
.getProtocols().getProtocolList().size(); index
++) {
259 String arg0
= msa
.getProtocols().getProtocolList().get(index
).getProtocolCName();
260 String arg1
= DataType
.PROTOCOL_TYPE_PROTOCOL
;
262 if (msa
.getProtocols().getProtocolList().get(index
).getUsage() != null) {
263 arg2
= msa
.getProtocols().getProtocolList().get(index
).getUsage().toString();
266 String arg3
= msa
.getProtocols().getProtocolList().get(index
).getFeatureFlag();
267 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getProtocols().getProtocolList()
268 .get(index
).getSupArchList());
269 String arg5
= msa
.getProtocols().getProtocolList().get(index
).getHelpText();
271 pid
= new ProtocolsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
272 pid
.setBelongModule(mid
);
275 // Find which package declares it
277 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
278 PackageSurfaceArea spd
= GlobalData
.openingPackageList
279 .getOpeningPackageByIndex(
282 PackageIdentification packageId
= GlobalData
.openingPackageList
283 .getOpeningPackageByIndex(
286 if (spd
.getProtocolDeclarations() != null) {
287 for (int indexOfProtocols
= 0; indexOfProtocols
< spd
.getProtocolDeclarations()
288 .getEntryList().size(); indexOfProtocols
++) {
289 if (spd
.getProtocolDeclarations().getEntryList().get(indexOfProtocols
)
290 .getCName().equals(arg0
)) {
291 pid
.setDeclaredBy(packageId
);
297 if (pid
.getDeclaredBy() == null) {
298 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
300 pv
.addProtocols(pid
);
303 if (msa
.getProtocols().getProtocolNotifyList().size() > 0) {
304 for (int index
= 0; index
< msa
.getProtocols().getProtocolNotifyList().size(); index
++) {
305 String arg0
= msa
.getProtocols().getProtocolNotifyList().get(index
)
306 .getProtocolNotifyCName();
307 String arg1
= DataType
.PPI_TYPE_PPI_NOTIFY
;
309 if (msa
.getProtocols().getProtocolNotifyList().get(index
).getUsage() != null) {
310 arg2
= msa
.getProtocols().getProtocolNotifyList().get(index
).getUsage().toString();
313 String arg3
= msa
.getProtocols().getProtocolNotifyList().get(index
).getFeatureFlag();
314 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getProtocols().getProtocolNotifyList()
315 .get(index
).getSupArchList());
316 String arg5
= msa
.getProtocols().getProtocolNotifyList().get(index
).getHelpText();
318 pid
= new ProtocolsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
319 pid
.setBelongModule(mid
);
322 // Find which package declares it
324 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
325 PackageSurfaceArea spd
= GlobalData
.openingPackageList
326 .getOpeningPackageByIndex(
329 PackageIdentification packageId
= GlobalData
.openingPackageList
330 .getOpeningPackageByIndex(
333 if (spd
.getProtocolDeclarations() != null) {
334 for (int indexOfProtocols
= 0; indexOfProtocols
< spd
.getProtocolDeclarations()
335 .getEntryList().size(); indexOfProtocols
++) {
336 if (spd
.getProtocolDeclarations().getEntryList().get(indexOfProtocols
)
337 .getCName().equals(arg0
)) {
338 pid
.setDeclaredBy(packageId
);
344 if (pid
.getDeclaredBy() == null) {
345 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
348 pv
.addProtocols(pid
);
354 Sort
.sortProtocols(pv
, DataType
.SORT_TYPE_ASCENDING
);
359 Re-org all protocol entries for find table
364 public static Vector
<ProtocolId
> getAllProtocolsForFind() {
365 Vector
<ProtocolId
> protocol
= new Vector
<ProtocolId
>();
366 ProtocolsVector pv
= Find
.getAllProtocolsVector();
367 boolean isAdded
= false;
368 boolean isProduced
= false;
371 // Go through pv to add item as new format to ppi one by one
373 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
375 ProtocolsIdentification pvId
= pv
.getProtocols(indexOfPv
);
378 // First check if produced or not
380 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
381 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
383 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
384 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
389 // Get the sting "PackageName.ModuleName"
391 String tmp
= pvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ pvId
.getBelongModule().getName();
394 // Check if the item has been added in
395 // If added, append package name and new module name
396 // If not added, add a new one first
398 for (int indexOfProtocol
= 0; indexOfProtocol
< protocol
.size(); indexOfProtocol
++) {
399 ProtocolId protocolId
= protocol
.get(indexOfProtocol
);
401 if (pvId
.getName().equals(protocolId
.getName())) {
403 protocol
.get(indexOfProtocol
)
404 .setProducedModules(protocolId
.getProducedModules() + "<br>" + tmp
);
405 } else if (!isProduced
) {
406 protocol
.get(indexOfProtocol
)
407 .setConsumedModules(protocolId
.getConsumedModules() + "<br>" + tmp
);
419 protocol
.addElement(new ProtocolId(pvId
.getName(), pvId
.getType(), tmp
, null, pvId
.getDeclaredBy()
421 } else if (!isProduced
) {
422 protocol
.addElement(new ProtocolId(pvId
.getName(), pvId
.getType(), null, tmp
, pvId
.getDeclaredBy()
432 Get all protocol entries from workspace
437 public static GuidsVector
getAllGuidsVector() {
438 GuidsVector gv
= new GuidsVector();
439 ModuleSurfaceArea msa
= null;
440 ModuleIdentification mid
= null;
441 GuidsIdentification gid
= null;
444 // Go through each module one by one
446 if (GlobalData
.openingModuleList
.size() > 0) {
447 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
448 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
449 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
451 if (msa
.getGuids() != null) {
452 if (msa
.getGuids().getGuidCNamesList().size() > 0) {
453 for (int index
= 0; index
< msa
.getGuids().getGuidCNamesList().size(); index
++) {
454 String arg0
= msa
.getGuids().getGuidCNamesList().get(index
).getGuidCName();
456 if (msa
.getGuids().getGuidCNamesList().get(index
).getUsage() != null) {
457 arg1
= msa
.getGuids().getGuidCNamesList().get(index
).getUsage().toString();
460 String arg2
= msa
.getGuids().getGuidCNamesList().get(index
).getFeatureFlag();
461 Vector
<String
> arg3
= Tools
.convertListToVector(msa
.getGuids().getGuidCNamesList()
462 .get(index
).getSupArchList());
463 String arg4
= msa
.getGuids().getGuidCNamesList().get(index
).getHelpText();
465 gid
= new GuidsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
);
466 gid
.setBelongModule(mid
);
469 // Find which package declares it
471 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
472 PackageSurfaceArea spd
= GlobalData
.openingPackageList
473 .getOpeningPackageByIndex(
476 PackageIdentification packageId
= GlobalData
.openingPackageList
477 .getOpeningPackageByIndex(
480 if (spd
.getGuidDeclarations() != null) {
481 for (int indexOfGuids
= 0; indexOfGuids
< spd
.getGuidDeclarations().getEntryList()
482 .size(); indexOfGuids
++) {
483 if (spd
.getGuidDeclarations().getEntryList().get(indexOfGuids
).getCName()
485 gid
.setDeclaredBy(packageId
);
491 if (gid
.getDeclaredBy() == null) {
492 gid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
501 Sort
.sortGuids(gv
, DataType
.SORT_TYPE_ASCENDING
);
506 Re-org all guid entries for find table
511 public static Vector
<GuidId
> getAllGuidsForFind() {
512 Vector
<GuidId
> guid
= new Vector
<GuidId
>();
513 GuidsVector gv
= Find
.getAllGuidsVector();
514 boolean isAdded
= false;
515 boolean isProduced
= false;
518 // Go through pv to add item as new format to ppi one by one
520 for (int indexOfGv
= 0; indexOfGv
< gv
.size(); indexOfGv
++) {
522 GuidsIdentification gvId
= gv
.getGuids(indexOfGv
);
525 // First check if produced or not
527 if (gvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
528 || gvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
530 } else if (gvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
531 || gvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
536 // Get the sting "PackageName.ModuleName"
538 String tmp
= gvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ gvId
.getBelongModule().getName();
541 // Check if the item has been added in
542 // If added, append package name and new module name
543 // If not added, add a new one first
545 for (int indexOfGuid
= 0; indexOfGuid
< guid
.size(); indexOfGuid
++) {
546 GuidId guidId
= guid
.get(indexOfGuid
);
548 if (gvId
.getName().equals(guidId
.getName())) {
550 guid
.get(indexOfGuid
).setProducedModules(guidId
.getProducedModules() + "<br>" + tmp
);
551 } else if (!isProduced
) {
552 guid
.get(indexOfGuid
).setConsumedModules(guidId
.getConsumedModules() + "<br>" + tmp
);
564 guid
.addElement(new GuidId(gvId
.getName(), "GUID", tmp
, null, gvId
.getDeclaredBy().getName()));
565 } else if (!isProduced
) {
566 guid
.addElement(new GuidId(gvId
.getName(), "GUID", null, tmp
, gvId
.getDeclaredBy().getName()));
575 Get all pcd coded entries from workspace
580 public static PcdCodedVector
getAllPcdCodedVector() {
581 PcdCodedVector pv
= new PcdCodedVector();
582 ModuleSurfaceArea msa
= null;
583 ModuleIdentification mid
= null;
584 PcdCodedIdentification pid
= null;
587 // Go through each module one by one
589 if (GlobalData
.openingModuleList
.size() > 0) {
590 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
591 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
592 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
594 if (msa
.getPcdCoded() != null) {
595 if (msa
.getPcdCoded().getPcdEntryList().size() > 0) {
596 for (int index
= 0; index
< msa
.getPcdCoded().getPcdEntryList().size(); index
++) {
598 String arg0
= msa
.getPcdCoded().getPcdEntryList().get(index
).getCName();
599 String arg1
= msa
.getPcdCoded().getPcdEntryList().get(index
).getTokenSpaceGuidCName();
601 String arg2
= msa
.getPcdCoded().getPcdEntryList().get(index
).getFeatureFlag();
602 Vector
<String
> arg3
= Tools
.convertListToVector(msa
.getPcdCoded().getPcdEntryList()
603 .get(index
).getSupArchList());
605 String arg4
= msa
.getPcdCoded().getPcdEntryList().get(index
).getDefaultValue();
606 String arg5
= msa
.getPcdCoded().getPcdEntryList().get(index
).getHelpText();
608 if (msa
.getPcdCoded().getPcdEntryList().get(index
).getPcdItemType() != null) {
609 arg6
= msa
.getPcdCoded().getPcdEntryList().get(index
).getPcdItemType().toString();
612 if (msa
.getPcdCoded().getPcdEntryList().get(index
).getUsage() != null) {
613 arg7
= msa
.getPcdCoded().getPcdEntryList().get(index
).getUsage().toString();
615 pid
= new PcdCodedIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
, arg6
, arg7
);
616 pid
.setBelongModule(mid
);
619 // Find which package declares it
621 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
622 PackageSurfaceArea spd
= GlobalData
.openingPackageList
623 .getOpeningPackageByIndex(
626 PackageIdentification packageId
= GlobalData
.openingPackageList
627 .getOpeningPackageByIndex(
630 if (spd
.getPcdDeclarations() != null) {
631 for (int indexOfPcds
= 0; indexOfPcds
< spd
.getPcdDeclarations().getPcdEntryList()
632 .size(); indexOfPcds
++) {
633 if (spd
.getPcdDeclarations().getPcdEntryList().get(indexOfPcds
).getCName()
635 pid
.setDeclaredBy(packageId
);
641 if (pid
.getDeclaredBy() == null) {
642 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
651 Sort
.sortPcdCodeds(pv
, DataType
.SORT_TYPE_ASCENDING
);
656 Re-org all guid entries for find table
661 public static Vector
<PcdId
> getAllPcdCodedForFind() {
662 Vector
<PcdId
> pcd
= new Vector
<PcdId
>();
663 PcdCodedVector pv
= Find
.getAllPcdCodedVector();
664 boolean isAdded
= false;
665 boolean isProduced
= false;
668 // Go through pv to add item as new format to ppi one by one
670 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
672 PcdCodedIdentification pvId
= pv
.getPcdCoded(indexOfPv
);
675 // First check if produced or not
677 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
678 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
680 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
681 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
686 // Get the sting "PackageName.ModuleName"
688 String tmp
= pvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ pvId
.getBelongModule().getName();
691 // Check if the item has been added in
692 // If added, append package name and new module name
693 // If not added, add a new one first
695 for (int indexOfGuid
= 0; indexOfGuid
< pcd
.size(); indexOfGuid
++) {
696 PcdId pcdId
= pcd
.get(indexOfGuid
);
698 if (pvId
.getName().equals(pcdId
.getName())) {
700 pcd
.get(indexOfGuid
).setProducedModules(pcdId
.getProducedModules() + "<br>" + tmp
);
701 } else if (!isProduced
) {
702 pcd
.get(indexOfGuid
).setConsumedModules(pcdId
.getConsumedModules() + "<br>" + tmp
);
715 .addElement(new PcdId(pvId
.getName(), pvId
.getType(), tmp
, null, pvId
.getDeclaredBy().getName()));
716 } else if (!isProduced
) {
718 .addElement(new PcdId(pvId
.getName(), pvId
.getType(), null, tmp
, pvId
.getDeclaredBy().getName()));
727 Get all library class entries from workspace
732 public static LibraryClassVector
getAllLibraryClassVector() {
733 LibraryClassVector lcv
= new LibraryClassVector();
734 ModuleSurfaceArea msa
= null;
735 ModuleIdentification mid
= null;
736 LibraryClassIdentification lcid
= null;
739 // Go through each module one by one
741 if (GlobalData
.openingModuleList
.size() > 0) {
742 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
743 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
744 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
746 if (msa
.getLibraryClassDefinitions() != null) {
747 LibraryClassDefinitions lcd
= msa
.getLibraryClassDefinitions();
748 if (lcd
.getLibraryClassList().size() > 0) {
749 for (int index
= 0; index
< lcd
.getLibraryClassList().size(); index
++) {
750 String name
= lcd
.getLibraryClassList().get(index
).getKeyword();
752 if (lcd
.getLibraryClassList().get(index
).getUsage() != null) {
753 usage
= lcd
.getLibraryClassList().get(index
).getUsage().toString();
755 String version
= lcd
.getLibraryClassList().get(index
).getRecommendedInstanceVersion();
756 String guid
= lcd
.getLibraryClassList().get(index
).getRecommendedInstanceGuid();
757 String featureFlag
= lcd
.getLibraryClassList().get(index
).getFeatureFlag();
758 Vector
<String
> arch
= Tools
.convertListToVector(lcd
.getLibraryClassList().get(index
)
760 Vector
<String
> module
= Tools
.convertListToVector(lcd
.getLibraryClassList().get(index
)
761 .getSupModuleList());
762 String help
= lcd
.getLibraryClassList().get(index
).getHelpText();
763 lcid
= new LibraryClassIdentification(name
, usage
, version
, guid
, arch
, featureFlag
,
765 lcid
.setBelongModule(mid
);
768 // Find which package declares it
770 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
771 PackageSurfaceArea spd
= GlobalData
.openingPackageList
772 .getOpeningPackageByIndex(
775 PackageIdentification packageId
= GlobalData
.openingPackageList
776 .getOpeningPackageByIndex(
779 if (spd
.getLibraryClassDeclarations() != null) {
780 for (int indexOfLibraryClass
= 0; indexOfLibraryClass
< spd
781 .getLibraryClassDeclarations()
782 .getLibraryClassList()
783 .size(); indexOfLibraryClass
++) {
784 if (spd
.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass
)
785 .getName().equals(name
)) {
786 lcid
.setDeclaredBy(packageId
);
792 if (lcid
.getDeclaredBy() == null) {
793 lcid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
796 lcv
.addLibraryClass(lcid
);
802 Sort
.sortLibraryClass(lcv
, DataType
.SORT_TYPE_ASCENDING
);
807 Re-org all guid entries for find table
812 public static Vector
<LibraryClassId
> getAllLibraryClassForFind() {
813 Vector
<LibraryClassId
> libraryClass
= new Vector
<LibraryClassId
>();
814 LibraryClassVector lcv
= Find
.getAllLibraryClassVector();
815 boolean isAdded
= false;
816 boolean isProduced
= false;
819 // Go through pv to add item as new format to ppi one by one
821 for (int indexOfLcv
= 0; indexOfLcv
< lcv
.size(); indexOfLcv
++) {
823 LibraryClassIdentification lcvId
= lcv
.getLibraryClass(indexOfLcv
);
826 // First check if produced or not
828 if (lcvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
829 || lcvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
831 } else if (lcvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
832 || lcvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
837 // Get the sting "PackageName.ModuleName"
839 String tmp
= lcvId
.getBelongModule().getPackageId().getName() + SEPERATOR
840 + lcvId
.getBelongModule().getName();
843 // Check if the item has been added in
844 // If added, append package name and new module name
845 // If not added, add a new one first
847 for (int indexOfGuid
= 0; indexOfGuid
< libraryClass
.size(); indexOfGuid
++) {
848 LibraryClassId lcId
= libraryClass
.get(indexOfGuid
);
850 if (lcvId
.getLibraryClassName().equals(lcId
.getName())) {
852 libraryClass
.get(indexOfGuid
).setProducedModules(lcId
.getProducedModules() + "<br>" + tmp
);
853 } else if (!isProduced
) {
854 libraryClass
.get(indexOfGuid
).setConsumedModules(lcId
.getConsumedModules() + "<br>" + tmp
);
866 libraryClass
.addElement(new LibraryClassId(lcvId
.getLibraryClassName(), "Library Class", tmp
, null,
867 lcvId
.getDeclaredBy().getName()));
868 } else if (!isProduced
) {
869 libraryClass
.addElement(new LibraryClassId(lcvId
.getLibraryClassName(), "Library Class", null, tmp
,
870 lcvId
.getDeclaredBy().getName()));