]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java
1. Restructure some folders and files
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / workspace / WorkspaceTools.java
CommitLineData
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
15package org.tianocore.frameworkwizard.workspace;\r
16\r
17import java.io.IOException;\r
18import java.util.Vector;\r
19\r
20import org.apache.xmlbeans.XmlException;\r
21import org.tianocore.DbPathAndFilename;\r
22import org.tianocore.FrameworkDatabaseDocument;\r
23import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
24import org.tianocore.MsaFilesDocument.MsaFiles;\r
25import org.tianocore.MsaHeaderDocument.MsaHeader;\r
26import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
27import org.tianocore.PlatformHeaderDocument.PlatformHeader;\r
28import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
79cb6fdb 29import org.tianocore.SourceFilesDocument.SourceFiles;\r
a13899c5 30import org.tianocore.SpdHeaderDocument.SpdHeader;\r
31import org.tianocore.frameworkwizard.common.DataType;\r
a13899c5 32import org.tianocore.frameworkwizard.common.Log;\r
a13899c5 33import org.tianocore.frameworkwizard.common.SaveFile;\r
34import org.tianocore.frameworkwizard.common.Tools;\r
79cb6fdb 35import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
36import org.tianocore.frameworkwizard.common.Identifications.OpenFile;\r
37import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
a13899c5 38import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
39import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
40\r
41public class WorkspaceTools {\r
42 //\r
43 // Define class members\r
44 //\r
45 private FrameworkDatabaseDocument.FrameworkDatabase fdb = null;\r
46\r
47 private Vector<ModuleIdentification> vModuleList = new Vector<ModuleIdentification>();\r
48\r
49 private Vector<PackageIdentification> vPackageList = new Vector<PackageIdentification>();\r
50\r
51 private Vector<PlatformIdentification> vPlatformList = new Vector<PlatformIdentification>();\r
52\r
53 /**\r
54 \r
55 Open Framework Database file\r
56 \r
57 */\r
58 private void openFrameworkDb() {\r
59 String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
60 strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
61 try {\r
62 fdb = OpenFile.openFrameworkDb(strFrameworkDbFilePath);\r
63 } catch (XmlException e) {\r
64 Log.err("Open Framework Database " + strFrameworkDbFilePath, e.getMessage());\r
65 return;\r
66 } catch (Exception e) {\r
67 Log.err("Open Framework Database " + strFrameworkDbFilePath, "Invalid file type");\r
68 return;\r
69 }\r
70 }\r
71\r
72 /**\r
73 Get all modules' paths from one package\r
74 \r
75 @return a Vector with all modules' path\r
76 \r
77 **/\r
78 public Vector<String> getAllModulesOfPackage(String path) {\r
79 Vector<String> modulePath = new Vector<String>();\r
80 try {\r
81 MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles();\r
82 if (files != null) {\r
83 for (int index = 0; index < files.getFilenameList().size(); index++) {\r
79cb6fdb 84 String msaPath = files.getFilenameList().get(index);\r
85 msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;\r
86 msaPath = Tools.convertPathToCurrentOsType(msaPath);\r
87 modulePath.addElement(msaPath);\r
a13899c5 88 }\r
89 }\r
90 } catch (IOException e) {\r
91 e.printStackTrace();\r
92 } catch (XmlException e) {\r
93 e.printStackTrace();\r
94 } catch (Exception e) {\r
95 e.printStackTrace();\r
96 }\r
97 return modulePath;\r
98 }\r
99\r
100 /**\r
101 Get all package basic information form the FrameworkDatabase.db file\r
102 \r
103 @return vPackageList A vector includes all packages' basic information\r
104 \r
105 */\r
106 public Vector<PackageIdentification> getAllPackages() {\r
107 Identification id = null;\r
108 vPackageList.removeAllElements();\r
109\r
110 openFrameworkDb();\r
111\r
112 for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
113 String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
114 + fdb.getPackageList().getFilenameArray(index).getStringValue();\r
115 path = Tools.convertPathToCurrentOsType(path);\r
116 try {\r
117 id = getId(path, OpenFile.openSpdFile(path));\r
118 vPackageList.addElement(new PackageIdentification(id));\r
119 } catch (IOException e) {\r
120 Log.err("Open Package Surface Area " + path, e.getMessage());\r
121 e.printStackTrace();\r
122 } catch (XmlException e) {\r
123 Log.err("Open Package Surface Area " + path, e.getMessage());\r
124 e.printStackTrace();\r
125 } catch (Exception e) {\r
126 Log.err("Open Package Surface Area " + path, "Invalid file type");\r
127 e.printStackTrace();\r
128 }\r
129 }\r
130 return vPackageList;\r
131 }\r
132\r
133 /**\r
134 Get all package basic information form the FrameworkDatabase.db file\r
135 \r
136 @return vPackageList A vector includes all packages' basic information\r
137 \r
138 */\r
139 public Vector<ModuleIdentification> getAllModules() {\r
140 vModuleList.removeAllElements();\r
141 //\r
142 // First get all packages\r
143 //\r
144 getAllPackages();\r
145 Vector<String> modulePaths = new Vector<String>();\r
146 Identification id = null;\r
147 String packagePath = null;\r
148 String modulePath = null;\r
149\r
150 //\r
151 // For each package, get all modules list\r
152 //\r
153 for (int indexI = 0; indexI < vPackageList.size(); indexI++) {\r
154 packagePath = vPackageList.elementAt(indexI).getPath();\r
155 modulePaths = this.getAllModulesOfPackage(packagePath);\r
79cb6fdb 156 \r
a13899c5 157 for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
a13899c5 158 try {\r
79cb6fdb 159 modulePath = modulePaths.get(indexJ);\r
a13899c5 160 id = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
161 vModuleList.addElement(new ModuleIdentification(id, vPackageList.elementAt(indexI)));\r
162 } catch (IOException e) {\r
163 Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
164 e.printStackTrace();\r
165 } catch (XmlException e) {\r
166 Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
167 e.printStackTrace();\r
168 } catch (Exception e) {\r
169 Log.err("Open Module Surface Area " + modulePath, "Invalid file type");\r
170 e.printStackTrace();\r
171 }\r
172 }\r
173 }\r
174\r
175 return vModuleList;\r
176 }\r
177\r
178 /**\r
179 Get all platform basic information form the FrameworkDatabase.db file\r
180 \r
181 @return vplatformList A vector includes all platforms' basic information\r
182 \r
183 */\r
184 public Vector<PlatformIdentification> getAllPlatforms() {\r
185 Identification id = null;\r
186 vPlatformList.removeAllElements();\r
187\r
188 openFrameworkDb();\r
189\r
190 for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
191 String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
192 + fdb.getPlatformList().getFilenameArray(index).getStringValue();\r
193 path = Tools.convertPathToCurrentOsType(path);\r
194 try {\r
195 id = getId(path, OpenFile.openFpdFile(path));\r
196 vPlatformList.addElement(new PlatformIdentification(id));\r
197 } catch (IOException e) {\r
198 Log.err("Open Platform Surface Area " + path, e.getMessage());\r
199 e.printStackTrace();\r
200 } catch (XmlException e) {\r
201 Log.err("Open Platform Surface Area " + path, e.getMessage());\r
202 e.printStackTrace();\r
203 } catch (Exception e) {\r
204 Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
205 e.printStackTrace();\r
206 }\r
207 }\r
208 return vPlatformList;\r
209 }\r
210\r
211 /**\r
212 Get all Library Class Definitions from a package\r
213 \r
214 @return Vector\r
215 **/\r
216 public Vector<String> getAllLibraryClassDefinitionsFromPackage(PackageSurfaceArea spd) {\r
217 Vector<String> vector = new Vector<String>();\r
218 if (spd.getLibraryClassDeclarations() != null) {\r
219 if (spd.getLibraryClassDeclarations().getLibraryClassList().size() > 0) {\r
220 for (int index = 0; index < spd.getLibraryClassDeclarations().getLibraryClassList().size(); index++) {\r
221 vector.addElement(spd.getLibraryClassDeclarations().getLibraryClassList().get(index).getName());\r
222 }\r
223 }\r
224 }\r
225 return vector;\r
226 }\r
227\r
228 /**\r
229 Get all Protocol Definitions from a package\r
230 \r
231 @return Vector\r
232 **/\r
233 public Vector<String> getAllProtocolDeclarationsFromPackage(PackageSurfaceArea spd) {\r
234 Vector<String> vector = new Vector<String>();\r
235 if (spd.getProtocolDeclarations() != null) {\r
236 if (spd.getProtocolDeclarations().getEntryList().size() > 0) {\r
237 for (int index = 0; index < spd.getProtocolDeclarations().getEntryList().size(); index++) {\r
238 vector.addElement(spd.getProtocolDeclarations().getEntryList().get(index).getCName());\r
239 }\r
240 }\r
241 }\r
242 return vector;\r
243 }\r
244\r
245 /**\r
246 Get all Ppi Definitions from a package\r
247 \r
248 @return Vector\r
249 **/\r
250 public Vector<String> getAllPpiDeclarationsFromPackage(PackageSurfaceArea spd) {\r
251 Vector<String> vector = new Vector<String>();\r
252 if (spd.getPpiDeclarations() != null) {\r
253 if (spd.getPpiDeclarations().getEntryList().size() > 0) {\r
254 for (int index = 0; index < spd.getPpiDeclarations().getEntryList().size(); index++) {\r
255 vector.addElement(spd.getPpiDeclarations().getEntryList().get(index).getCName());\r
256 }\r
79cb6fdb 257 }\r
a13899c5 258 }\r
259 return vector;\r
260 }\r
261\r
262 /**\r
263 Get all Guid Definitions from a package\r
264 \r
265 @return Vector\r
266 **/\r
267 public Vector<String> getAllGuidDeclarationsFromPackage(PackageSurfaceArea spd) {\r
268 Vector<String> vector = new Vector<String>();\r
269 if (spd.getGuidDeclarations() != null) {\r
270 if (spd.getGuidDeclarations().getEntryList().size() > 0) {\r
271 for (int index = 0; index < spd.getGuidDeclarations().getEntryList().size(); index++) {\r
272 vector.addElement(spd.getGuidDeclarations().getEntryList().get(index).getCName());\r
273 }\r
79cb6fdb 274 }\r
a13899c5 275 }\r
276 return vector;\r
277 }\r
278\r
279 /**\r
280 Get all Pcd Definitions from a package\r
281 \r
282 @return Vector\r
283 **/\r
284 public Vector<String> getAllPcdDeclarationsFromPackage(PackageSurfaceArea spd) {\r
285 Vector<String> vector = new Vector<String>();\r
286 if (spd.getPcdDeclarations() != null) {\r
287 if (spd.getPcdDeclarations().getPcdEntryList().size() > 0) {\r
288 for (int index = 0; index < spd.getPcdDeclarations().getPcdEntryList().size(); index++) {\r
289 vector.addElement(spd.getPcdDeclarations().getPcdEntryList().get(index).getCName());\r
290 }\r
79cb6fdb 291 }\r
a13899c5 292 }\r
293 return vector;\r
294 }\r
295\r
296 public Vector<String> getAllLibraryClassDefinitionsFromWorkspace() {\r
297 //\r
298 // First get all packages\r
299 //\r
300 this.getAllPackages();\r
301\r
302 Vector<String> vector = new Vector<String>();\r
303 for (int index = 0; index < this.vPackageList.size(); index++) {\r
304 try {\r
305 Vector<String> v = getAllLibraryClassDefinitionsFromPackage(OpenFile\r
306 .openSpdFile(vPackageList\r
307 .get(index)\r
308 .getPath()));\r
309 if (v != null && v.size() > 0) {\r
310 vector.addAll(v);\r
311 }\r
312 } catch (IOException e) {\r
313 // TODO Auto-generated catch block\r
314 e.printStackTrace();\r
315 } catch (XmlException e) {\r
316 // TODO Auto-generated catch block\r
317 e.printStackTrace();\r
318 } catch (Exception e) {\r
319 // TODO Auto-generated catch block\r
320 e.printStackTrace();\r
321 }\r
322 }\r
323 return vector;\r
324 }\r
325\r
326 public Vector<String> getAllProtocolDeclarationsFromWorkspace() {\r
327 //\r
328 // First get all packages\r
329 //\r
330 this.getAllPackages();\r
331\r
332 Vector<String> vector = new Vector<String>();\r
333 for (int index = 0; index < this.vPackageList.size(); index++) {\r
334 try {\r
335 Vector<String> v = getAllProtocolDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
336 .getPath()));\r
337 if (v != null && v.size() > 0) {\r
338 vector.addAll(v);\r
339 }\r
340 } catch (IOException e) {\r
341 // TODO Auto-generated catch block\r
342 e.printStackTrace();\r
343 } catch (XmlException e) {\r
344 // TODO Auto-generated catch block\r
345 e.printStackTrace();\r
346 } catch (Exception e) {\r
347 // TODO Auto-generated catch block\r
348 e.printStackTrace();\r
349 }\r
350 }\r
351 return vector;\r
352 }\r
353\r
354 public Vector<String> getAllPpiDeclarationsFromWorkspace() {\r
355 //\r
356 // First get all packages\r
357 //\r
358 this.getAllPackages();\r
359\r
360 Vector<String> vector = new Vector<String>();\r
361 for (int index = 0; index < this.vPackageList.size(); index++) {\r
362 try {\r
363 Vector<String> v = getAllPpiDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
364 .getPath()));\r
365 if (v != null && v.size() > 0) {\r
366 vector.addAll(v);\r
367 }\r
368 } catch (IOException e) {\r
369 // TODO Auto-generated catch block\r
370 e.printStackTrace();\r
371 } catch (XmlException e) {\r
372 // TODO Auto-generated catch block\r
373 e.printStackTrace();\r
374 } catch (Exception e) {\r
375 // TODO Auto-generated catch block\r
376 e.printStackTrace();\r
377 }\r
378 }\r
379 return vector;\r
380 }\r
381\r
382 public Vector<String> getAllGuidDeclarationsFromWorkspace() {\r
383 //\r
384 // First get all packages\r
385 //\r
386 this.getAllPackages();\r
387\r
388 Vector<String> vector = new Vector<String>();\r
389 for (int index = 0; index < this.vPackageList.size(); index++) {\r
390 try {\r
391 Vector<String> v = getAllGuidDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
392 .getPath()));\r
393 if (v != null && v.size() > 0) {\r
394 vector.addAll(v);\r
395 }\r
396 } catch (IOException e) {\r
397 // TODO Auto-generated catch block\r
398 e.printStackTrace();\r
399 } catch (XmlException e) {\r
400 // TODO Auto-generated catch block\r
401 e.printStackTrace();\r
402 } catch (Exception e) {\r
403 // TODO Auto-generated catch block\r
404 e.printStackTrace();\r
405 }\r
406 }\r
407 return vector;\r
408 }\r
409\r
410 public Vector<String> getAllPcdDeclarationsFromWorkspace() {\r
411 //\r
412 // First get all packages\r
413 //\r
414 this.getAllPackages();\r
415\r
416 Vector<String> vector = new Vector<String>();\r
417 for (int index = 0; index < this.vPackageList.size(); index++) {\r
418 try {\r
419 Vector<String> v = getAllPcdDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
420 .getPath()));\r
421 if (v != null && v.size() > 0) {\r
422 vector.addAll(v);\r
423 }\r
424 } catch (IOException e) {\r
425 // TODO Auto-generated catch block\r
426 e.printStackTrace();\r
427 } catch (XmlException e) {\r
428 // TODO Auto-generated catch block\r
429 e.printStackTrace();\r
430 } catch (Exception e) {\r
431 // TODO Auto-generated catch block\r
432 e.printStackTrace();\r
433 }\r
434 }\r
435 return vector;\r
436 }\r
437\r
438 /**\r
439 Find a module's package's id\r
440 \r
441 @param id input module id\r
442 @return package id\r
443 \r
444 **/\r
445 public PackageIdentification getPackageIdByModuleId(Identification id) {\r
446 getAllPackages();\r
447 Vector<String> modulePaths = new Vector<String>();\r
448 Identification mid = null;\r
449 String packagePath = null;\r
450 String modulePath = null;\r
451\r
452 //\r
453 // For each package, get all modules list\r
454 //\r
455 for (int indexI = 0; indexI < vPackageList.size(); indexI++) {\r
456 packagePath = vPackageList.elementAt(indexI).getPath();\r
457 modulePaths = this.getAllModulesOfPackage(packagePath);\r
a13899c5 458 for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
79cb6fdb 459 modulePath = modulePaths.get(indexJ);\r
a13899c5 460 try {\r
461 mid = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
462 //\r
463 // Check id\r
464 //\r
465 if (mid.equals(id)) {\r
466 return vPackageList.elementAt(indexI);\r
467 }\r
468 } catch (IOException e) {\r
469 e.printStackTrace();\r
470 } catch (XmlException e) {\r
471 e.printStackTrace();\r
472 } catch (Exception e) {\r
473 e.printStackTrace();\r
474 }\r
475 }\r
476 }\r
477\r
478 return null;\r
479 }\r
480\r
481 public Identification getId(String path, ModuleSurfaceArea msa) {\r
482 MsaHeader head = msa.getMsaHeader();\r
483 String name = head.getModuleName();\r
484 String guid = head.getGuidValue();\r
485 String version = head.getVersion();\r
486 Identification id = new Identification(name, guid, version, path);\r
487 return id;\r
488 }\r
489\r
490 public Identification getId(String path, PackageSurfaceArea spd) {\r
491 SpdHeader head = spd.getSpdHeader();\r
492 String name = head.getPackageName();\r
493 String guid = head.getGuidValue();\r
494 String version = head.getVersion();\r
495 Identification id = new Identification(name, guid, version, path);\r
496 return id;\r
497 }\r
498\r
499 public Identification getId(String path, PlatformSurfaceArea fpd) {\r
500 PlatformHeader head = fpd.getPlatformHeader();\r
501 String name = head.getPlatformName();\r
502 String guid = head.getGuidValue();\r
503 String version = head.getVersion();\r
504 Identification id = new Identification(name, guid, version, path);\r
505 return id;\r
506 }\r
507\r
508 /**\r
509 Add module information to package surface area\r
510 \r
511 @param mid\r
512 @throws IOException\r
513 @throws XmlException\r
514 @throws Exception\r
515 \r
516 **/\r
517 public void addModuleToPackage(ModuleIdentification mid, PackageSurfaceArea spd) throws IOException, XmlException,\r
518 Exception {\r
519 String packagePath = mid.getPackageId().getPath();\r
520 String modulePath = mid.getPath();\r
521 if (spd == null) {\r
522 spd = OpenFile.openSpdFile(packagePath);\r
523 }\r
524 MsaFiles msaFile = spd.getMsaFiles();\r
525 if (msaFile == null) {\r
526 msaFile = MsaFiles.Factory.newInstance();\r
527 }\r
528 packagePath = packagePath.substring(0, packagePath.lastIndexOf(DataType.FILE_SEPARATOR));\r
529 String fn = Tools.getRelativePath(modulePath, packagePath);\r
530 msaFile.addNewFilename();\r
531 msaFile.setFilenameArray(msaFile.getFilenameList().size() - 1, fn);\r
532 spd.setMsaFiles(msaFile);\r
533 SaveFile.saveSpdFile(mid.getPackageId().getPath(), spd);\r
534 }\r
535\r
536 /**\r
537 Add input package into database\r
538 \r
539 @param id\r
540 * @throws Exception \r
541 \r
542 **/\r
543 public void addPackageToDatabase(PackageIdentification id) throws Exception {\r
544 String path = id.getPath();\r
545 path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());\r
546 this.openFrameworkDb();\r
547 DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();\r
548 filename.setStringValue(path);\r
549 fdb.getPackageList().addNewFilename();\r
550 fdb.getPackageList().setFilenameArray(fdb.getPackageList().sizeOfFilenameArray() - 1, filename);\r
551 String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
552 strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
553 SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
554 }\r
555\r
556 /**\r
557 Add input package into database\r
558 \r
559 @param id\r
560 * @throws Exception \r
561 \r
562 **/\r
563 public void addPlatformToDatabase(PlatformIdentification id) throws Exception {\r
564 String path = id.getPath();\r
565 path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());\r
566 this.openFrameworkDb();\r
567 DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();\r
568 filename.setStringValue(path);\r
569 fdb.getPlatformList().addNewFilename();\r
570 fdb.getPlatformList().setFilenameArray(fdb.getPlatformList().sizeOfFilenameArray() - 1, filename);\r
571 String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
572 strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
573 SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
574 }\r
79cb6fdb 575\r
576 /**\r
577 Get all file's path from one module\r
578 \r
579 @param path\r
580 @return\r
581 @throws IOException\r
582 @throws XmlException\r
583 @throws Exception\r
584 \r
585 **/\r
586 public Vector<String> getAllModuleFiles(String path) throws IOException, XmlException, Exception {\r
587 Vector<String> v = new Vector<String>();\r
588 path = Tools.convertPathToCurrentOsType(path);\r
589 v.addElement(path);\r
590 ModuleSurfaceArea msa = OpenFile.openMsaFile(path);\r
591 if (msa != null) {\r
592 //\r
593 // Get all files' path of a module\r
594 //\r
595 SourceFiles sf = msa.getSourceFiles();\r
596 if (sf != null) {\r
597 for (int index = 0; index < sf.getFilenameList().size(); index++) {\r
598 String temp = sf.getFilenameList().get(index).getStringValue();\r
599 temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r
600 v.addElement(Tools.convertPathToCurrentOsType(temp));\r
601 }\r
602 }\r
603 }\r
604\r
605 return v;\r
606 }\r
607\r
608 /**\r
609 Get all file's path from one package\r
610 \r
611 @param path\r
612 @return\r
613 @throws IOException\r
614 @throws XmlException\r
615 @throws Exception\r
616 \r
617 **/\r
618 public Vector<String> getAllPakcageFiles(String path) throws IOException, XmlException, Exception {\r
619 Vector<String> v = new Vector<String>();\r
620 path = Tools.convertPathToCurrentOsType(path);\r
621 //\r
622 // First add package\r
623 //\r
624 v.addElement(path);\r
625 \r
626 //\r
627 // Add module's files one by one\r
628 //\r
629 Vector<String> f1 = new Vector<String>();\r
630 f1 = getAllModulesOfPackage(path);\r
631 for (int indexI = 0; indexI < f1.size(); indexI++) {\r
632 Vector<String> f2 = getAllModuleFiles(f1.get(indexI));\r
633 for (int indexJ = 0; indexJ < f2.size(); indexJ++) {\r
634 v.addElement(f2.get(indexJ));\r
635 }\r
636 }\r
637 //v.add(0, path);\r
638\r
639 return v;\r
640 }\r
a13899c5 641}\r