home *** CD-ROM | disk | FTP | other *** search
/ Flash MX Savvy / FlashMX Savvy.iso / pc / WIN / UltraDev / UltraDev_Trial.exe / Disk1 / data1.cab / Configuration_En / Commands / debugSyntaxResults.js < prev    next >
Encoding:
JavaScript  |  2000-12-11  |  2.5 KB  |  103 lines

  1. //*************** GLOBAL VARS  *****************
  2.  
  3.  
  4. //******************* API **********************
  5.  
  6.  
  7. function receiveArguments()
  8. {
  9.     // get the results win from the persistent global property
  10.     var resultsWin = dw.constructor.MM_debuggerSyntaxResults;
  11.     var cmd = arguments[0];
  12.     if ( cmd == "init" )
  13.     {
  14.         var title = arguments[1];
  15.         var buttonTitle = arguments[2];
  16.         var colHeaders = arguments[3];
  17.         var colWidths = arguments[4];
  18.  
  19.         if ( resultsWin ) {
  20.             resultsWin.close();
  21.             resultsWin = null;
  22.         }
  23.  
  24.         resultsWin = dw.createResultsWindow(title, colHeaders);
  25.         resultsWin.setColumnWidths(colWidths);
  26.         resultsWin.setButtons(this, new Array(buttonTitle, "goToLine()"));
  27.         
  28.         // save the results win in a persistent global property
  29.         dw.constructor.MM_debuggerSyntaxResults = resultsWin;
  30.         //alert(dw.constructor.MM_debuggerSyntaxResults);
  31.     }
  32.     else if ( cmd == "addItem" )
  33.     {
  34.         var desc = arguments[1];
  35.         var filePath = arguments[2];
  36.         var off1 = arguments[3];
  37.         var off2 = arguments[4];
  38.         var cols = arguments[5];
  39.  
  40.         if ( resultsWin ) {
  41.             resultsWin.addItem(this, "", desc, filePath, off1, off2, cols);
  42.  
  43.             if ( resultsWin.getItemCount() == 1 )
  44.                 resultsWin.setSelectedItem(0);
  45.         }
  46.     }
  47.     else if ( cmd == "closeResults" )
  48.     {
  49.         if ( resultsWin ) {
  50.             resultsWin.close();
  51.             resultsWin = null;
  52.         }
  53.     }
  54. }
  55.  
  56. function getResultsWin()
  57. {
  58.     // get the results win from the persistent global property
  59.     var resultsWin = dw.constructor.MM_debuggerSyntaxResults;
  60.     return resultsWin;
  61. }
  62.  
  63. //***************** LOCAL FUNCTIONS  ******************
  64.  
  65. function onLoad()
  66. {
  67.     // do nothing since we did it all in receiveArguments
  68. }
  69.  
  70. // this callback function is called when the user presses 
  71. // Go To Line button in the results window
  72. function goToLine()
  73. {
  74.     var resultsWin = dw.constructor.MM_debuggerSyntaxResults;
  75.     //alert(resultsWin);
  76.     var selItem = resultsWin.getSelectedItem();
  77.     var itemVals = resultsWin.getItem(selItem);
  78.     var icon = itemVals[0];
  79.     var desc = itemVals[1];
  80.     var filePath = itemVals[2];
  81.     var off1 = new Number(itemVals[3]);
  82.     var off2 = new Number(itemVals[4]);
  83.     var cols = itemVals[5];
  84.     var theDoc = dw.openDocument(filePath);
  85.  
  86.     if (theDoc.getView() == 'split' || theDoc.getView() == 'code') 
  87.     {
  88.         dw.setFocus('textView');
  89.     }
  90.     else if (dw.getFloaterVisibility('html')) 
  91.     {
  92.         dw.setFocus('html');
  93.     }
  94.     else if ( theDoc.getView() == 'design' )
  95.     {
  96.         theDoc.setView('split')
  97.         dw.setFocus('textView');
  98.     }
  99.  
  100.     theDoc.source.setSelection(off1.valueOf(), off2.valueOf());
  101. }
  102.  
  103.