home *** CD-ROM | disk | FTP | other *** search
/ Enter 2006 February / enter-2006-02.iso / files / Illustrator_CS2_ue_TryOut.exe / bridge / Adobe Bridge 1.0.msi / Data1.cab / _1stackPane.jsx < prev    next >
Encoding:
Text File  |  2005-03-24  |  3.5 KB  |  110 lines

  1. /**************************************************************************
  2. *
  3. *  @@@BUILDINFO@@@ 31stackPane.jsx 1.0.0.47 07-Feb-2005
  4. *  Copyright 2005 Adobe Systems Incorporated
  5. *  All Rights Reserved.
  6. *
  7. * NOTICE:  All information contained herein is, and remains the property of
  8. * Adobe Systems Incorporated  and its suppliers,  if any.  The intellectual 
  9. * and technical concepts contained herein are proprietary to  Adobe Systems 
  10. * Incorporated  and its suppliers  and may be  covered by U.S.  and Foreign 
  11. * Patents,patents in process,and are protected by trade secret or copyright 
  12. * law.  Dissemination of this  information or reproduction of this material
  13. * is strictly  forbidden  unless prior written permission is  obtained from 
  14. * Adobe Systems Incorporated.
  15. **************************************************************************/
  16.  
  17. // Code to add to the Stack pane
  18. // The output field of the stack pane is a list box
  19.  
  20. // Set the stack trace window to the new stack
  21.  
  22. window.stack.update = function (text)
  23. {
  24.     var frames = text.split ('\n');
  25.     // if the last line is empty, discard it
  26.     if (frames [frames.length-1].length == 0)
  27.         frames.pop();
  28.     var oldMax = this.output.items.length - 1;
  29.     var newSize = frames.length;
  30.     for (var frame = 0; frame < newSize; frame++)
  31.     {
  32.         var curFrame = frames [frame];
  33.         if (curFrame == "[toplevel]")
  34.             curFrame = localize ("$$$/ESToolkit/Panes/Stack/Toplevel=[Top Level]");
  35.         $.bp (curFrame.length == 0);
  36.         if (oldMax < frame)
  37.             this.output.add ("item", curFrame);
  38.         else
  39.             this.output.items [frame].text = curFrame;
  40.     }
  41.     // delete excess frames
  42.     while (this.output.items.length > newSize)
  43.         this.output.remove (this.output.items.length - 1);
  44.     // Select the last frame
  45.     this.output.selection = this.output.items.length - 1;
  46. }
  47.  
  48. // Grow the stack by adding the supplied text
  49. // TBD: Remove this
  50.  
  51. window.stack.grow = function (text)
  52. {
  53.     // the new stack lines are newline-separated
  54.     // remove the placeholder text
  55.     if (!this.running)
  56.         this.running = true, this.output.removeAll();
  57.         
  58.     var lines = text.split ('\n');
  59.     // the last line is empty
  60.     lines.pop();
  61.     for (var i = 0; i < lines.length; i++)
  62.     {
  63.         var line = lines [i];
  64.         if (line == "[toplevel]")
  65.             line = localize ("$$$/ESToolkit/Panes/Stack/Toplevel=[Top Level]");
  66.         this.output.add ("item", line);
  67.     }
  68.     this.output.selection = this.output.items.length - 1;
  69. }
  70.  
  71. // Shrink the stack to the given level
  72. // TBD: remove this old code
  73.  
  74. window.stack.shrink = function (level)
  75. {
  76.     while (this.output.items.length > level)
  77.         this.output.remove (this.output.items.length - 1);
  78.     this.output.selection = this.output.items.length - 1;
  79. }
  80.  
  81. // Clear the stack
  82.  
  83. window.stack.clear = function()
  84. {
  85.     var text = localize ("$$$/ESToolkit/Panes/Stack/NoStack=[no stack]");
  86.     this.output.removeAll();
  87.     this.output.add ("item", text);
  88.     this.running = false;
  89. }
  90.  
  91. // Switch to the bottom stack frame.
  92.  
  93. window.stack.switchToBottom = function()
  94. {
  95.     if (currentDebugger.state == Debugger.STOPPED)
  96.         currentDebugger.switchFrame (0);
  97. }
  98.  
  99. // The callback for the output list box is activated when the user
  100. // selects a different stack frame. In this case, the debugger displays
  101. // the selected stack frame if it is halted. If not, nothing happens.
  102.  
  103. window.stack.output.onChange = function()
  104. {
  105.     if (this.selection && currentDebugger.state == Debugger.STOPPED)
  106.         currentDebugger.switchFrame (this.items.length - 1 - this.selection.index);
  107. }
  108.  
  109. window.stack.clear();
  110.