home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / web_dev / files / mwjpp516.exe / %MAINDIR% / Tools / Bookmark / insertBookmark.script < prev    next >
Encoding:
Text File  |  2001-06-19  |  709 b   |  34 lines

  1. !!Script 
  2. // Copyright ⌐ 2001 - Miguel Angel Rojas G.
  3. // @Modified build 497 cm20010225
  4.  
  5. /**
  6. @Summary: addAutoBookmark~adds an automatic bookmark for the current selection.  
  7. An automatic bookmark is auto-labeled.
  8.  
  9. */
  10.  
  11. function DoCommand()
  12.     var bookmarkMap = getMapFile( "Bookmarks" );
  13.     
  14.     var editor = getActiveEditor();
  15.     if (editor && editor.path.length == 0)
  16.     {
  17.         editor.save(); // Cannot set a bookmark in an unsaved file
  18.     }
  19.     
  20.     if (editor && editor.path.length > 0)
  21.     {
  22.         var selection = editor.getSelection();
  23.         var bookmark  = editor.newBookmark( selection.startLineIndex );
  24.         
  25.         if ( bookmark )
  26.         {
  27.             bookmarkMap.add(bookmark.hashKey, bookmark );
  28.         }
  29.     }
  30. }
  31.  
  32. !!/Script
  33.