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

  1. !!Script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3.  
  4. /**
  5. @Tool: slashStarComment~comments a selection 
  6. with the Java/JavaScript multiline comment /* ... */. 
  7. @EndTool: 
  8. @Summary: slashStarComment~wraps a selection with a multiline comment  
  9. */
  10.  
  11. function DoCommand()
  12. {
  13.     var output = getOutput()
  14.         var editor = getActiveEditor();
  15.     if (editor)
  16.     {
  17.         var range = editor.getSelection();
  18.         
  19.         if (range.empty()) return; //dv20000416
  20.  
  21.         // Clear selection
  22.         editor.select(range.startLineIndex, range.startCharIndex, 
  23.             range.startLineIndex, range.startCharIndex);
  24.         
  25.         // Don't include the last line if no characters are selected on the line
  26.         if (range.endCharIndex == 0)
  27.         {
  28.             range.endLineIndex -= 1;
  29.             range.endCharIndex = 32000;
  30.         }
  31.         
  32.         var endRange =
  33.             editor.insert(range.endLineIndex, range.endCharIndex, "*/");
  34.         var startRange =
  35.             editor.insert(range.startLineIndex, range.startCharIndex, "/*");
  36.         
  37.         range.startCharIndex = startRange.startCharIndex;
  38.         range.endCharIndex = endRange.endCharIndex;
  39.         
  40.         editor.select(range);
  41.         editor.setActive();
  42.     }
  43. }
  44.  
  45. !!/Script
  46.