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

  1. !!Script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3. // @Modified build 431 cm20001011 - added "Classpath_changed" event
  4.  
  5. //
  6. // Classpath utilities
  7. //
  8.  
  9. function DoCommand()
  10. {
  11.     alert("The classpathUtilities script only contains funtions\nthat can be used by other scripts");
  12. }
  13.  
  14. function EditJDKCustomClasspaths(classpaths)
  15. {
  16.     var newClasspaths = EditClasspaths(
  17.         "Edit JDK custom classpaths - do not enter a path for classes.zip", 
  18.         classpaths);
  19.     return newClasspaths;
  20. }
  21.  
  22. function EditMSJCustomClasspaths(classpaths)
  23. {
  24.     var newClasspaths = EditClasspaths(
  25.         "Edit MSJ custom classpaths - do not enter a path for classes.zip", 
  26.         classpaths);
  27.     return newClasspaths;
  28. }
  29.  
  30. function EditClasspaths(message, classpaths)
  31. {
  32.     // Extract paths speparated by semicolons
  33.     
  34.     var classpathList = newList();
  35.     var start = 0;
  36.     if (typeof(classpaths) == "string")
  37.     {
  38.         var index = classpaths.indexOf(";")
  39.             while(index != -1)
  40.             {
  41.                 var classpath = classpaths.substring(start, index);
  42.                 classpathList.addTail(classpath);
  43.                 start = index + 1;
  44.                 index = classpaths.indexOf(";", start);
  45.             }
  46.         }
  47.     else
  48.     {
  49.         classpaths = "";
  50.     }
  51.     
  52.     if (start < classpaths.length)
  53.     {
  54.         var classpath = classpaths.substring(start, classpaths.length);
  55.         classpathList.addTail(classpath);
  56.     }
  57.     
  58.     var newClasspathList = editList("Classpaths", 
  59.         message,
  60.         classpathList, 
  61.         null,
  62.         EditClasspath,
  63.         null,
  64.         false);
  65.     
  66.     if (newClasspathList)
  67.     {
  68.         var newclasspaths = "";
  69.         var position = newClasspathList.getHeadPosition();
  70.         while (position.valid)
  71.         {
  72.             newclasspaths += newClasspathList.getNext(position);
  73.             if (position.valid)
  74.             {
  75.                 newclasspaths += ";";
  76.             }
  77.         }
  78.         
  79.         if (newclasspaths != classpaths)
  80.         {
  81.             Application.setEvent("Classpath_changed", 1);
  82.         }
  83.         
  84.         return newclasspaths;
  85.     }
  86.     return classpaths;
  87. }
  88.  
  89. function EditClasspath(classpath)
  90. {
  91.     var newclasspath = editDirectoryFilePath("Enter your directory or archive path", 
  92.         "", classpath, 
  93.         "Archive files (*.zip;*.jar;*.cab)", "*.zip;*.jar;*.cab");
  94.     
  95.     return newclasspath;
  96. }
  97.  
  98. !!/Script
  99.  
  100.