home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Java / JDesignerPro / Jdp3_0.exe / data1.cab / Program_Files / JDPDebugger.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-04-09  |  3.8 KB  |  95 lines

  1. import java.awt.BorderLayout;
  2. import java.awt.Container;
  3. import java.awt.Panel;
  4. import java.awt.TextArea;
  5. import sun.tools.debug.RemoteClass;
  6. import sun.tools.debug.RemoteDebugger;
  7. import sun.tools.debug.RemoteStackVariable;
  8. import sun.tools.debug.RemoteThread;
  9. import sun.tools.debug.RemoteValue;
  10.  
  11. public class JDPDebugger extends JDPClassLayout {
  12.    RemoteDebugger debugger;
  13.    TextArea console;
  14.    boolean debugOn;
  15.  
  16.    public void addConsole(String text) {
  17.       this.console.setText(this.console.getText() + text + "\r\n");
  18.    }
  19.  
  20.    public void breakpointEvent(RemoteThread t) {
  21.       try {
  22.          this.debugger.findClass("SalesOrder");
  23.          RemoteValue rv = null;
  24.          RemoteStackVariable[] rsvs = t.getStackVariables();
  25.  
  26.          for(int ix = 0; ix < rsvs.length; ++ix) {
  27.             rv = rsvs[ix] == null ? null : rsvs[ix].getValue();
  28.             this.addConsole(rv.description());
  29.             this.addConsole(rv.toString());
  30.          }
  31.       } catch (Exception var7) {
  32.          ((Throwable)var7).printStackTrace();
  33.       }
  34.  
  35.       try {
  36.          this.debugger.cont();
  37.       } catch (Exception var6) {
  38.          ((Throwable)var6).printStackTrace();
  39.       }
  40.  
  41.    }
  42.  
  43.    public void threadDeathEvent(RemoteThread t) {
  44.       this.addConsole("thread death event");
  45.    }
  46.  
  47.    public void addConsoleVerbatim(String text) {
  48.       this.console.setText(this.console.getText() + text);
  49.    }
  50.  
  51.    public void exceptionEvent(RemoteThread t, String errorText) {
  52.       this.addConsole("exception caught");
  53.    }
  54.  
  55.    public void InitClass(JDPUser user, Panel targetPanel, String moduleParameter) {
  56.       ((Container)this).setLayout(new BorderLayout());
  57.       this.console = new TextArea("");
  58.       ((Container)this).add("Center", this.console);
  59.  
  60.       try {
  61.          String javaArgs = "-classpath .;\\jdk1.1.2\\lib\\classes.zip JDesignerPro http://205.219.62.2/JDesignerPro/ 01001 Guest a SalesOrder";
  62.          JDPDebuggerCallback dc = new JDPDebuggerCallback(this);
  63.          this.debugger = new RemoteDebugger(javaArgs, dc, false);
  64.  
  65.          try {
  66.             Thread.sleep(8000L);
  67.             RemoteValue obj = this.debugger.findClass("SalesOrder");
  68.             ((RemoteClass)obj).setBreakpointLine(162);
  69.          } catch (Exception var8) {
  70.             ((Throwable)var8).printStackTrace();
  71.          }
  72.       } catch (Exception var9) {
  73.          ((Throwable)var9).printStackTrace();
  74.       }
  75.  
  76.    }
  77.  
  78.    public void printToConsole(String text) {
  79.       this.addConsoleVerbatim(text);
  80.    }
  81.  
  82.    public void quitEvent() {
  83.       try {
  84.          RemoteValue obj = this.debugger.findClass("SalesOrder");
  85.          ((RemoteClass)obj).clearBreakpointLine(162);
  86.       } catch (Exception var3) {
  87.          ((Throwable)var3).printStackTrace();
  88.       }
  89.  
  90.       this.addConsole("quit event");
  91.       this.debugger.close();
  92.       this.debugger = null;
  93.    }
  94. }
  95.