home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / web_dev / files / mwjpp516.exe / %MAINDIR% / Tools / Project / projectInfo.script < prev    next >
Encoding:
Text File  |  2001-06-19  |  4.8 KB  |  159 lines

  1. !!Script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3. // @Modified build 225 cm19981007 - added readOnly infomation
  4. // @Modified build 237 cm19981118 - added include subdirectories infomation
  5. // @Modified build 337 cm20000112 - added title
  6. // @Modified build 480 cm20010115
  7. // @Modified build 483 cm20010128 - added support for working directory
  8.  
  9. /**
  10. @Tool: projectInfo~displays information about a project and its 
  11. packages in the Output panel. You should use this tool to see what 
  12. is in your project and to diagnose project and package related problems. 
  13. @EndTool: 
  14. @Summary: projectInfo~displays information about a project 
  15. */
  16.  
  17. var gOutput = getOutput();
  18. var gOptions = getMapFile("JDKToolsStandardOptions"); //cm20010115
  19.  
  20. function DoUpdate(cmdUI) 
  21. {
  22.     var project = getCurrentProject();
  23.     cmdUI.enable(project != null)
  24.     return true;
  25. }
  26.  
  27. function DoCommand()
  28. {
  29.     saveAll();
  30.     
  31.     var project = getCurrentProject();
  32.     
  33.     if (project)
  34.     {
  35.         gOutput.clear();
  36.         gOutput.writeLine("Project Information");
  37.         
  38.         ListProjectWorkingDirectory(project);
  39.         ReportCustomClassPaths();
  40.         
  41.         if (project.readOnly)
  42.         {
  43.             gOutput.writeLine("NOTE: Project is READ-ONLY");
  44.         }
  45.         
  46.         var packageList = project.getPackageList();
  47.         var position = packageList.getHeadPosition();
  48.         
  49.         if (!position.valid)
  50.         {
  51.             gOutput.writeLine("\nNo packages are included in this project");
  52.         }
  53.         
  54.         while (position.valid)
  55.         {
  56.             ListPackageInfo(packageList.getNext(position));
  57.         }
  58.         
  59.         gOutput.writeLine("\nReport completed");
  60.     }
  61.     else
  62.     {
  63.         alert("A project must be open before you get project info");
  64.     }
  65. }
  66.  
  67. function ListProjectWorkingDirectory(project)
  68. {
  69.     var workingDirectory = project.getProperty("WorkingDirectory", "");
  70.     if (workingDirectory != "")
  71.     {
  72.         gOutput.writeLine("Working Directory: " + workingDirectory);
  73.     }
  74.     else
  75.     {
  76.         gOutput.writeLine("Working Directory: <set to the directory containing the class file being run>");
  77.     }
  78. }
  79.  
  80.  
  81. function ListPackageInfo(p)
  82. {    
  83.     if (p.name.length > 0)
  84.     {
  85.         gOutput.writeLine("Information for package " + p.name);
  86.     }
  87.     else
  88.     {
  89.         gOutput.writeLine("Information for package " + p.title); //cm20000112
  90.     }
  91.     gOutput.writeLine("Package type: " + p.packageType);
  92.     gOutput.writeLine("Source path: " + p.sourcePath);
  93.     gOutput.writeLine("Destination path: " + p.destinationPath);
  94.     if (p.packageType == "Java")
  95.     {
  96.         gOutput.writeLine("Classpath: " + p.getJavaClassPath());
  97.     }
  98.     gOutput.writeLine("Include in build: " + p.includeInBuild);
  99.     gOutput.writeLine("Auto-include files: " + p.autoInclude);
  100.     gOutput.writeLine("Include subdirectories: " + p.includeSubdirectories);
  101.     gOutput.writeLine("\nSource files list");      
  102.     
  103.     var includedFileList = p.getFileList(false); 
  104.     var position = includedFileList.getHeadPosition();
  105.     while (position.valid)
  106.     {
  107.         gOutput.writeLine(includedFileList.getNext(position).path);
  108.     }
  109.     
  110.     gOutput.writeLine("Number of source files: " + includedFileList.count);
  111.     
  112.     gOutput.writeLine("\nDestination file list");      
  113.     
  114.     var destinationFileList = p.getDestinationFileList(); 
  115.     var position = destinationFileList.getHeadPosition();
  116.     while (position.valid)
  117.     {
  118.         gOutput.writeLine(destinationFileList.getNext(position).path);
  119.     }
  120.     gOutput.writeLine("Number of destination files: " + destinationFileList.count);
  121.     
  122.     gOutput.writeLine("\nSource files needing building");      
  123.     
  124.     var outOfDateFileList = p.getBuildFileList(true); 
  125.     var position = outOfDateFileList.getHeadPosition();
  126.     while (position.valid)
  127.     {
  128.         gOutput.writeLine(outOfDateFileList.getNext(position).path);
  129.     }
  130.     gOutput.writeLine("Number of source files needing building: " + outOfDateFileList.count);
  131.     
  132.     gOutput.writeLine("\nExcluded file/directory list: ");
  133.     // Write out excluded file list
  134.     var excludedFileList = p.getFileList(true); 
  135.     var position = excludedFileList.getHeadPosition();
  136.     while (position.valid)
  137.     {
  138.         gOutput.writeLine(excludedFileList.getNext(position).path);
  139.     }
  140.     gOutput.writeLine("\n----------------------");
  141. }
  142.  
  143. function ReportCustomClassPaths() //cm20010115
  144. {    
  145.     var entry = gOptions.lookup("standardClasspaths", "");
  146.     gOutput.writeLine("Standard Classpaths set to:\n\"" + entry + "\"");
  147.     
  148.     var entry = gOptions.lookup("customClasspaths", "");
  149.     gOutput.writeLine("Custom Classpaths set to:\n\"" + entry + "\"");
  150.     
  151.     var entry = gOptions.lookup("bootClasspaths", "");
  152.     gOutput.writeLine("Boot Classpaths set to:\n\"" + entry + "\"");
  153.     
  154.     gOutput.writeLine("\n----------------------");
  155. }
  156.  
  157.  
  158. !!/Script
  159.