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

  1. !!Script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3. // @Modified build 255 cm19990120 - incremented the updateWorkspaceTab indexes
  4.  
  5. /**
  6. @Tool: addPackage~displays a new package dialog to let you define 
  7. and new package to be added to the current project. A package requires 
  8. a source directory, a destination directory (which may be the 
  9. same as the source directory), and a source and destination 
  10. file types. If you are adding a Java package then you also need 
  11. to select the package name from the drop down list. If you are 
  12. defining a non-Java package, you can enter any name that you like 
  13. for the package name. 
  14. @Note: For Java packages, the correct package name is included in 
  15. a package statement in at least one Java source file in the 
  16. source directory. 
  17. @EndNote:
  18. @Image: Add Package Dialog@addPackage_Project.gif 
  19. @Paragraph: Choosing a custom package type will require you to 
  20. enter in a source and destination file types in another dialog. 
  21. Choosing the Java package type automatically defines the 
  22. source and destination file types (e.g., ".java.class"). 
  23. @Paragraph: How files are added to a package depends upon the auto include state.  
  24. If auto include is on then all files matching the file type in the package 
  25. source directory or subdirectory are automatically included in the package. 
  26. In this case you can use the removeFiles script to exclude files and you 
  27. can use the addFiles script to include files that have been excluded. If the 
  28. auto include is off then you must use the addFiles script to include files 
  29. in the package and use removeFiles to exclude files added by the addFiles 
  30. script.
  31. @EndTool: 
  32. @Summary: addPackage~displays a new package dialog 
  33. */
  34.  
  35. function DoUpdate(cmdUI) 
  36. {
  37.     var project = getCurrentProject();
  38.     cmdUI.enable(project != null && !project.readOnly)
  39.     return true;
  40. }
  41.  
  42. function DoCommand()
  43. {
  44.     var project = getCurrentProject();
  45.     
  46.     if (project)
  47.     {
  48.         var p = chooseNewPackage("Create Package");  
  49.         // Note you can not use the variable name "package"
  50.         // because it is a reserve word in JavaScript
  51.         if (p)
  52.         {
  53.             project.addPackage(p);
  54.             Application.updateWorkspaceTab("Class"); 
  55.             Application.updateWorkspaceTab("Package"); 
  56.             Application.updateWorkspaceTab("Files"); 
  57.         }
  58.     }
  59.     else
  60.     {
  61.         alert("A project must be open before you can add a package");
  62.     }
  63. }
  64.  
  65.  
  66. !!/Script
  67.