]>
Commit | Line | Data |
---|---|---|
a13899c5 | 1 | /** @file\r |
2 | \r | |
3 | The file is used to init workspace and get basic information of workspace\r | |
4 | \r | |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | package org.tianocore.frameworkwizard.workspace;\r | |
16 | \r | |
5a24e806 | 17 | import java.io.File;\r |
a13899c5 | 18 | import java.io.IOException;\r |
5a24e806 | 19 | import java.util.List;\r |
a13899c5 | 20 | import java.util.Vector;\r |
21 | \r | |
5a24e806 | 22 | import org.apache.xmlbeans.XmlCursor;\r |
a13899c5 | 23 | import org.apache.xmlbeans.XmlException;\r |
24 | import org.tianocore.DbPathAndFilename;\r | |
8f9acbd7 | 25 | import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes;\r |
37bd8fbb | 26 | import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations;\r |
27 | import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;\r | |
a13899c5 | 28 | import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r |
29 | import org.tianocore.MsaFilesDocument.MsaFiles;\r | |
c25ad66c | 30 | import org.tianocore.PackageDependenciesDocument.PackageDependencies;\r |
a13899c5 | 31 | import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r |
09ef9242 | 32 | import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r |
79cb6fdb | 33 | import org.tianocore.SourceFilesDocument.SourceFiles;\r |
a13899c5 | 34 | import org.tianocore.frameworkwizard.common.DataType;\r |
739c6b04 | 35 | import org.tianocore.frameworkwizard.common.GlobalData;\r |
a13899c5 | 36 | import org.tianocore.frameworkwizard.common.Log;\r |
f9d0ab92 | 37 | import org.tianocore.frameworkwizard.common.OpenFile;\r |
a13899c5 | 38 | import org.tianocore.frameworkwizard.common.SaveFile;\r |
2003a22e | 39 | import org.tianocore.frameworkwizard.common.Sort;\r |
a13899c5 | 40 | import org.tianocore.frameworkwizard.common.Tools;\r |
79cb6fdb | 41 | import org.tianocore.frameworkwizard.common.Identifications.Identification;\r |
5a24e806 | 42 | import org.tianocore.frameworkwizard.far.FarHeader;\r |
43 | import org.tianocore.frameworkwizard.far.FarIdentification;\r | |
79cb6fdb | 44 | import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r |
9a8d6d9f | 45 | import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdIdentification;\r |
46 | import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;\r | |
a13899c5 | 47 | import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r |
48 | import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r | |
49 | \r | |
50 | public class WorkspaceTools {\r | |
a13899c5 | 51 | \r |
5a24e806 | 52 | public void addFarToDb(List<String> packageList, List<String> platformList, FarHeader far) {\r |
739c6b04 | 53 | //FrameworkDatabase fdb = openFrameworkDb();\r |
55a2762d | 54 | \r |
55 | for (int i = 0; i < packageList.size(); i++) {\r | |
56 | DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r | |
57 | item.setFarGuid(far.getGuidValue());\r | |
58 | item.setStringValue(packageList.get(i));\r | |
739c6b04 | 59 | GlobalData.fdb.getPackageList().getFilenameList().add(item);\r |
55a2762d | 60 | }\r |
61 | \r | |
62 | for (int i = 0; i < platformList.size(); i++) {\r | |
63 | DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r | |
64 | item.setFarGuid(far.getGuidValue());\r | |
65 | item.setStringValue(platformList.get(i));\r | |
739c6b04 | 66 | GlobalData.fdb.getPlatformList().getFilenameList().add(item);\r |
55a2762d | 67 | }\r |
68 | \r | |
69 | DbPathAndFilename farItem = DbPathAndFilename.Factory.newInstance();\r | |
70 | farItem.setFarGuid(far.getGuidValue());\r | |
71 | farItem.setStringValue(far.getFarName());\r | |
739c6b04 | 72 | GlobalData.fdb.getFarList().getFilenameList().add(farItem);\r |
55a2762d | 73 | \r |
74 | String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r | |
75 | strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r | |
76 | \r | |
77 | try {\r | |
739c6b04 | 78 | SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r |
55a2762d | 79 | } catch (Exception e) {\r |
ed1665f2 | 80 | Log.err("Save Database File", e.getMessage());\r |
55a2762d | 81 | }\r |
5a24e806 | 82 | }\r |
55a2762d | 83 | \r |
5a24e806 | 84 | public void removeFarFromDb(FarIdentification far) {\r |
5a24e806 | 85 | //\r |
86 | // Remove Packages\r | |
87 | //\r | |
739c6b04 | 88 | XmlCursor cursor = GlobalData.fdb.getPackageList().newCursor();\r |
5a24e806 | 89 | cursor.toFirstChild();\r |
90 | do {\r | |
55a2762d | 91 | DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r |
92 | \r | |
93 | if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r | |
94 | cursor.removeXml();\r | |
95 | }\r | |
5a24e806 | 96 | } while (cursor.toNextSibling());\r |
97 | cursor.dispose();\r | |
55a2762d | 98 | \r |
5a24e806 | 99 | //\r |
100 | // Remove Platforms\r | |
101 | //\r | |
739c6b04 | 102 | cursor = GlobalData.fdb.getPlatformList().newCursor();\r |
5a24e806 | 103 | cursor.toFirstChild();\r |
104 | do {\r | |
55a2762d | 105 | DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r |
106 | if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r | |
107 | cursor.removeXml();\r | |
108 | }\r | |
5a24e806 | 109 | } while (cursor.toNextSibling());\r |
55a2762d | 110 | \r |
5a24e806 | 111 | //\r |
112 | // Remove Far\r | |
113 | //\r | |
739c6b04 | 114 | cursor = GlobalData.fdb.getFarList().newCursor();\r |
5a24e806 | 115 | cursor.toFirstChild();\r |
116 | do {\r | |
55a2762d | 117 | DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r |
118 | if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r | |
119 | cursor.removeXml();\r | |
120 | }\r | |
5a24e806 | 121 | } while (cursor.toNextSibling());\r |
122 | cursor.dispose();\r | |
55a2762d | 123 | \r |
5a24e806 | 124 | String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r |
125 | strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r | |
126 | try {\r | |
739c6b04 | 127 | SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r |
55a2762d | 128 | } catch (Exception e) {\r |
ed1665f2 | 129 | Log.err("Save Database File", e.getMessage());\r |
55a2762d | 130 | }\r |
131 | }\r | |
132 | \r | |
133 | public String getPackageFarGuid(Identification packageId) {\r | |
739c6b04 | 134 | for (int index = 0; index < GlobalData.fdb.getPackageList().getFilenameList().size(); index++) {\r |
135 | DbPathAndFilename item = GlobalData.fdb.getPackageList().getFilenameArray(index);\r | |
55a2762d | 136 | String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r |
137 | File tempFile = new File(path);\r | |
138 | if (tempFile.getPath().equalsIgnoreCase(packageId.getPath())) {\r | |
739c6b04 | 139 | return GlobalData.fdb.getPackageList().getFilenameArray(index).getFarGuid();\r |
55a2762d | 140 | }\r |
141 | }\r | |
142 | \r | |
5a24e806 | 143 | return null;\r |
5a24e806 | 144 | }\r |
55a2762d | 145 | \r |
146 | public String getPlatformFarGuid(Identification platformId) {\r | |
739c6b04 | 147 | for (int index = 0; index < GlobalData.fdb.getPlatformList().getFilenameList().size(); index++) {\r |
148 | DbPathAndFilename item = GlobalData.fdb.getPlatformList().getFilenameArray(index);\r | |
55a2762d | 149 | String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r |
150 | File tempFile = new File(path);\r | |
151 | if (tempFile.getPath().equalsIgnoreCase(platformId.getPath())) {\r | |
739c6b04 | 152 | return GlobalData.fdb.getPlatformList().getFilenameArray(index).getFarGuid();\r |
55a2762d | 153 | }\r |
154 | }\r | |
155 | \r | |
156 | return null;\r | |
157 | }\r | |
158 | \r | |
159 | public String getModuleFarGuid(Identification moduleId) {\r | |
160 | PackageIdentification packageId = getPackageIdByModuleId(moduleId);\r | |
161 | if (packageId != null) {\r | |
162 | return getPackageFarGuid(packageId);\r | |
163 | } else {\r | |
164 | return null;\r | |
165 | }\r | |
166 | }\r | |
167 | \r | |
a13899c5 | 168 | /**\r |
169 | Get all modules' paths from one package\r | |
170 | \r | |
171 | @return a Vector with all modules' path\r | |
172 | \r | |
173 | **/\r | |
174 | public Vector<String> getAllModulesOfPackage(String path) {\r | |
175 | Vector<String> modulePath = new Vector<String>();\r | |
739c6b04 | 176 | PackageIdentification id = new PackageIdentification(null, null, null, path);\r |
177 | MsaFiles files = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(id).getMsaFiles();\r | |
178 | if (files != null) {\r | |
179 | for (int index = 0; index < files.getFilenameList().size(); index++) {\r | |
180 | String msaPath = files.getFilenameList().get(index);\r | |
181 | msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;\r | |
182 | msaPath = Tools.convertPathToCurrentOsType(msaPath);\r | |
183 | modulePath.addElement(msaPath);\r | |
a13899c5 | 184 | }\r |
a13899c5 | 185 | }\r |
739c6b04 | 186 | \r |
a13899c5 | 187 | return modulePath;\r |
188 | }\r | |
55a2762d | 189 | \r |
8f9acbd7 | 190 | /**\r |
55a2762d | 191 | Get all Industry Std Includes' paths from one package\r |
192 | \r | |
193 | @return a Vector with all paths\r | |
194 | \r | |
195 | **/\r | |
196 | public Vector<String> getAllIndustryStdIncludesOfPackage(String path) {\r | |
197 | Vector<String> includePath = new Vector<String>();\r | |
739c6b04 | 198 | PackageIdentification id = new PackageIdentification(null, null, null, path);\r |
199 | IndustryStdIncludes files = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(id)\r | |
200 | .getIndustryStdIncludes();\r | |
201 | if (files != null) {\r | |
202 | for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {\r | |
203 | String temp = files.getIndustryStdHeaderList().get(index).getIncludeHeader();\r | |
204 | temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r | |
205 | temp = Tools.convertPathToCurrentOsType(temp);\r | |
206 | includePath.addElement(temp);\r | |
55a2762d | 207 | }\r |
55a2762d | 208 | }\r |
209 | return includePath;\r | |
210 | }\r | |
a13899c5 | 211 | \r |
212 | /**\r | |
213 | Get all package basic information form the FrameworkDatabase.db file\r | |
214 | \r | |
215 | @return vPackageList A vector includes all packages' basic information\r | |
216 | \r | |
217 | */\r | |
218 | public Vector<PackageIdentification> getAllPackages() {\r | |
739c6b04 | 219 | return GlobalData.vPackageList;\r |
a13899c5 | 220 | }\r |
5a24e806 | 221 | \r |
222 | public Vector<FarIdentification> getAllFars() {\r | |
739c6b04 | 223 | \r |
55a2762d | 224 | Vector<FarIdentification> v = new Vector<FarIdentification>();\r |
739c6b04 | 225 | for (int index = 0; index < GlobalData.fdb.getFarList().getFilenameList().size(); index++) {\r |
226 | DbPathAndFilename item = GlobalData.fdb.getFarList().getFilenameList().get(index);\r | |
55a2762d | 227 | FarIdentification far = new FarIdentification(item.getFarGuid(), item.getMd5Sum(), item.getStringValue());\r |
228 | v.addElement(far);\r | |
229 | }\r | |
230 | return v;\r | |
231 | }\r | |
232 | \r | |
5a24e806 | 233 | public Vector<PackageIdentification> getPackagesByFar(FarIdentification far) {\r |
55a2762d | 234 | Identification id = null;\r |
739c6b04 | 235 | \r |
55a2762d | 236 | Vector<PackageIdentification> v = new Vector<PackageIdentification>();\r |
237 | \r | |
739c6b04 | 238 | for (int index = 0; index < GlobalData.fdb.getPackageList().getFilenameList().size(); index++) {\r |
239 | DbPathAndFilename item = GlobalData.fdb.getPackageList().getFilenameArray(index);\r | |
55a2762d | 240 | String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r |
241 | path = Tools.convertPathToCurrentOsType(path);\r | |
242 | \r | |
243 | if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r | |
244 | \r | |
245 | try {\r | |
739c6b04 | 246 | id = Tools.getId(path, OpenFile.openSpdFile(path));\r |
55a2762d | 247 | v.addElement(new PackageIdentification(id));\r |
248 | } catch (IOException e) {\r | |
249 | Log.err("Open Package Surface Area " + path, e.getMessage());\r | |
55a2762d | 250 | } catch (XmlException e) {\r |
251 | Log.err("Open Package Surface Area " + path, e.getMessage());\r | |
55a2762d | 252 | } catch (Exception e) {\r |
253 | Log.err("Open Package Surface Area " + path, "Invalid file type");\r | |
55a2762d | 254 | }\r |
255 | }\r | |
5a24e806 | 256 | }\r |
55a2762d | 257 | return v;\r |
5a24e806 | 258 | }\r |
55a2762d | 259 | \r |
5a24e806 | 260 | public Vector<PlatformIdentification> getPlatformsByFar(FarIdentification far) {\r |
55a2762d | 261 | Identification id = null;\r |
739c6b04 | 262 | \r |
55a2762d | 263 | Vector<PlatformIdentification> v = new Vector<PlatformIdentification>();\r |
264 | \r | |
739c6b04 | 265 | for (int index = 0; index < GlobalData.fdb.getPlatformList().getFilenameList().size(); index++) {\r |
266 | DbPathAndFilename item = GlobalData.fdb.getPlatformList().getFilenameArray(index);\r | |
55a2762d | 267 | String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r |
268 | path = Tools.convertPathToCurrentOsType(path);\r | |
269 | \r | |
270 | if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r | |
271 | try {\r | |
739c6b04 | 272 | id = Tools.getId(path, OpenFile.openFpdFile(path));\r |
55a2762d | 273 | v.addElement(new PlatformIdentification(id));\r |
274 | } catch (IOException e) {\r | |
275 | Log.err("Open Platform Surface Area " + path, e.getMessage());\r | |
55a2762d | 276 | } catch (XmlException e) {\r |
277 | Log.err("Open Platform Surface Area " + path, e.getMessage());\r | |
55a2762d | 278 | } catch (Exception e) {\r |
279 | Log.err("Open Platform Surface Area " + path, "Invalid file type");\r | |
55a2762d | 280 | }\r |
281 | }\r | |
5a24e806 | 282 | }\r |
55a2762d | 283 | return v;\r |
5a24e806 | 284 | }\r |
285 | \r | |
92e29378 | 286 | /**\r |
287 | Get all module basic information from a package\r | |
55a2762d | 288 | \r |
92e29378 | 289 | @param id Package id\r |
290 | @return A vector includes all modules' basic information\r | |
55a2762d | 291 | \r |
292 | **/\r | |
92e29378 | 293 | public Vector<ModuleIdentification> getAllModules(PackageIdentification pid) {\r |
294 | Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();\r | |
295 | Vector<String> modulePaths = this.getAllModulesOfPackage(pid.getPath());\r | |
92e29378 | 296 | String modulePath = null;\r |
55a2762d | 297 | \r |
92e29378 | 298 | for (int index = 0; index < modulePaths.size(); index++) {\r |
739c6b04 | 299 | modulePath = modulePaths.get(index);\r |
300 | ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(modulePath);\r | |
94b0f428 | 301 | if (id != null) {\r |
09ef9242 | 302 | v.addElement(id);\r |
303 | }\r | |
304 | }\r | |
305 | Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r | |
306 | return v;\r | |
307 | }\r | |
308 | \r | |
309 | /**\r | |
310 | Get all module basic information from a platform\r | |
311 | \r | |
312 | @param id Package id\r | |
313 | @return A vector includes all modules' basic information\r | |
314 | \r | |
315 | **/\r | |
316 | public Vector<ModuleIdentification> getAllModules(PlatformIdentification fid) {\r | |
317 | Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();\r | |
318 | PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformById(fid).getXmlFpd();\r | |
319 | if (fpd.getFrameworkModules() != null) {\r | |
320 | for (int index = 0; index < fpd.getFrameworkModules().getModuleSAList().size(); index++) {\r | |
321 | String guid = fpd.getFrameworkModules().getModuleSAList().get(index).getModuleGuid();\r | |
322 | String version = fpd.getFrameworkModules().getModuleSAList().get(index).getModuleVersion();\r | |
323 | ModuleIdentification id = GlobalData.openingModuleList.getIdByGuidVersion(guid, version);\r | |
324 | if (id != null) {\r | |
325 | boolean isFind = false;\r | |
326 | for (int indexOfModules = 0; indexOfModules < v.size(); indexOfModules++) {\r | |
327 | if (v.elementAt(indexOfModules).equals(id)) {\r | |
328 | isFind = true;\r | |
329 | break;\r | |
330 | }\r | |
331 | }\r | |
332 | if (!isFind) {\r | |
c25ad66c | 333 | v.addElement(id);\r |
09ef9242 | 334 | }\r |
335 | }\r | |
94b0f428 | 336 | }\r |
92e29378 | 337 | }\r |
2003a22e | 338 | Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r |
92e29378 | 339 | return v;\r |
92e29378 | 340 | }\r |
a13899c5 | 341 | \r |
342 | /**\r | |
92e29378 | 343 | Get all module basic information form the FrameworkDatabase.db file\r |
a13899c5 | 344 | \r |
92e29378 | 345 | @return vModuleList A vector includes all modules' basic information\r |
a13899c5 | 346 | \r |
347 | */\r | |
348 | public Vector<ModuleIdentification> getAllModules() {\r | |
739c6b04 | 349 | return GlobalData.vModuleList;\r |
a13899c5 | 350 | }\r |
351 | \r | |
352 | /**\r | |
353 | Get all platform basic information form the FrameworkDatabase.db file\r | |
354 | \r | |
355 | @return vplatformList A vector includes all platforms' basic information\r | |
356 | \r | |
357 | */\r | |
358 | public Vector<PlatformIdentification> getAllPlatforms() {\r | |
739c6b04 | 359 | return GlobalData.vPlatformList;\r |
a13899c5 | 360 | }\r |
361 | \r | |
362 | /**\r | |
363 | Get all Library Class Definitions from a package\r | |
364 | \r | |
365 | @return Vector\r | |
366 | **/\r | |
367 | public Vector<String> getAllLibraryClassDefinitionsFromPackage(PackageSurfaceArea spd) {\r | |
368 | Vector<String> vector = new Vector<String>();\r | |
369 | if (spd.getLibraryClassDeclarations() != null) {\r | |
370 | if (spd.getLibraryClassDeclarations().getLibraryClassList().size() > 0) {\r | |
371 | for (int index = 0; index < spd.getLibraryClassDeclarations().getLibraryClassList().size(); index++) {\r | |
372 | vector.addElement(spd.getLibraryClassDeclarations().getLibraryClassList().get(index).getName());\r | |
373 | }\r | |
374 | }\r | |
375 | }\r | |
2003a22e | 376 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r |
a13899c5 | 377 | return vector;\r |
378 | }\r | |
379 | \r | |
380 | /**\r | |
381 | Get all Protocol Definitions from a package\r | |
382 | \r | |
383 | @return Vector\r | |
384 | **/\r | |
385 | public Vector<String> getAllProtocolDeclarationsFromPackage(PackageSurfaceArea spd) {\r | |
386 | Vector<String> vector = new Vector<String>();\r | |
387 | if (spd.getProtocolDeclarations() != null) {\r | |
388 | if (spd.getProtocolDeclarations().getEntryList().size() > 0) {\r | |
389 | for (int index = 0; index < spd.getProtocolDeclarations().getEntryList().size(); index++) {\r | |
390 | vector.addElement(spd.getProtocolDeclarations().getEntryList().get(index).getCName());\r | |
391 | }\r | |
392 | }\r | |
393 | }\r | |
2003a22e | 394 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r |
a13899c5 | 395 | return vector;\r |
396 | }\r | |
397 | \r | |
398 | /**\r | |
399 | Get all Ppi Definitions from a package\r | |
400 | \r | |
401 | @return Vector\r | |
402 | **/\r | |
403 | public Vector<String> getAllPpiDeclarationsFromPackage(PackageSurfaceArea spd) {\r | |
404 | Vector<String> vector = new Vector<String>();\r | |
405 | if (spd.getPpiDeclarations() != null) {\r | |
406 | if (spd.getPpiDeclarations().getEntryList().size() > 0) {\r | |
407 | for (int index = 0; index < spd.getPpiDeclarations().getEntryList().size(); index++) {\r | |
408 | vector.addElement(spd.getPpiDeclarations().getEntryList().get(index).getCName());\r | |
409 | }\r | |
79cb6fdb | 410 | }\r |
a13899c5 | 411 | }\r |
2003a22e | 412 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r |
a13899c5 | 413 | return vector;\r |
414 | }\r | |
415 | \r | |
416 | /**\r | |
417 | Get all Guid Definitions from a package\r | |
418 | \r | |
419 | @return Vector\r | |
420 | **/\r | |
d48c170d | 421 | public Vector<String> getAllGuidDeclarationsFromPackage(PackageSurfaceArea spd, String type) {\r |
a13899c5 | 422 | Vector<String> vector = new Vector<String>();\r |
d48c170d | 423 | boolean isFound = false;\r |
a13899c5 | 424 | if (spd.getGuidDeclarations() != null) {\r |
425 | if (spd.getGuidDeclarations().getEntryList().size() > 0) {\r | |
426 | for (int index = 0; index < spd.getGuidDeclarations().getEntryList().size(); index++) {\r | |
d48c170d | 427 | Vector<String> vArch = Tools.convertListToVector(spd.getGuidDeclarations().getEntryList()\r |
428 | .get(index).getGuidTypeList());\r | |
429 | for (int indexOfArch = 0; indexOfArch < vArch.size(); indexOfArch++) {\r | |
430 | if (vArch.get(indexOfArch).equals(type)) {\r | |
431 | isFound = true;\r | |
432 | break;\r | |
433 | }\r | |
434 | }\r | |
435 | if ((isFound) || (vArch == null) || (vArch.size() < 1)) {\r | |
436 | vector.addElement(spd.getGuidDeclarations().getEntryList().get(index).getCName());\r | |
437 | isFound = false;\r | |
438 | }\r | |
a13899c5 | 439 | }\r |
79cb6fdb | 440 | }\r |
a13899c5 | 441 | }\r |
2003a22e | 442 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r |
a13899c5 | 443 | return vector;\r |
444 | }\r | |
445 | \r | |
446 | /**\r | |
447 | Get all Pcd Definitions from a package\r | |
448 | \r | |
449 | @return Vector\r | |
450 | **/\r | |
9a8d6d9f | 451 | public PcdVector getAllPcdDeclarationsFromPackage(PackageSurfaceArea spd) {\r |
452 | PcdVector vector = new PcdVector();\r | |
a13899c5 | 453 | if (spd.getPcdDeclarations() != null) {\r |
454 | if (spd.getPcdDeclarations().getPcdEntryList().size() > 0) {\r | |
455 | for (int index = 0; index < spd.getPcdDeclarations().getPcdEntryList().size(); index++) {\r | |
9a8d6d9f | 456 | String name = spd.getPcdDeclarations().getPcdEntryList().get(index).getCName();\r |
457 | String guidCName = spd.getPcdDeclarations().getPcdEntryList().get(index).getTokenSpaceGuidCName();\r | |
458 | String help = spd.getPcdDeclarations().getPcdEntryList().get(index).getHelpText();\r | |
459 | Vector<String> type = Tools.convertListToVector(spd.getPcdDeclarations().getPcdEntryList()\r | |
460 | .get(index).getValidUsage());\r | |
edbacf2e | 461 | //\r |
462 | // The algorithm for PCD of msa should be:\r | |
463 | // 1. If the type of PCD from Spd is FEATURE_FLAG, \r | |
464 | // the type of Msa only can be FEATURE_FLAG.\r | |
465 | // 2. If the type of PCD from Spd is not FEATURE_FLAG, \r | |
466 | // the type of Msa could be selected from the PCD's all types and "DYNAMIC" type.\r | |
467 | //\r | |
468 | boolean hasFEATURE_FLAG = false;\r | |
469 | boolean hasDYNAMIC = false;\r | |
470 | for (int indexOfType = 0; indexOfType < type.size(); indexOfType++) {\r | |
471 | if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_DYNAMIC)) {\r | |
472 | hasDYNAMIC = true;\r | |
473 | }\r | |
419558bb | 474 | if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) {\r |
edbacf2e | 475 | hasFEATURE_FLAG = true;\r |
476 | }\r | |
477 | }\r | |
478 | if (hasFEATURE_FLAG) {\r | |
479 | type.removeAllElements();\r | |
480 | type.addElement(DataType.PCD_ITEM_TYPE_FEATURE_FLAG);\r | |
481 | } else {\r | |
482 | if (!hasDYNAMIC) {\r | |
483 | type.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC);\r | |
484 | }\r | |
485 | }\r | |
9a8d6d9f | 486 | vector.addPcd(new PcdIdentification(name, guidCName, help, type));\r |
a13899c5 | 487 | }\r |
79cb6fdb | 488 | }\r |
a13899c5 | 489 | }\r |
2003a22e | 490 | Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);\r |
a13899c5 | 491 | return vector;\r |
492 | }\r | |
493 | \r | |
494 | public Vector<String> getAllLibraryClassDefinitionsFromWorkspace() {\r | |
a13899c5 | 495 | Vector<String> vector = new Vector<String>();\r |
739c6b04 | 496 | for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r |
497 | Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList\r | |
498 | .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r | |
499 | .get(index)));\r | |
500 | if (v != null && v.size() > 0) {\r | |
501 | vector.addAll(v);\r | |
a13899c5 | 502 | }\r |
739c6b04 | 503 | \r |
a13899c5 | 504 | }\r |
2003a22e | 505 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r |
a13899c5 | 506 | return vector;\r |
507 | }\r | |
e08433ef | 508 | \r |
c25ad66c | 509 | public Vector<String> getAllLibraryClassDefinitionsFromPackages(Vector<PackageIdentification> vpid) {\r |
510 | Vector<String> vector = new Vector<String>();\r | |
511 | for (int index = 0; index < vpid.size(); index++) {\r | |
512 | Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList\r | |
e08433ef | 513 | .getPackageSurfaceAreaFromId(vpid\r |
514 | .get(index)));\r | |
c25ad66c | 515 | if (v != null && v.size() > 0) {\r |
516 | vector.addAll(v);\r | |
517 | }\r | |
518 | \r | |
519 | }\r | |
520 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r | |
521 | return vector;\r | |
522 | }\r | |
a13899c5 | 523 | \r |
524 | public Vector<String> getAllProtocolDeclarationsFromWorkspace() {\r | |
a13899c5 | 525 | Vector<String> vector = new Vector<String>();\r |
739c6b04 | 526 | for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r |
527 | Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList\r | |
528 | .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r | |
529 | .get(index)));\r | |
530 | if (v != null && v.size() > 0) {\r | |
531 | vector.addAll(v);\r | |
a13899c5 | 532 | }\r |
533 | }\r | |
2003a22e | 534 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r |
a13899c5 | 535 | return vector;\r |
536 | }\r | |
537 | \r | |
c25ad66c | 538 | public Vector<String> getAllProtocolDeclarationsFromPackages(Vector<PackageIdentification> vpid) {\r |
539 | Vector<String> vector = new Vector<String>();\r | |
540 | for (int index = 0; index < vpid.size(); index++) {\r | |
541 | Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList\r | |
542 | .getPackageSurfaceAreaFromId(vpid\r | |
543 | .get(index)));\r | |
544 | if (v != null && v.size() > 0) {\r | |
545 | vector.addAll(v);\r | |
546 | }\r | |
547 | }\r | |
548 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r | |
549 | return vector;\r | |
550 | }\r | |
551 | \r | |
a13899c5 | 552 | public Vector<String> getAllPpiDeclarationsFromWorkspace() {\r |
a13899c5 | 553 | Vector<String> vector = new Vector<String>();\r |
739c6b04 | 554 | for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r |
555 | Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList\r | |
556 | .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r | |
557 | .get(index)));\r | |
558 | if (v != null && v.size() > 0) {\r | |
559 | vector.addAll(v);\r | |
a13899c5 | 560 | }\r |
561 | }\r | |
2003a22e | 562 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r |
a13899c5 | 563 | return vector;\r |
564 | }\r | |
565 | \r | |
c25ad66c | 566 | public Vector<String> getAllPpiDeclarationsFromPackages(Vector<PackageIdentification> vpid) {\r |
567 | Vector<String> vector = new Vector<String>();\r | |
568 | for (int index = 0; index < vpid.size(); index++) {\r | |
569 | Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList\r | |
570 | .getPackageSurfaceAreaFromId(vpid\r | |
571 | .get(index)));\r | |
572 | if (v != null && v.size() > 0) {\r | |
573 | vector.addAll(v);\r | |
574 | }\r | |
575 | }\r | |
576 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r | |
577 | return vector;\r | |
578 | }\r | |
579 | \r | |
d48c170d | 580 | public Vector<String> getAllGuidDeclarationsFromWorkspace(String type) {\r |
a13899c5 | 581 | Vector<String> vector = new Vector<String>();\r |
739c6b04 | 582 | for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r |
d48c170d | 583 | Vector<String> v = getAllGuidDeclarationsFromPackage(\r |
584 | GlobalData.openingPackageList\r | |
739c6b04 | 585 | .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r |
d48c170d | 586 | .get(index)),\r |
587 | type);\r | |
739c6b04 | 588 | if (v != null && v.size() > 0) {\r |
589 | vector.addAll(v);\r | |
a13899c5 | 590 | }\r |
739c6b04 | 591 | \r |
a13899c5 | 592 | }\r |
2003a22e | 593 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r |
a13899c5 | 594 | return vector;\r |
595 | }\r | |
596 | \r | |
d48c170d | 597 | public Vector<String> getAllGuidDeclarationsFromPackages(Vector<PackageIdentification> vpid, String type) {\r |
c25ad66c | 598 | Vector<String> vector = new Vector<String>();\r |
599 | for (int index = 0; index < vpid.size(); index++) {\r | |
d48c170d | 600 | Vector<String> v = getAllGuidDeclarationsFromPackage(\r |
601 | GlobalData.openingPackageList\r | |
c25ad66c | 602 | .getPackageSurfaceAreaFromId(vpid\r |
d48c170d | 603 | .get(index)),\r |
604 | type);\r | |
c25ad66c | 605 | if (v != null && v.size() > 0) {\r |
606 | vector.addAll(v);\r | |
607 | }\r | |
608 | \r | |
609 | }\r | |
610 | Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r | |
611 | return vector;\r | |
612 | }\r | |
613 | \r | |
9a8d6d9f | 614 | public PcdVector getAllPcdDeclarationsFromWorkspace() {\r |
9a8d6d9f | 615 | PcdVector vector = new PcdVector();\r |
739c6b04 | 616 | for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {\r |
617 | PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList\r | |
618 | .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r | |
619 | .get(index)));\r | |
620 | if (v != null && v.size() > 0) {\r | |
621 | vector.addAll(v);\r | |
a13899c5 | 622 | }\r |
739c6b04 | 623 | \r |
a13899c5 | 624 | }\r |
2003a22e | 625 | Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);\r |
a13899c5 | 626 | return vector;\r |
627 | }\r | |
628 | \r | |
c25ad66c | 629 | public PcdVector getAllPcdDeclarationsFromPackages(Vector<PackageIdentification> vpid) {\r |
630 | PcdVector vector = new PcdVector();\r | |
631 | for (int index = 0; index < vpid.size(); index++) {\r | |
632 | PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList\r | |
633 | .getPackageSurfaceAreaFromId(vpid\r | |
634 | .get(index)));\r | |
635 | if (v != null && v.size() > 0) {\r | |
636 | vector.addAll(v);\r | |
637 | }\r | |
638 | \r | |
639 | }\r | |
640 | Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);\r | |
641 | return vector;\r | |
642 | }\r | |
643 | \r | |
a13899c5 | 644 | /**\r |
645 | Find a module's package's id\r | |
646 | \r | |
647 | @param id input module id\r | |
648 | @return package id\r | |
649 | \r | |
650 | **/\r | |
651 | public PackageIdentification getPackageIdByModuleId(Identification id) {\r | |
a13899c5 | 652 | Vector<String> modulePaths = new Vector<String>();\r |
653 | Identification mid = null;\r | |
654 | String packagePath = null;\r | |
655 | String modulePath = null;\r | |
656 | \r | |
657 | //\r | |
658 | // For each package, get all modules list\r | |
659 | //\r | |
739c6b04 | 660 | for (int indexI = 0; indexI < GlobalData.vPackageList.size(); indexI++) {\r |
661 | packagePath = GlobalData.vPackageList.elementAt(indexI).getPath();\r | |
a13899c5 | 662 | modulePaths = this.getAllModulesOfPackage(packagePath);\r |
a13899c5 | 663 | for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r |
79cb6fdb | 664 | modulePath = modulePaths.get(indexJ);\r |
739c6b04 | 665 | mid = GlobalData.openingModuleList.getIdByPath(modulePath);\r |
666 | //\r | |
667 | // Check id\r | |
668 | //\r | |
419558bb | 669 | if (mid != null) {\r |
670 | if (mid.equals(id)) {\r | |
671 | return GlobalData.vPackageList.elementAt(indexI);\r | |
672 | }\r | |
a13899c5 | 673 | }\r |
674 | }\r | |
675 | }\r | |
676 | \r | |
677 | return null;\r | |
678 | }\r | |
679 | \r | |
a13899c5 | 680 | /**\r |
681 | Add module information to package surface area\r | |
682 | \r | |
683 | @param mid\r | |
684 | @throws IOException\r | |
685 | @throws XmlException\r | |
686 | @throws Exception\r | |
687 | \r | |
688 | **/\r | |
689 | public void addModuleToPackage(ModuleIdentification mid, PackageSurfaceArea spd) throws IOException, XmlException,\r | |
690 | Exception {\r | |
691 | String packagePath = mid.getPackageId().getPath();\r | |
692 | String modulePath = mid.getPath();\r | |
693 | if (spd == null) {\r | |
694 | spd = OpenFile.openSpdFile(packagePath);\r | |
695 | }\r | |
696 | MsaFiles msaFile = spd.getMsaFiles();\r | |
697 | if (msaFile == null) {\r | |
698 | msaFile = MsaFiles.Factory.newInstance();\r | |
699 | }\r | |
700 | packagePath = packagePath.substring(0, packagePath.lastIndexOf(DataType.FILE_SEPARATOR));\r | |
701 | String fn = Tools.getRelativePath(modulePath, packagePath);\r | |
702 | msaFile.addNewFilename();\r | |
703 | msaFile.setFilenameArray(msaFile.getFilenameList().size() - 1, fn);\r | |
704 | spd.setMsaFiles(msaFile);\r | |
705 | SaveFile.saveSpdFile(mid.getPackageId().getPath(), spd);\r | |
37bd8fbb | 706 | //\r |
707 | // Update GlobalData\r | |
708 | //\r | |
709 | GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId()).setMsaFiles(msaFile);\r | |
a13899c5 | 710 | }\r |
711 | \r | |
712 | /**\r | |
713 | Add input package into database\r | |
714 | \r | |
715 | @param id\r | |
716 | * @throws Exception \r | |
717 | \r | |
718 | **/\r | |
719 | public void addPackageToDatabase(PackageIdentification id) throws Exception {\r | |
720 | String path = id.getPath();\r | |
721 | path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());\r | |
739c6b04 | 722 | \r |
a13899c5 | 723 | DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();\r |
724 | filename.setStringValue(path);\r | |
739c6b04 | 725 | GlobalData.fdb.getPackageList().addNewFilename();\r |
726 | GlobalData.fdb.getPackageList().setFilenameArray(GlobalData.fdb.getPackageList().sizeOfFilenameArray() - 1,\r | |
727 | filename);\r | |
a13899c5 | 728 | String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r |
729 | strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r | |
739c6b04 | 730 | SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r |
a13899c5 | 731 | }\r |
732 | \r | |
733 | /**\r | |
734 | Add input package into database\r | |
735 | \r | |
736 | @param id\r | |
737 | * @throws Exception \r | |
738 | \r | |
739 | **/\r | |
740 | public void addPlatformToDatabase(PlatformIdentification id) throws Exception {\r | |
741 | String path = id.getPath();\r | |
742 | path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());\r | |
739c6b04 | 743 | \r |
a13899c5 | 744 | DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();\r |
745 | filename.setStringValue(path);\r | |
739c6b04 | 746 | GlobalData.fdb.getPlatformList().addNewFilename();\r |
747 | GlobalData.fdb.getPlatformList().setFilenameArray(GlobalData.fdb.getPlatformList().sizeOfFilenameArray() - 1,\r | |
748 | filename);\r | |
a13899c5 | 749 | String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r |
750 | strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r | |
739c6b04 | 751 | SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r |
a13899c5 | 752 | }\r |
79cb6fdb | 753 | \r |
754 | /**\r | |
755 | Get all file's path from one module\r | |
756 | \r | |
757 | @param path\r | |
758 | @return\r | |
759 | @throws IOException\r | |
760 | @throws XmlException\r | |
761 | @throws Exception\r | |
762 | \r | |
763 | **/\r | |
739c6b04 | 764 | public Vector<String> getAllFilesPathOfModule(String path) {\r |
79cb6fdb | 765 | Vector<String> v = new Vector<String>();\r |
766 | path = Tools.convertPathToCurrentOsType(path);\r | |
37bd8fbb | 767 | \r |
768 | //\r | |
769 | // First add msa file's path\r | |
770 | //\r | |
79cb6fdb | 771 | v.addElement(path);\r |
37bd8fbb | 772 | \r |
739c6b04 | 773 | ModuleSurfaceArea msa = GlobalData.openingModuleList\r |
774 | .getModuleSurfaceAreaFromId(GlobalData.openingModuleList\r | |
775 | .getIdByPath(path));\r | |
37bd8fbb | 776 | //\r |
777 | // Get common defined files of module\r | |
778 | //\r | |
79cb6fdb | 779 | if (msa != null) {\r |
780 | //\r | |
781 | // Get all files' path of a module\r | |
782 | //\r | |
783 | SourceFiles sf = msa.getSourceFiles();\r | |
784 | if (sf != null) {\r | |
785 | for (int index = 0; index < sf.getFilenameList().size(); index++) {\r | |
786 | String temp = sf.getFilenameList().get(index).getStringValue();\r | |
787 | temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r | |
788 | v.addElement(Tools.convertPathToCurrentOsType(temp));\r | |
789 | }\r | |
790 | }\r | |
791 | }\r | |
792 | \r | |
37bd8fbb | 793 | //\r |
794 | // Get include header files for this module\r | |
795 | //\r | |
796 | if (msa.getLibraryClassDefinitions() != null) {\r | |
797 | LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions();\r | |
798 | for (int index = 0; index < lcd.sizeOfLibraryClassArray(); index++) {\r | |
799 | if (lcd.getLibraryClassList().get(index).getUsage().toString()\r | |
800 | .equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r | |
801 | || lcd.getLibraryClassList().get(index).getUsage().toString()\r | |
802 | .equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r | |
803 | //\r | |
804 | // Get library class name\r | |
805 | //\r | |
806 | String name = lcd.getLibraryClassList().get(index).getKeyword();\r | |
807 | \r | |
808 | //\r | |
809 | // Find file path for this class\r | |
810 | //\r | |
811 | PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId();\r | |
812 | PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid);\r | |
419558bb | 813 | String headerFile = getHeaderFileFromPackageByLibraryClassName(spd, name);\r |
814 | if (!Tools.isEmpty(headerFile)) {\r | |
815 | v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())\r | |
816 | + DataType.FILE_SEPARATOR + headerFile));\r | |
37bd8fbb | 817 | }\r |
818 | }\r | |
819 | }\r | |
820 | }\r | |
821 | \r | |
79cb6fdb | 822 | return v;\r |
823 | }\r | |
824 | \r | |
825 | /**\r | |
826 | Get all file's path from one package\r | |
827 | \r | |
828 | @param path\r | |
829 | @return\r | |
830 | @throws IOException\r | |
831 | @throws XmlException\r | |
832 | @throws Exception\r | |
833 | \r | |
834 | **/\r | |
739c6b04 | 835 | public Vector<String> getAllFilesPathOfPakcage(String path) {\r |
79cb6fdb | 836 | Vector<String> v = new Vector<String>();\r |
837 | path = Tools.convertPathToCurrentOsType(path);\r | |
838 | //\r | |
839 | // First add package\r | |
840 | //\r | |
841 | v.addElement(path);\r | |
55a2762d | 842 | \r |
79cb6fdb | 843 | //\r |
8f9acbd7 | 844 | // Add the package's industry std includes one by one\r |
79cb6fdb | 845 | //\r |
846 | Vector<String> f1 = new Vector<String>();\r | |
8f9acbd7 | 847 | f1 = getAllIndustryStdIncludesOfPackage(path);\r |
848 | for (int index = 0; index < f1.size(); index++) {\r | |
849 | v.addElement(f1.get(index));\r | |
850 | }\r | |
55a2762d | 851 | \r |
8f9acbd7 | 852 | //\r |
853 | // Add module's files one by one\r | |
854 | //\r | |
855 | f1 = new Vector<String>();\r | |
79cb6fdb | 856 | f1 = getAllModulesOfPackage(path);\r |
857 | for (int indexI = 0; indexI < f1.size(); indexI++) {\r | |
739c6b04 | 858 | Vector<String> f2 = getAllFilesPathOfModule(f1.get(indexI));\r |
79cb6fdb | 859 | for (int indexJ = 0; indexJ < f2.size(); indexJ++) {\r |
860 | v.addElement(f2.get(indexJ));\r | |
861 | }\r | |
862 | }\r | |
79cb6fdb | 863 | \r |
864 | return v;\r | |
865 | }\r | |
c25ad66c | 866 | \r |
867 | /**\r | |
868 | Get a module's all package dependencies\r | |
869 | \r | |
870 | @param mid The module id\r | |
871 | @return A vector of all package dependency ids\r | |
872 | \r | |
873 | **/\r | |
874 | public Vector<PackageIdentification> getPackageDependenciesOfModule(ModuleIdentification mid) {\r | |
875 | Vector<PackageIdentification> vpid = new Vector<PackageIdentification>();\r | |
876 | ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);\r | |
877 | if (msa != null) {\r | |
878 | PackageDependencies pd = msa.getPackageDependencies();\r | |
879 | if (pd != null) {\r | |
880 | for (int index = 0; index < pd.getPackageList().size(); index++) {\r | |
881 | String guid = pd.getPackageList().get(index).getPackageGuid();\r | |
882 | String version = pd.getPackageList().get(index).getPackageVersion();\r | |
883 | PackageIdentification pid = GlobalData.openingPackageList.getIdByGuidVersion(guid, version);\r | |
884 | if (pid != null) {\r | |
885 | vpid.addElement(pid);\r | |
886 | }\r | |
887 | }\r | |
888 | }\r | |
889 | }\r | |
890 | return vpid;\r | |
891 | }\r | |
e08433ef | 892 | \r |
b63cc1b6 | 893 | public Vector<String> getAllModuleGuidXref() {\r |
894 | Vector<String> v = new Vector<String>();\r | |
895 | for (int index = 0; index < GlobalData.openingModuleList.size(); index++) {\r | |
896 | ModuleIdentification id = GlobalData.openingModuleList.getOpeningModuleByIndex(index).getId();\r | |
897 | v.addElement(id.getGuid() + " " + id.getName());\r | |
898 | }\r | |
899 | return v;\r | |
900 | }\r | |
e08433ef | 901 | \r |
902 | public Vector<String> getModuleArch(ModuleIdentification id) {\r | |
903 | Vector<String> v = new Vector<String>();\r | |
904 | ModuleSurfaceArea msa = null;\r | |
905 | if (id != null) {\r | |
906 | msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(id);\r | |
907 | }\r | |
908 | if (msa != null) {\r | |
909 | if (msa.getModuleDefinitions() != null) {\r | |
910 | v = Tools.convertListToVector(msa.getModuleDefinitions().getSupportedArchitectures());\r | |
911 | }\r | |
912 | }\r | |
913 | return v;\r | |
914 | }\r | |
419558bb | 915 | \r |
916 | public String getHeaderFileFromPackageByLibraryClassName(PackageSurfaceArea spd, String name) {\r | |
917 | String headerFile = "";\r | |
918 | if (spd != null) {\r | |
919 | if (spd.getLibraryClassDeclarations() != null) {\r | |
920 | LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();\r | |
921 | for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {\r | |
922 | if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {\r | |
923 | return lcdl.getLibraryClassList().get(indexOfLibOfSpd).getIncludeHeader();\r | |
924 | }\r | |
925 | }\r | |
926 | }\r | |
927 | }\r | |
928 | \r | |
929 | return headerFile;\r | |
930 | }\r | |
a13899c5 | 931 | }\r |