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

  1. !!Script
  2. // Copyright ⌐ 2001 - Modelworks Software
  3. // @Created build 503 cm20010320
  4.  
  5. /**
  6. @Tool: insertCommand~insert special variable
  7. into the command line.
  8. @EndTool: 
  9. @Summary: insertCommand~insert special variable
  10. */
  11.  
  12. var gCommandLineMapfile = getMapFile("CommandLine.map");
  13. var gOutput = getOutput();
  14.  
  15. function OnEvent(menu)
  16. {
  17.     var scriptPath = getScriptPath();
  18.     menu.appendItem("Choose File...",
  19.     scriptPath,
  20.     "Choose file path to insert",
  21.     false, "ChooseFile"); 
  22.  
  23.     menu.appendItem("Choose Directory...",
  24.     scriptPath,
  25.     "Choose directory path to insert",
  26.     false, "ChooseDirectory"); 
  27.  
  28.     menu.appendItem("$editor.path",
  29.     scriptPath,
  30.     "Insert the path to the active editor",
  31.     false, "$editor.path"); 
  32.     
  33.     menu.appendItem("$editor.directory",
  34.     scriptPath,
  35.     "Insert the directory of the active editor",
  36.     false, "$editor.directory"); 
  37.  
  38.     menu.appendItem("$editor.name",
  39.     scriptPath,
  40.     "Insert the name of the active editor",
  41.     false, "$editor.name"); 
  42.  
  43.     menu.appendItem("$editor.fileType",
  44.     scriptPath,
  45.     "Insert the file type of the active editor",
  46.     false, "$editor.fileType"); 
  47.     
  48.     menu.appendItem("$editor.sourcepath",
  49.     scriptPath,
  50.     "Insert the sourcepath of the active editor (java only)",
  51.     false, "$editor.sourcepath"); 
  52.  
  53.     menu.appendItem("$project.java.classpaths",
  54.     scriptPath,
  55.     "Insert the classpaths of the project (java only)",
  56.     false, "$project.java.classpaths"); 
  57.  
  58.     menu.appendItem("$java.jdk.customclasspaths",
  59.     scriptPath,
  60.     "Insert the custom classpaths (java only - see JDK menu)",
  61.     false, "$java.jdk.customclasspaths"); 
  62.  
  63.     menu.appendItem("$java.jdk.standardclasspaths",
  64.     scriptPath,
  65.     "Insert the standard classpaths (java only - see JDK menu)",
  66.     false, "$java.jdk.standardclasspaths"); 
  67.  
  68.     return true;
  69. }
  70.  
  71. function ChooseDirectory()
  72. {
  73.     var directory = gCommandLineMapfile.lookup("CurrentDirectory", "");
  74.     directory = chooseDirectory("Choose Directory", directory);
  75.     if (directory && directory.length > 0)
  76.     {
  77.         commandLineComboBox = getGlobal("CommandLine.CommandLineComboBox");
  78.         if (commandLineComboBox)
  79.         {
  80.             commandLineComboBox.text += " " + directory;
  81.         }
  82.     }
  83. }
  84.  
  85. function ChooseFile()
  86. {
  87.     var directory = gCommandLineMapfile.lookup("CurrentDirectory", "");
  88.     var file = chooseFile("Choose File", "*.*",  "*.*", directory);
  89.     if (file)
  90.     {
  91.         commandLineComboBox = getGlobal("CommandLine.CommandLineComboBox");
  92.         if (commandLineComboBox)
  93.         {
  94.             if (commandLineComboBox.text.length > 0)
  95.             {
  96.                 commandLineComboBox.text += " ";
  97.             }
  98.             commandLineComboBox.text += file.path;
  99.         }
  100.     }
  101. }
  102.  
  103. function DoCommand(id, cookie)
  104. {
  105.     if (cookie == "ChooseDirectory")
  106.     {
  107.         ChooseDirectory();
  108.     }
  109.     else if (cookie == "ChooseFile")
  110.     {
  111.         ChooseFile();
  112.     }
  113.     else
  114.     {
  115.         var commandLineComboBox = getGlobal("CommandLine.CommandLineComboBox");
  116.         if (commandLineComboBox)
  117.         {
  118.             commandLineComboBox.text += " " + cookie;
  119.         }
  120.     }
  121. }
  122.  
  123. !!/Script
  124.  
  125.