home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / filesbbs / os2 / fp1os2.arj / OS2 / DATA / 49 / C / 0 / F_26836 / JScriptIDEWindow.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-05-15  |  26.6 KB  |  1,405 lines

  1. import java.awt.BorderLayout;
  2. import java.awt.Button;
  3. import java.awt.CardLayout;
  4. import java.awt.CheckboxMenuItem;
  5. import java.awt.Component;
  6. import java.awt.Container;
  7. import java.awt.Event;
  8. import java.awt.FileDialog;
  9. import java.awt.FlowLayout;
  10. import java.awt.Frame;
  11. import java.awt.GridBagConstraints;
  12. import java.awt.GridBagLayout;
  13. import java.awt.GridLayout;
  14. import java.awt.Insets;
  15. import java.awt.Label;
  16. import java.awt.Menu;
  17. import java.awt.MenuBar;
  18. import java.awt.MenuItem;
  19. import java.awt.Panel;
  20. import java.awt.TextArea;
  21. import java.awt.TextField;
  22. import java.awt.Window;
  23. import stardiv.tools.SjProtocolWindow;
  24.  
  25. public class JScriptIDEWindow extends Frame {
  26.    private static final int IDE_EDIT_STATE = 0;
  27.    private static final int IDE_DEBUG_STATE = 1;
  28.    private static final int IDE_RUN_STATE = 2;
  29.    private static final int IDE_COMPILE_STATE = 3;
  30.    private static final String MENU_FILE_NEW = "New";
  31.    private static final String MENU_FILE_OPEN = "Open";
  32.    private static final String MENU_FILE_SAVE = "Save";
  33.    private static final String MENU_FILE_SAVE_AS = "Save as";
  34.    private static final String MENU_FILE_CLOSE = "Close";
  35.    private static final String MENU_FILE_CLOSE_ALL = "Close all";
  36.    private static final String MENU_FILE_EXIT = "Exit";
  37.    private static final String MENU_DEBUGGER_CLEAR_ALL = "Clear all breakpoints (in act. codeblock)";
  38.    private static final String MENU_BROWSER_GLOBAL = "Global";
  39.    private static final String MENU_BROWSER_LOCAL = "Local";
  40.    private static final String MENU_BROWSER_SPECIAL = "Special";
  41.    private static final String MENU_BROWSER_REMOVE_ALL_WATCHES = "Remove all watches";
  42.    private static final String MENU_BROWSER_ENABLE = "enable";
  43.    private static final String BROWSER_NAME = "Browser ";
  44.    private static final String MODULE_MAIN_CODE_NAME = "(main)";
  45.    private static final String PCODE_NAME = " PCode ";
  46.    private static final String NEW_MODULE_NAME = "Module";
  47.    private static int NewModuleCount;
  48.    private static final String SPACE_FOR_LAYOUT = "                           ";
  49.    private JScriptManager rJSManager;
  50.    private int nState;
  51.    private String aFunctionName;
  52.    private JScriptCodeBlock aActCodeBlock;
  53.    private JScriptModule aActModule;
  54.    int[] nStartPCodePos;
  55.    private boolean bSourceChanged;
  56.    private boolean bNeedCompile;
  57.    private boolean bIDEOpen;
  58.    private boolean bLineNumbersOn;
  59.    private String aOldSourceTemp;
  60.    private static boolean bWithMenu = true;
  61.    SJIDETextArea aSourceEdit;
  62.    SJIDETextArea aPCodeEdit;
  63.    SJIDETextArea aExprStackEdit;
  64.    SJIDETextArea aCallLevelStackEdit;
  65.    SJIDETextArea aBrowserEdit;
  66.    SJIDETextArea aWatchEdit;
  67.    SJIDETextArea aOutputEdit;
  68.    TextField aBrowserEditField;
  69.    Button ButDoIt;
  70.    Button ButAddWatch;
  71.    Button ButSetVariable;
  72.    Button ButAddBreakpoint;
  73.    Label aJavaEnvText;
  74.    Button ButToCallLevelStack;
  75.    Button ButToExprStack;
  76.    Button ButToNext;
  77.    Panel aCardPanel;
  78.    CardLayout aStackCardLayout;
  79.    Label aActModuleName;
  80.    Label aActPCodeName;
  81.    Label aShowStatusText;
  82.    Label aShowStatus;
  83.    Label aBrowserName;
  84.    Panel aPCodePanel;
  85.    Button ButClearOutput;
  86.    Button ButClearAllWatches;
  87.    Button ButNextPCodeFcn;
  88.    Button ButNextBrowserMode;
  89.    Button ButRunModule;
  90.    Button ButStartDebugger;
  91.    Button ButCompile;
  92.    Button ButRTReset;
  93.    Button ButToggleLineNumbers;
  94.    Button ButStopDebugger;
  95.    Button ButListThreads;
  96.    Button ButKillAllThreads;
  97.    Button ButUpdateBrowser;
  98.    Button ButStart;
  99.    Button ButRun;
  100.    Button ButStepOver;
  101.    Button ButStepOut;
  102.    Button ButStep;
  103.    Button ButPCodeStep;
  104.    Button ButPCodeStepOver;
  105.    Button ButBreak;
  106.    Button ButReset;
  107.    Button ButTest;
  108.    MenuBar aMainMenu;
  109.    Menu aFileMenu;
  110.    MenuItem aFileOpen;
  111.    MenuItem aFileNew;
  112.    MenuItem aFileSave;
  113.    MenuItem aFileSaveAs;
  114.    MenuItem aFileClose;
  115.    MenuItem aFileCloseAll;
  116.    MenuItem aFileExit;
  117.    Menu aDebuggerMenu;
  118.    MenuItem aDebuggerClearAll;
  119.    Menu aCompilerMenu;
  120.    Menu aBrowserMenu;
  121.    MenuItem aBrowserGlobal;
  122.    MenuItem aBrowserLocal;
  123.    MenuItem aBrowserSpecial;
  124.    CheckboxMenuItem aBrowserEnable;
  125.    Menu aOptionsMenu;
  126.    Menu aModulesMenu;
  127.    Menu aFunctionsMenu;
  128.    Menu aManagerMenu;
  129.    Menu aHelpMenu;
  130.  
  131.    public TextArea GetOutputField() {
  132.       return this.aOutputEdit;
  133.    }
  134.  
  135.    public JScriptIDEWindow(JScriptManager var1) {
  136.       this(var1, false);
  137.    }
  138.  
  139.    public JScriptIDEWindow(JScriptManager var1, boolean var2) {
  140.       super("(Star)JavaScript-IDE");
  141.       this.rJSManager = var1;
  142.       this.bSourceChanged = false;
  143.       this.bNeedCompile = false;
  144.       this.bIDEOpen = false;
  145.       this.bLineNumbersOn = false;
  146.       NewModuleCount = 0;
  147.       this.aActCodeBlock = null;
  148.       this.aActModule = null;
  149.       this.aFunctionName = "(main)";
  150.       this.nState = 0;
  151.       ((Frame)this).setResizable(true);
  152.       this.CreateIDEMenu();
  153.       ((Container)this).setLayout(new BorderLayout());
  154.       this.DoNewLayout(var2);
  155.    }
  156.  
  157.    public final void SetJScriptManager(JScriptManager var1) {
  158.       this.rJSManager = var1;
  159.       this.UpDateIDE();
  160.    }
  161.  
  162.    public final void StartIDE() {
  163.       ((Window)this).show();
  164.       this.bIDEOpen = true;
  165.       this.EnterEditState();
  166.       this.UpDateIDE();
  167.    }
  168.  
  169.    public final synchronized void CloseIDE() {
  170.       ((Component)this).hide();
  171.       ((Frame)this).dispose();
  172.       this.NotifyIDEClosed();
  173.    }
  174.  
  175.    private final synchronized void CloseAndExit() {
  176.       ((Component)this).hide();
  177.       ((Frame)this).dispose();
  178.       this.NotifyIDEClosed();
  179.       if (this.rJSManager.IsSysExitAllowed()) {
  180.          System.exit(0);
  181.       }
  182.  
  183.    }
  184.  
  185.    private final synchronized void NotifyIDEClosed() {
  186.       this.bIDEOpen = false;
  187.       SjProtocolWindow.AddNotifyEvent(this, "JScritpIDEWindow.NotifyIDEClosed()");
  188.       this.notifyAll();
  189.       SjProtocolWindow.AddNotifyEventDONE(this, "JScritpIDEWindow.NotifyIDEClosed()");
  190.    }
  191.  
  192.    public final synchronized void WaitForIDEClosed() {
  193.       try {
  194.          while(this.bIDEOpen) {
  195.             SjProtocolWindow.AddWaitEvent(this, "JScritpIDEWindow.WaitForIDEClosed()");
  196.             this.wait();
  197.             SjProtocolWindow.AddWaitEventDONE(this, "JScritpIDEWindow.WaitForIDEClosed()");
  198.          }
  199.  
  200.       } catch (InterruptedException var1) {
  201.       }
  202.    }
  203.  
  204.    private final void DoNewLayout(boolean var1) {
  205.       int var2 = 0;
  206.       this.aSourceEdit = new SJIDETextArea("", 20, 60, true);
  207.       this.aPCodeEdit = new SJIDETextArea("", 8, 30);
  208.       this.aExprStackEdit = new SJIDETextArea("", 6, 30);
  209.       this.aCallLevelStackEdit = new SJIDETextArea("", 6, 30);
  210.       this.aBrowserEdit = new SJIDETextArea("", 5, 40);
  211.       this.aWatchEdit = new SJIDETextArea("", 5, 40);
  212.       this.aOutputEdit = new SJIDETextArea("", 4, 80);
  213.       GridBagLayout var3 = new GridBagLayout();
  214.       GridBagConstraints var4 = new GridBagConstraints();
  215.       var4.anchor = 10;
  216.       var4.fill = 1;
  217.       var4.gridheight = 1;
  218.       var4.gridwidth = 1;
  219.       var4.weightx = (double)1.0F;
  220.       var4.weighty = (double)1.0F;
  221.       var4.insets = new Insets(0, 0, 0, 4);
  222.       Panel var5 = new Panel();
  223.       ((Container)var5).setLayout(var3);
  224.       Panel var6 = new Panel();
  225.       ((Container)var6).setLayout(new BorderLayout());
  226.       this.aActModuleName = new Label("Quelltext");
  227.       ((Container)var6).add("North", this.aActModuleName);
  228.       ((Container)var6).add("Center", this.aSourceEdit);
  229.       var4.gridx = 0;
  230.       var4.gridy = var2;
  231.       var4.gridheight = 2;
  232.       var4.gridwidth = -1;
  233.       var3.setConstraints(var6, var4);
  234.       this.aPCodePanel = new Panel();
  235.       this.aPCodePanel.setLayout(new BorderLayout());
  236.       Panel var7 = new Panel();
  237.       ((Container)var7).setLayout(new FlowLayout(0));
  238.       this.aActPCodeName = new Label(" PCode                            ");
  239.       this.ButNextPCodeFcn = new Button("next");
  240.       ((Container)var7).add(this.ButNextPCodeFcn);
  241.       ((Container)var7).add(this.aActPCodeName);
  242.       this.aPCodePanel.add("North", var7);
  243.       this.aPCodePanel.add("Center", this.aPCodeEdit);
  244.       this.ButToCallLevelStack = new Button("to CallLevel");
  245.       this.ButToExprStack = new Button("to Expr");
  246.       Panel var8 = new Panel();
  247.       this.aCardPanel = var8;
  248.       ((Container)var8).setLayout(this.aStackCardLayout = new CardLayout());
  249.       Panel var9 = new Panel();
  250.       ((Container)var9).setLayout(new BorderLayout());
  251.       Panel var10 = new Panel();
  252.       ((Container)var10).setLayout(new FlowLayout(0));
  253.       ((Container)var10).add(this.ButToCallLevelStack);
  254.       ((Container)var10).add(new Label("Expression-Stack"));
  255.       ((Container)var9).add("North", var10);
  256.       ((Container)var9).add("Center", this.aExprStackEdit);
  257.       Panel var11 = new Panel();
  258.       ((Container)var11).setLayout(new BorderLayout());
  259.       Panel var12 = new Panel();
  260.       ((Container)var12).setLayout(new FlowLayout(0));
  261.       ((Container)var12).add(this.ButToExprStack);
  262.       ((Container)var12).add(new Label("Call-Level-Stack"));
  263.       ((Container)var11).add("North", var12);
  264.       ((Container)var11).add("Center", this.aCallLevelStackEdit);
  265.       ((Container)var8).add(var11);
  266.       ((Container)var8).add(var9);
  267.       var4.gridheight = 1;
  268.       var4.gridx = 1;
  269.       var4.gridy = var2;
  270.       var4.gridwidth = 0;
  271.       ++var2;
  272.       var3.setConstraints(this.aPCodePanel, var4);
  273.       var4.gridx = 1;
  274.       var4.gridy = var2;
  275.       var3.setConstraints(var8, var4);
  276.       ++var2;
  277.       Panel var13 = new Panel();
  278.       ((Container)var13).setLayout(new BorderLayout());
  279.       Panel var14 = new Panel();
  280.       ((Container)var14).setLayout(new FlowLayout(0));
  281.       ((Container)var14).add(this.ButNextBrowserMode = new Button("next"));
  282.       ((Container)var14).add(this.aBrowserName = new Label("Browser                            "));
  283.       ((Container)var13).add("North", var14);
  284.       ((Container)var13).add("Center", this.aBrowserEdit);
  285.       var4.gridx = 0;
  286.       var4.gridy = var2;
  287.       var4.gridwidth = -1;
  288.       var3.setConstraints(var13, var4);
  289.       Panel var15 = new Panel();
  290.       ((Container)var15).setLayout(new BorderLayout());
  291.       Panel var16 = new Panel();
  292.       ((Container)var16).setLayout(new FlowLayout(0));
  293.       ((Container)var16).add(new Label("Watch"));
  294.       ((Container)var16).add(this.ButClearAllWatches = new Button("Clear All"));
  295.       ((Container)var15).add("North", var16);
  296.       ((Container)var15).add("Center", this.aWatchEdit);
  297.       var4.gridx = 1;
  298.       var4.gridy = var2;
  299.       var4.gridwidth = 0;
  300.       var3.setConstraints(var15, var4);
  301.       ++var2;
  302.       Panel var17 = new Panel();
  303.       ((Container)var17).setLayout(new BorderLayout());
  304.       Panel var18 = new Panel();
  305.       ((Container)var18).setLayout(new FlowLayout(0));
  306.       ((Container)var18).add(new Label("Output"));
  307.       ((Container)var18).add(this.ButClearOutput = new Button("Clear"));
  308.       ((Container)var17).add("North", var18);
  309.       ((Container)var17).add("Center", this.aOutputEdit);
  310.       var4.gridx = 0;
  311.       var4.gridy = var2;
  312.       var4.gridwidth = 0;
  313.       var3.setConstraints(var17, var4);
  314.       ++var2;
  315.       ((Container)var5).add(var6);
  316.       ((Container)var5).add(this.aPCodePanel);
  317.       ((Container)var5).add(var8);
  318.       ((Container)var5).add(var13);
  319.       ((Container)var5).add(var15);
  320.       ((Container)var5).add(var17);
  321.       Panel var19 = new Panel();
  322.       ((Container)var19).setLayout(new FlowLayout(0));
  323.       this.aBrowserEditField = new TextField(15);
  324.       this.ButDoIt = new Button("browse it");
  325.       this.ButAddWatch = new Button("add watch");
  326.       this.ButSetVariable = new Button("set var");
  327.       this.ButAddBreakpoint = new Button("add breakpoint");
  328.       this.aJavaEnvText = new Label("init init init init init init init init init init");
  329.       var4.gridx = 0;
  330.       var4.gridy = var2;
  331.       var4.gridwidth = 0;
  332.       var3.setConstraints(var19, var4);
  333.       ++var2;
  334.       ((Container)var19).add(new Label("enter:"));
  335.       ((Container)var19).add(this.aBrowserEditField);
  336.       ((Container)var19).add(this.ButDoIt);
  337.       ((Container)var19).add(this.ButAddWatch);
  338.       ((Container)var19).add(this.ButSetVariable);
  339.       ((Container)var19).add(this.ButAddBreakpoint);
  340.       ((Container)var19).add(this.aJavaEnvText);
  341.       ((Container)var5).add(var19);
  342.       var4.weightx = (double)0.0F;
  343.       var4.weighty = (double)0.0F;
  344.       this.ButRunModule = new Button("Run Module");
  345.       this.ButStartDebugger = new Button("START Debugger");
  346.       this.ButStopDebugger = new Button("STOP Debugger");
  347.       this.ButListThreads = new Button("List Threads");
  348.       this.ButKillAllThreads = new Button("Kill all Threads");
  349.       this.ButTest = new Button("TEST");
  350.       this.ButCompile = new Button("Compile");
  351.       this.ButRTReset = new Button("RTI Reset");
  352.       this.ButToggleLineNumbers = new Button("toggle line#");
  353.       this.ButStart = new Button("Start");
  354.       this.ButRun = new Button("Run");
  355.       this.ButUpdateBrowser = new Button("Update Browser");
  356.       this.ButStep = new Button("Step");
  357.       this.ButStepOver = new Button("Step over");
  358.       this.ButStepOut = new Button("Step out");
  359.       this.ButPCodeStep = new Button("P-Code-Step");
  360.       this.ButPCodeStepOver = new Button("P-Code-Step over");
  361.       this.ButBreak = new Button("Break");
  362.       this.ButReset = new Button("Reset");
  363.       Panel var20 = new Panel();
  364.       Panel var21 = new Panel();
  365.       ((Container)var21).setLayout(new FlowLayout(0));
  366.       this.aShowStatusText = new Label("status:");
  367.       this.aShowStatus = new Label("IDE started...");
  368.       ((Container)var21).add(this.ButRunModule);
  369.       ((Container)var21).add(this.ButCompile);
  370.       ((Container)var21).add(this.ButRTReset);
  371.       ((Container)var21).add(this.ButToggleLineNumbers);
  372.       ((Container)var21).add(this.ButListThreads);
  373.       ((Container)var21).add(this.ButKillAllThreads);
  374.       ((Container)var21).add(this.ButTest);
  375.       ((Container)var21).add(this.aShowStatusText);
  376.       ((Container)var21).add(this.aShowStatus);
  377.       var4.gridx = 0;
  378.       var4.gridy = var2;
  379.       var3.setConstraints(var21, var4);
  380.       ((Container)var5).add(var21);
  381.       ++var2;
  382.       ((Container)var20).setLayout(new GridLayout(2, 5));
  383.       ((Container)var20).add(this.ButStartDebugger);
  384.       ((Container)var20).add(this.ButStopDebugger);
  385.       ((Container)var20).add(this.ButUpdateBrowser);
  386.       ((Container)var20).add(this.ButRun);
  387.       ((Container)var20).add(this.ButBreak);
  388.       ((Container)var20).add(this.ButReset);
  389.       ((Container)var20).add(this.ButStepOver);
  390.       ((Container)var20).add(this.ButStepOut);
  391.       ((Container)var20).add(this.ButStep);
  392.       ((Container)var20).add(this.ButPCodeStep);
  393.       ((Container)var20).add(this.ButPCodeStepOver);
  394.       var4.gridx = 0;
  395.       var4.gridy = var2;
  396.       var3.setConstraints(var20, var4);
  397.       ((Container)var5).add(var20);
  398.       ++var2;
  399.       if (var1) {
  400.          Panel var22 = new Panel();
  401.          ((Container)var22).setLayout(new FlowLayout(0));
  402.          ((Container)var22).add(new Label("Applet Warning Hack"));
  403.          var4.gridx = 0;
  404.          var4.gridy = var2;
  405.          var3.setConstraints(var22, var4);
  406.          ((Container)var5).add(var22);
  407.          ++var2;
  408.       }
  409.  
  410.       ((Container)this).add("Center", var5);
  411.       ((Window)this).pack();
  412.    }
  413.  
  414.    private void CreateIDEMenu() {
  415.       if (bWithMenu) {
  416.          this.aMainMenu = new MenuBar();
  417.          this.aFileMenu = new Menu("File");
  418.          this.aMainMenu.add(this.aFileMenu);
  419.          this.aFileMenu.add(this.aFileOpen = new MenuItem("Open"));
  420.          this.aFileMenu.add(this.aFileNew = new MenuItem("New"));
  421.          this.aFileMenu.add(this.aFileSave = new MenuItem("Save"));
  422.          this.aFileMenu.add(this.aFileSaveAs = new MenuItem("Save as"));
  423.          this.aFileMenu.add(this.aFileClose = new MenuItem("Close"));
  424.          this.aFileMenu.add(this.aFileCloseAll = new MenuItem("Close all"));
  425.          this.aFileMenu.addSeparator();
  426.          this.aFileMenu.add(this.aFileExit = new MenuItem("Exit"));
  427.          this.aCompilerMenu = new Menu("Compiler");
  428.          this.aMainMenu.add(this.aCompilerMenu);
  429.          this.aDebuggerMenu = new Menu("Debugger");
  430.          this.aDebuggerMenu.add(this.aDebuggerClearAll = new MenuItem("Clear all breakpoints (in act. codeblock)"));
  431.          this.aMainMenu.add(this.aDebuggerMenu);
  432.          this.aBrowserMenu = new Menu("Browser");
  433.          this.aBrowserMenu.add(this.aBrowserGlobal = new MenuItem("Global"));
  434.          this.aBrowserMenu.add(this.aBrowserLocal = new MenuItem("Local"));
  435.          this.aBrowserMenu.add(this.aBrowserSpecial = new MenuItem("Special"));
  436.          this.aBrowserMenu.addSeparator();
  437.          this.aBrowserMenu.add(this.aBrowserSpecial = new MenuItem("Remove all watches"));
  438.          this.aBrowserMenu.addSeparator();
  439.          this.aBrowserMenu.add(this.aBrowserEnable = new CheckboxMenuItem("enable"));
  440.          this.aBrowserEnable.setState(true);
  441.          this.aMainMenu.add(this.aBrowserMenu);
  442.          this.aOptionsMenu = new Menu("Options");
  443.          this.aMainMenu.add(this.aOptionsMenu);
  444.          this.aModulesMenu = new Menu("Modules");
  445.          this.aMainMenu.add(this.aModulesMenu);
  446.          this.aFunctionsMenu = new Menu("Functions");
  447.          this.aMainMenu.add(this.aFunctionsMenu);
  448.          this.aManagerMenu = new Menu("Managers");
  449.          this.aMainMenu.add(this.aManagerMenu);
  450.          this.aHelpMenu = new Menu("Help");
  451.          this.aHelpMenu.add(new MenuItem("Version: 12.12.1996"));
  452.          this.aMainMenu.add(this.aHelpMenu);
  453.          ((Frame)this).setMenuBar(this.aMainMenu);
  454.       }
  455.  
  456.    }
  457.  
  458.    public Insets insets() {
  459.       return bWithMenu ? new Insets(40, 10, 5, 5) : new Insets(20, 10, 5, 5);
  460.    }
  461.  
  462.    private boolean HandleAction(Event var1) {
  463.       if (bWithMenu && var1.id == 1001) {
  464.          if ((String)var1.arg == "New") {
  465.             this.NewModule();
  466.             return true;
  467.          }
  468.  
  469.          if ((String)var1.arg == "Open") {
  470.             this.LoadFile();
  471.             return true;
  472.          }
  473.  
  474.          if ((String)var1.arg == "Save") {
  475.             this.SaveFile();
  476.             return true;
  477.          }
  478.  
  479.          if ((String)var1.arg == "Save as") {
  480.             this.SaveFileAs();
  481.             return true;
  482.          }
  483.  
  484.          if ((String)var1.arg == "Close") {
  485.             this.rJSManager.DeleteModule(this.rJSManager.GetActModule());
  486.             this.UpDateIDE();
  487.             return true;
  488.          }
  489.  
  490.          if ((String)var1.arg == "Close all") {
  491.             this.rJSManager.DeleteAllModules();
  492.             this.UpDateIDE();
  493.             return true;
  494.          }
  495.  
  496.          if ((String)var1.arg == "Exit") {
  497.             this.CloseAndExit();
  498.             return true;
  499.          }
  500.  
  501.          if ((String)var1.arg == "Clear all breakpoints (in act. codeblock)") {
  502.             if (this.aActCodeBlock != null) {
  503.                this.aActCodeBlock.ClearAllBreakPoints();
  504.                this.SetCodeBlock(this.aActCodeBlock);
  505.                this.ShowStatus("cleared all breakpoints");
  506.             } else {
  507.                this.ShowStatus("nothing to do");
  508.             }
  509.  
  510.             return true;
  511.          }
  512.  
  513.          if ((String)var1.arg == "Global") {
  514.             this.rJSManager.Browser_SetMode(0);
  515.             this.UpDateIDE();
  516.             return true;
  517.          }
  518.  
  519.          if ((String)var1.arg == "Local") {
  520.             this.rJSManager.Browser_SetMode(1);
  521.             this.UpDateIDE();
  522.             return true;
  523.          }
  524.  
  525.          if ((String)var1.arg == "Special") {
  526.             this.rJSManager.Browser_SetSpecialName(this.aBrowserEditField.getText());
  527.             this.rJSManager.Browser_SetMode(2);
  528.             this.UpDateIDE();
  529.             return true;
  530.          }
  531.  
  532.          if ((String)var1.arg == "Remove all watches") {
  533.             this.rJSManager.Browser_RemoveAllWatches();
  534.             this.UpDateIDE();
  535.             return true;
  536.          }
  537.  
  538.          if ((String)var1.arg == "enable") {
  539.             if (!this.aBrowserEnable.getState()) {
  540.                this.rJSManager.Browser_SetEnable(false);
  541.                this.aBrowserEnable.setState(false);
  542.             } else {
  543.                this.rJSManager.Browser_SetEnable(true);
  544.                this.aBrowserEnable.setState(true);
  545.             }
  546.  
  547.             return true;
  548.          }
  549.  
  550.          for(int var2 = 0; var2 < this.aModulesMenu.countItems(); ++var2) {
  551.             if ((String)var1.arg == this.aModulesMenu.getItem(var2).getLabel()) {
  552.                this.rJSManager.SetActModuleNo(var2);
  553.                this.UpDateIDE();
  554.                return true;
  555.             }
  556.          }
  557.  
  558.          if ((String)var1.arg == "(main)") {
  559.             this.aFunctionName = (String)var1.arg;
  560.             this.SetCodeBlock(this.rJSManager.GetActModule().GetCodeBlock());
  561.             this.UpDateIDE();
  562.             return true;
  563.          }
  564.  
  565.          for(int var3 = 0; var3 < this.aFunctionsMenu.countItems() - 1; ++var3) {
  566.             if ((String)var1.arg == this.aFunctionsMenu.getItem(var3).getLabel()) {
  567.                JSbxProperty[] var4 = this.GetPropertyArrayFromActModule();
  568.                if (var4 != null) {
  569.                   this.SetCodeBlock(this.GetCodeBlockFromProperty(var4[var3]));
  570.                   this.aFunctionName = (String)var1.arg;
  571.                   this.UpDatePCodeName();
  572.                   return true;
  573.                }
  574.                break;
  575.             }
  576.          }
  577.  
  578.          for(int var5 = 0; var5 < this.aManagerMenu.countItems(); ++var5) {
  579.             if ((String)var1.arg == this.aManagerMenu.getItem(var5).getLabel()) {
  580.                JScriptManager.SelectJScriptManager(var5);
  581.                this.UpDateIDE();
  582.                return true;
  583.             }
  584.          }
  585.       }
  586.  
  587.       return false;
  588.    }
  589.  
  590.    public boolean handleEvent(Event var1) {
  591.       if (var1.id == 401 && var1.target == this.aSourceEdit && this.aSourceEdit.isEditable()) {
  592.          this.bSourceChanged = true;
  593.          this.bNeedCompile = true;
  594.          this.ShowStatus("source changed");
  595.       }
  596.  
  597.       if (var1.id == 201) {
  598.          this.CloseAndExit();
  599.          return true;
  600.       } else {
  601.          return this.HandleAction(var1) ? true : super.handleEvent(var1);
  602.       }
  603.    }
  604.  
  605.    public boolean action(Event var1, Object var2) {
  606.       try {
  607.          if (var1.target == this.ButListThreads) {
  608.             ThreadLister.listAllThreads(this.rJSManager.GetOutputPtrintStream());
  609.             return true;
  610.          }
  611.  
  612.          if (var1.target == this.ButKillAllThreads) {
  613.             this.rJSManager.DoKillAllJobs();
  614.             return true;
  615.          }
  616.  
  617.          if (var1.target == this.ButClearOutput) {
  618.             this.aOutputEdit.setText("");
  619.             return true;
  620.          }
  621.  
  622.          if (var1.target == this.ButClearAllWatches) {
  623.             this.rJSManager.Browser_RemoveAllWatches();
  624.             this.UpDateIDE();
  625.             return true;
  626.          }
  627.  
  628.          if (var1.target == this.ButNextPCodeFcn) {
  629.             this.SetNextPCodeBlock();
  630.             return true;
  631.          }
  632.  
  633.          if (var1.target == this.ButNextBrowserMode) {
  634.             this.rJSManager.Browser_NextMode();
  635.             this.UpDateIDE();
  636.             return true;
  637.          }
  638.  
  639.          if (var1.target == this.ButTest) {
  640.             this.rJSManager.CheckAllClients();
  641.             return true;
  642.          }
  643.  
  644.          if (var1.target == this.ButCompile) {
  645.             this.DoCompile();
  646.             return true;
  647.          }
  648.  
  649.          if (var1.target == this.ButRTReset) {
  650.             this.rJSManager.ResetRuntimeInstance();
  651.             this.UpDateIDE();
  652.             return true;
  653.          }
  654.  
  655.          if (var1.target == this.ButToggleLineNumbers) {
  656.             this.ToggleLineNumbers();
  657.             return true;
  658.          }
  659.  
  660.          if (var1.target == this.ButRunModule) {
  661.             this.DoRun();
  662.             return true;
  663.          }
  664.  
  665.          if (var1.target == this.ButStartDebugger) {
  666.             this.DoDebug();
  667.             return true;
  668.          }
  669.  
  670.          if (var1.target == this.ButStopDebugger) {
  671.             this.rJSManager.NotifyObservers(new JScriptAction(1010));
  672.             return true;
  673.          }
  674.  
  675.          if (var1.target == this.ButStart) {
  676.             this.rJSManager.NotifyObservers(new JScriptAction(1000));
  677.             return true;
  678.          }
  679.  
  680.          if (var1.target == this.ButUpdateBrowser) {
  681.             this.DebugActionStarted();
  682.             this.rJSManager.NotifyObservers(new JScriptAction(1016));
  683.             return true;
  684.          }
  685.  
  686.          if (var1.target == this.ButRun) {
  687.             this.DebugActionStarted();
  688.             this.ButBreak.enable();
  689.             this.rJSManager.NotifyObservers(new JScriptAction(1005));
  690.             return true;
  691.          }
  692.  
  693.          if (var1.target == this.ButBreak) {
  694.             this.DebugActionStarted();
  695.             this.rJSManager.NotifyObservers(new JScriptAction(1006));
  696.             return true;
  697.          }
  698.  
  699.          if (var1.target == this.ButStepOver) {
  700.             this.DebugActionStarted();
  701.             this.rJSManager.NotifyObservers(new JScriptAction(1011));
  702.             return true;
  703.          }
  704.  
  705.          if (var1.target == this.ButStepOut) {
  706.             this.DebugActionStarted();
  707.             this.rJSManager.NotifyObservers(new JScriptAction(1012));
  708.             return true;
  709.          }
  710.  
  711.          if (var1.target == this.ButStep) {
  712.             this.DebugActionStarted();
  713.             this.rJSManager.NotifyObservers(new JScriptAction(1001));
  714.             return true;
  715.          }
  716.  
  717.          if (var1.target == this.ButPCodeStep) {
  718.             this.DebugActionStarted();
  719.             this.rJSManager.NotifyObservers(new JScriptAction(1002));
  720.             return true;
  721.          }
  722.  
  723.          if (var1.target == this.ButPCodeStepOver) {
  724.             this.DebugActionStarted();
  725.             this.rJSManager.NotifyObservers(new JScriptAction(1015));
  726.             return true;
  727.          }
  728.  
  729.          if (var1.target == this.ButReset) {
  730.             this.DebugActionStarted();
  731.             this.rJSManager.NotifyObservers(new JScriptAction(1004));
  732.             return true;
  733.          }
  734.  
  735.          if (var1.target == this.ButDoIt) {
  736.             this.rJSManager.Browser_SetSpecialName(this.aBrowserEditField.getText());
  737.             this.rJSManager.Browser_SetMode(2);
  738.             this.UpDateIDE();
  739.             return true;
  740.          }
  741.  
  742.          if (var1.target == this.ButAddWatch) {
  743.             this.rJSManager.Browser_AddWatch(this.aBrowserEditField.getText());
  744.             this.UpDateIDE();
  745.             return true;
  746.          }
  747.  
  748.          if (var1.target == this.ButSetVariable) {
  749.             this.rJSManager.Browser_SetVar(this.aBrowserEditField.getText());
  750.             this.UpDateIDE();
  751.             return true;
  752.          }
  753.  
  754.          if (var1.target == this.ButAddBreakpoint) {
  755.             int var3 = Integer.parseInt(this.aBrowserEditField.getText());
  756.             if (this.aActCodeBlock != null) {
  757.                JScriptPCode var4 = this.aActCodeBlock.GetPCode(var3);
  758.                if (var4 instanceof JSP_DebugStep) {
  759.                   ((JSP_DebugStep)var4).SetBreakPoint(true);
  760.                   this.SetCodeBlock(this.aActCodeBlock);
  761.                   this.ShowStatus("set breakpoint");
  762.                } else {
  763.                   this.ShowStatus("Error setting breakpoint (invalid statement)");
  764.                }
  765.             } else {
  766.                this.ShowStatus("Error setting breakpoint (no codeblock)");
  767.             }
  768.  
  769.             return true;
  770.          }
  771.  
  772.          if (var1.target == this.ButToCallLevelStack || var1.target == this.ButToExprStack) {
  773.             this.aStackCardLayout.next(this.aCardPanel);
  774.             return true;
  775.          }
  776.       } catch (Exception var5) {
  777.          System.out.println("Exception: " + var5);
  778.       }
  779.  
  780.       return false;
  781.    }
  782.  
  783.    public final void EnterEditState() {
  784.       this.nState = 0;
  785.       this.aSourceEdit.setEditable(true);
  786.       this.ButRTReset.enable();
  787.       this.ButNextPCodeFcn.enable();
  788.       this.EnableFileMenu();
  789.       this.EnableModuleSwitching();
  790.       this.EnableManagerSwitching();
  791.       this.EnableFunctionsSwitching();
  792.       this.EnableCompiler();
  793.       this.EnableRun();
  794.       this.DisableDebugger();
  795.       this.ButStartDebugger.enable();
  796.    }
  797.  
  798.    public final void LeaveEditState() {
  799.       this.aSourceEdit.setEditable(false);
  800.       this.ButRTReset.disable();
  801.       this.ButNextPCodeFcn.disable();
  802.       this.DisableFileMenu();
  803.       this.DisableModuleSwitching();
  804.       this.DisableManagerSwitching();
  805.       this.DisableFunctionsSwitching();
  806.       this.DisableCompiler();
  807.       this.DisableRun();
  808.       this.ButStartDebugger.disable();
  809.    }
  810.  
  811.    public final void EnterDebugState() {
  812.       this.LeaveEditState();
  813.       this.EnableDebugger();
  814.       this.nState = 1;
  815.    }
  816.  
  817.    public final void EnterRunState() {
  818.       this.LeaveEditState();
  819.       this.nState = 2;
  820.    }
  821.  
  822.    public final void EnterCompileState() {
  823.       this.LeaveEditState();
  824.       this.nState = 3;
  825.    }
  826.  
  827.    public final void DebugActionStarted() {
  828.       this.DisableDebugger();
  829.       this.ButStopDebugger.enable();
  830.    }
  831.  
  832.    public final void DebugActionFinished() {
  833.       this.EnableDebugger();
  834.    }
  835.  
  836.    public final void ShowBrowserInfo(String var1) {
  837.       this.aBrowserEdit.setText(var1);
  838.    }
  839.  
  840.    public final void ShowBrowserTitle(String var1) {
  841.       this.aBrowserName.setText("Browser " + var1);
  842.    }
  843.  
  844.    public final void ShowBrowserWatch(String var1) {
  845.       this.aWatchEdit.setText(var1);
  846.    }
  847.  
  848.    public final void ShowStatus(String var1) {
  849.       this.aShowStatus.setText(var1);
  850.    }
  851.  
  852.    public final void ShowStatus(int var1) {
  853.       this.aShowStatus.setText(String.valueOf(var1));
  854.    }
  855.  
  856.    public final void ShowSourcePos(JScriptTokenPosition var1) {
  857.       if (var1 != null) {
  858.          int var2 = var1.GetStartPos();
  859.          int var3 = var1.GetEndPos();
  860.          this.aSourceEdit.requestFocus();
  861.          this.aSourceEdit.select(var2, var3);
  862.       }
  863.  
  864.    }
  865.  
  866.    public final void DoCompileStart() {
  867.       this.ShowStatus("compiling...");
  868.       this.EnterCompileState();
  869.    }
  870.  
  871.    public final void DoCompileDone() {
  872.       if (this.nState == 3) {
  873.          this.bNeedCompile = false;
  874.          this.ShowStatus("compiled.");
  875.          this.EnterEditState();
  876.          this.UpDateIDE();
  877.       }
  878.  
  879.    }
  880.  
  881.    public final void DoCompileError() {
  882.       if (this.nState == 3) {
  883.          this.bNeedCompile = true;
  884.          this.ShowStatus("Compiler Error");
  885.          this.EnterEditState();
  886.          this.UpDateIDE();
  887.       }
  888.  
  889.    }
  890.  
  891.    public final void DoRunStart() {
  892.       this.ShowStatus("running...");
  893.       this.EnterRunState();
  894.    }
  895.  
  896.    public final void DoRunDone() {
  897.       if (this.nState == 2) {
  898.          this.ShowStatus("Program finished.");
  899.          this.EnterEditState();
  900.          this.UpDateIDE();
  901.       }
  902.  
  903.    }
  904.  
  905.    public final void DoDebugStart() {
  906.       this.ShowStatus("debugger started...");
  907.       this.EnterDebugState();
  908.    }
  909.  
  910.    public final void DoDebugDone() {
  911.       if (this.nState == 1) {
  912.          this.DebugActionFinished();
  913.          this.EnterEditState();
  914.          this.ShowBrowserInfo("");
  915.          this.ShowBrowserWatch("");
  916.          this.ShowCallLevelStackString("");
  917.          this.ShowExpressionStackString("");
  918.          this.UpDateIDE();
  919.       }
  920.  
  921.    }
  922.  
  923.    public final void UpDateBrowser() {
  924.       this.rJSManager.Browser_UpDateInfos();
  925.    }
  926.  
  927.    public final void UpDateJavaEnv() {
  928.       Runtime var2 = Runtime.getRuntime();
  929.       String var1 = "memory: free=" + var2.freeMemory() + " / total=" + var2.totalMemory();
  930.       this.aJavaEnvText.setText(var1);
  931.    }
  932.  
  933.    public final void UpDatePCodeName() {
  934.       this.UpDatePCodeName(-1);
  935.    }
  936.  
  937.    public final void UpDatePCodeName(int var1) {
  938.       this.aActPCodeName.setText(this.aFunctionName + " PCode " + " PC: " + var1);
  939.    }
  940.  
  941.    public final void ClrSourcePos() {
  942.       this.aSourceEdit.select(0, 0);
  943.    }
  944.  
  945.    public final void ShowPCodePos(int var1) {
  946.       this.UpDatePCodeName(var1);
  947.       this.aPCodeEdit.InsertText("   >>>", this.nStartPCodePos[var1]);
  948.    }
  949.  
  950.    public final void ClrPCodePos() {
  951.       this.aPCodeEdit.RestoreInsertText();
  952.    }
  953.  
  954.    public final void ShowExpressionStackString(String var1) {
  955.       if (var1 == null) {
  956.          this.aExprStackEdit.setText("");
  957.       } else {
  958.          this.aExprStackEdit.setText(var1);
  959.       }
  960.    }
  961.  
  962.    public final void ShowCallLevelStackString(String var1) {
  963.       new StringBuffer();
  964.       if (var1 == null) {
  965.          this.aCallLevelStackEdit.setText("");
  966.       } else {
  967.          this.aCallLevelStackEdit.setText(var1);
  968.       }
  969.    }
  970.  
  971.    public final void CheckAndSetSourceFromModule(JScriptModule var1) {
  972.       if (this.aActModule != var1 && var1 != null) {
  973.          this.aActModule = var1;
  974.          this.SetSource(this.aActModule.GetSource());
  975.          this.rJSManager.SetAsActModule(this.aActModule);
  976.          this.UpDateFunctionsMenu();
  977.       }
  978.  
  979.    }
  980.  
  981.    public final void SetSource(String var1) {
  982.       this.aSourceEdit.setText(var1);
  983.    }
  984.  
  985.    public final void CheckAndSetCodeBlock(JScriptCodeBlock var1) {
  986.       if (this.aActCodeBlock != var1) {
  987.          this.aActCodeBlock = var1;
  988.          this.SetCodeBlock(this.aActCodeBlock);
  989.       }
  990.  
  991.    }
  992.  
  993.    public final void SetCodeBlock(JScriptCodeBlock var1) {
  994.       this.ClrPCodePos();
  995.       if (var1 != null) {
  996.          this.aActCodeBlock = var1;
  997.          if (var1.GetIDString() != null) {
  998.             this.aFunctionName = var1.GetIDString();
  999.          } else {
  1000.             this.aFunctionName = "(main)";
  1001.          }
  1002.  
  1003.          this.aPCodeEdit.setText(var1.DEBUG_GetInfoString());
  1004.          this.nStartPCodePos = var1.DEBUG_GetStartPosArray_AfterInfoString();
  1005.       } else {
  1006.          this.aPCodeEdit.setText("");
  1007.       }
  1008.    }
  1009.  
  1010.    private void SetNextPCodeBlock() {
  1011.       JSbxProperty[] var1 = this.GetPropertyArrayFromActModule();
  1012.       if (var1 != null) {
  1013.          if (this.aFunctionName == "(main)") {
  1014.             this.SetCodeBlock(this.GetCodeBlockFromProperty(var1[0]));
  1015.             this.aFunctionName = var1[0].GetName();
  1016.          } else {
  1017.             for(int var2 = 0; var2 < var1.length; ++var2) {
  1018.                if (this.aFunctionName == var1[var2].GetName()) {
  1019.                   if (var2 == var1.length - 1) {
  1020.                      this.aFunctionName = "(main)";
  1021.                      this.SetCodeBlock(this.rJSManager.GetActModule().GetCodeBlock());
  1022.                      this.UpDateIDE();
  1023.                   } else {
  1024.                      this.aFunctionName = var1[var2 + 1].GetName();
  1025.                      this.SetCodeBlock(this.GetCodeBlockFromProperty(var1[var2 + 1]));
  1026.                   }
  1027.                   break;
  1028.                }
  1029.             }
  1030.          }
  1031.  
  1032.          this.UpDatePCodeName();
  1033.       }
  1034.    }
  1035.  
  1036.    private final JScriptCodeBlock GetCodeBlockFromProperty(JSbxProperty var1) {
  1037.       JScriptMethod var2 = null;
  1038.       JSbxValue var3 = new JSbxValue();
  1039.  
  1040.       try {
  1041.          var1.Get(var3);
  1042.          JSbxBase var4 = var3.GetObject();
  1043.          if (var4 instanceof JScriptMethod) {
  1044.             var2 = (JScriptMethod)var4;
  1045.          } else {
  1046.             System.out.println("GetCodeBlockFromProperty() NO METHOD ! hided by: " + var4);
  1047.          }
  1048.       } catch (JSbxException var5) {
  1049.       }
  1050.  
  1051.       return var2 != null ? var2.GetCodeBlock() : null;
  1052.    }
  1053.  
  1054.    private final JSbxProperty[] GetPropertyArrayFromActModule() {
  1055.       return this.GetPropertyArrayFromModule(this.rJSManager.GetActModule());
  1056.    }
  1057.  
  1058.    private final JSbxProperty[] GetPropertyArrayFromModule(JScriptModule var1) {
  1059.       if (var1 == null) {
  1060.          return null;
  1061.       } else {
  1062.          JSbxNameArray var2 = ((JSbxObject)var1).DEBUG_GetNameArray();
  1063.          if (var2 == null) {
  1064.             return null;
  1065.          } else {
  1066.             JSbxProperty[] var3 = var2.GetArrayOfProperties();
  1067.             return var3;
  1068.          }
  1069.       }
  1070.    }
  1071.  
  1072.    private final void UpDateManagerMenu() {
  1073.       if (bWithMenu) {
  1074.          int var1 = this.aManagerMenu.countItems();
  1075.  
  1076.          for(int var2 = var1 - 1; var2 >= 0; --var2) {
  1077.             this.aManagerMenu.remove(var2);
  1078.          }
  1079.  
  1080.          var1 = JScriptManager.GetNoOfJScriptManagers();
  1081.  
  1082.          for(int var3 = 0; var3 < var1; ++var3) {
  1083.             this.aManagerMenu.add("Manger #" + var3);
  1084.          }
  1085.       }
  1086.  
  1087.    }
  1088.  
  1089.    private final void UpDateModuleMenu() {
  1090.       if (bWithMenu) {
  1091.          int var1 = this.aModulesMenu.countItems();
  1092.  
  1093.          for(int var2 = var1 - 1; var2 >= 0; --var2) {
  1094.             this.aModulesMenu.remove(var2);
  1095.          }
  1096.  
  1097.          var1 = this.rJSManager.GetModuleCount();
  1098.  
  1099.          for(int var3 = 0; var3 < var1; ++var3) {
  1100.             this.aModulesMenu.add(this.rJSManager.GetModuleName(var3));
  1101.          }
  1102.       }
  1103.  
  1104.    }
  1105.  
  1106.    public final void UpDateFunctionsMenu() {
  1107.       if (bWithMenu) {
  1108.          JSbxProperty[] var1 = this.GetPropertyArrayFromActModule();
  1109.          if (var1 == null) {
  1110.             return;
  1111.          }
  1112.  
  1113.          int var2 = this.aFunctionsMenu.countItems();
  1114.  
  1115.          for(int var3 = var2 - 1; var3 >= 0; --var3) {
  1116.             this.aFunctionsMenu.remove(var3);
  1117.          }
  1118.  
  1119.          for(int var4 = 0; var4 < var1.length; ++var4) {
  1120.             String var5 = var1[var4].GetName();
  1121.             JScriptCodeBlock var6 = this.GetCodeBlockFromProperty(var1[var4]);
  1122.             if (var6 != null) {
  1123.                var6.SetIDString(var5);
  1124.             }
  1125.  
  1126.             this.aFunctionsMenu.add(var5);
  1127.          }
  1128.  
  1129.          this.aFunctionsMenu.add("(main)");
  1130.          this.rJSManager.GetActModule().GetCodeBlock().SetIDString("(main)");
  1131.       }
  1132.  
  1133.    }
  1134.  
  1135.    public final void UpDateIDE() {
  1136.       if (((Component)this).isVisible()) {
  1137.          JScriptModule var1 = this.aActModule != null ? this.aActModule : this.rJSManager.GetActModule();
  1138.          if (var1 != null) {
  1139.             String var2 = var1.GetSource();
  1140.             this.SetSource(var2);
  1141.             JScriptCodeBlock var3 = this.aActCodeBlock != null ? this.aActCodeBlock : var1.GetCodeBlock();
  1142.             this.SetCodeBlock(var3);
  1143.             this.ShowModuleName(var1.GetName());
  1144.          } else {
  1145.             this.SetSource("");
  1146.             this.SetCodeBlock((JScriptCodeBlock)null);
  1147.             this.ShowModuleName("");
  1148.          }
  1149.  
  1150.          this.UpDateModuleMenu();
  1151.          this.UpDateFunctionsMenu();
  1152.          this.UpDateManagerMenu();
  1153.          this.UpDatePCodeName();
  1154.          this.UpDateBrowser();
  1155.          this.UpDateJavaEnv();
  1156.       }
  1157.    }
  1158.  
  1159.    private final void UpDateSourceCode() {
  1160.       String var1 = this.aSourceEdit.getText();
  1161.       JScriptModule var2 = this.rJSManager.GetActModule();
  1162.       if (var2 != null) {
  1163.          var2.SetSource(var1);
  1164.       } else {
  1165.          var2 = this.rJSManager.MakeModule(var1);
  1166.          var2.SetName(this.GetNewModuleName());
  1167.          this.rJSManager.SetAsActModule(var2);
  1168.       }
  1169.    }
  1170.  
  1171.    private final void NewModule() {
  1172.       this.UpDateSourceCode();
  1173.       JScriptModule var1 = this.rJSManager.MakeModule("");
  1174.       var1.SetName(this.GetNewModuleName());
  1175.       this.rJSManager.SetAsActModule(var1);
  1176.       this.SetSource("");
  1177.       this.UpDateIDE();
  1178.    }
  1179.  
  1180.    public final void LoadFile(String var1) {
  1181.       if (var1 != null && JScriptTools.ExistsFile(var1)) {
  1182.          String var2 = JScriptTools.GetStringFromFile(var1);
  1183.          JScriptModule var3 = this.rJSManager.MakeModule(var2);
  1184.          var3.SetName(var1);
  1185.          this.rJSManager.SetLastModuleAsActive();
  1186.          this.rJSManager.DoCompileActMod();
  1187.       }
  1188.  
  1189.       this.UpDateIDE();
  1190.    }
  1191.  
  1192.    private final void LoadFile() {
  1193.       FileDialog var2 = new FileDialog(this, "JScriptID Open File", 0);
  1194.       var2.setFile("*.js");
  1195.       ((Window)var2).show();
  1196.       String var1 = var2.getFile();
  1197.       this.LoadFile(var1);
  1198.    }
  1199.  
  1200.    private final void SaveFile() {
  1201.       this.UpDateSourceCode();
  1202.       JScriptTools.WriteStringToFile(this.rJSManager.GetActModule().GetName(), this.rJSManager.GetActModule().GetSource());
  1203.       this.bSourceChanged = false;
  1204.       this.ShowStatus("File saved.");
  1205.    }
  1206.  
  1207.    private final void SaveFileAs() {
  1208.       FileDialog var2 = new FileDialog(this, "JScriptID Save File As", 1);
  1209.       var2.setFile("*.js");
  1210.       ((Window)var2).show();
  1211.       String var1 = var2.getFile();
  1212.       if (var1 != null) {
  1213.          this.rJSManager.GetActModule().SetName(var1);
  1214.          this.SaveFile();
  1215.       } else {
  1216.          this.ShowStatus("WARNING: no File saved !");
  1217.       }
  1218.    }
  1219.  
  1220.    private final String GetNewModuleName() {
  1221.       return new String("Module" + NewModuleCount++);
  1222.    }
  1223.  
  1224.    private final void ShowModuleName(String var1) {
  1225.       this.aActModuleName.setText("Quelltext: " + var1);
  1226.    }
  1227.  
  1228.    private final void ToggleLineNumbers() {
  1229.       if (this.bLineNumbersOn) {
  1230.          this.aSourceEdit.setEditable(true);
  1231.          this.aSourceEdit.setText(this.aOldSourceTemp);
  1232.       } else {
  1233.          this.aSourceEdit.setEditable(false);
  1234.          this.aOldSourceTemp = this.aSourceEdit.getText();
  1235.          int var1 = 0;
  1236.          int var2 = 0;
  1237.          int var3 = 0;
  1238.  
  1239.          String var4;
  1240.          for(var4 = ""; (var3 = this.aOldSourceTemp.indexOf("\n", var2)) != -1; var2 = var3 + 1) {
  1241.             var4 = var4 + "#" + var1 + "#  " + this.aOldSourceTemp.substring(var2, var3) + "\n";
  1242.             ++var1;
  1243.          }
  1244.  
  1245.          var4 = var4 + "#" + var1 + "#  " + this.aOldSourceTemp.substring(var2) + "\n";
  1246.          this.aSourceEdit.setText(var4);
  1247.       }
  1248.  
  1249.       this.bLineNumbersOn = !this.bLineNumbersOn;
  1250.    }
  1251.  
  1252.    private final void DoCompile() {
  1253.       if (this.nState == 0) {
  1254.          this.UpDateSourceCode();
  1255.          this.rJSManager.DoCompileActMod();
  1256.       }
  1257.  
  1258.    }
  1259.  
  1260.    private final void DoRun() {
  1261.       if (this.nState == 0) {
  1262.          if (this.bNeedCompile) {
  1263.             this.UpDateSourceCode();
  1264.             this.rJSManager.DoCompileAndRunActMod();
  1265.             return;
  1266.          }
  1267.  
  1268.          this.rJSManager.DoRunActMod();
  1269.       }
  1270.  
  1271.    }
  1272.  
  1273.    private final void DoDebug() {
  1274.       if (this.nState == 0) {
  1275.          if (this.bNeedCompile) {
  1276.             this.UpDateSourceCode();
  1277.             this.rJSManager.DoCompileAndDebugActMod();
  1278.             return;
  1279.          }
  1280.  
  1281.          this.rJSManager.DoDebugActMod();
  1282.       }
  1283.  
  1284.    }
  1285.  
  1286.    private final void DisableFileMenu() {
  1287.       if (bWithMenu) {
  1288.          this.aFileOpen.disable();
  1289.          this.aFileNew.disable();
  1290.          this.aFileSave.disable();
  1291.          this.aFileSaveAs.disable();
  1292.          this.aFileClose.disable();
  1293.          this.aFileCloseAll.disable();
  1294.       }
  1295.  
  1296.    }
  1297.  
  1298.    private final void EnableFileMenu() {
  1299.       if (bWithMenu) {
  1300.          this.aFileOpen.enable();
  1301.          this.aFileNew.enable();
  1302.          this.aFileSave.enable();
  1303.          this.aFileSaveAs.enable();
  1304.          this.aFileClose.enable();
  1305.          this.aFileCloseAll.enable();
  1306.          this.aFileExit.enable();
  1307.       }
  1308.  
  1309.    }
  1310.  
  1311.    private final void DisableModuleSwitching() {
  1312.       if (bWithMenu) {
  1313.          this.aModulesMenu.disable();
  1314.       }
  1315.  
  1316.    }
  1317.  
  1318.    private final void EnableModuleSwitching() {
  1319.       if (bWithMenu) {
  1320.          this.aModulesMenu.enable();
  1321.       }
  1322.  
  1323.    }
  1324.  
  1325.    private final void DisableManagerSwitching() {
  1326.       if (bWithMenu) {
  1327.          this.aManagerMenu.disable();
  1328.       }
  1329.  
  1330.    }
  1331.  
  1332.    private final void EnableManagerSwitching() {
  1333.       if (bWithMenu) {
  1334.          this.aManagerMenu.enable();
  1335.       }
  1336.  
  1337.    }
  1338.  
  1339.    private final void DisableFunctionsSwitching() {
  1340.       if (bWithMenu) {
  1341.          this.aFunctionsMenu.disable();
  1342.       }
  1343.  
  1344.    }
  1345.  
  1346.    private final void EnableFunctionsSwitching() {
  1347.       if (bWithMenu) {
  1348.          this.aFunctionsMenu.enable();
  1349.       }
  1350.  
  1351.    }
  1352.  
  1353.    private final void EnableDebugger() {
  1354.       this.ButStopDebugger.enable();
  1355.       this.ButStart.enable();
  1356.       this.ButRun.enable();
  1357.       this.ButUpdateBrowser.enable();
  1358.       this.ButStepOver.enable();
  1359.       this.ButStepOut.enable();
  1360.       this.ButStep.enable();
  1361.       this.ButPCodeStep.enable();
  1362.       this.ButPCodeStepOver.enable();
  1363.       this.ButBreak.enable();
  1364.       this.ButReset.enable();
  1365.    }
  1366.  
  1367.    private final void DisableDebugger() {
  1368.       this.ButStopDebugger.disable();
  1369.       this.ButStart.disable();
  1370.       this.ButRun.disable();
  1371.       this.ButUpdateBrowser.disable();
  1372.       this.ButStepOver.disable();
  1373.       this.ButStepOut.disable();
  1374.       this.ButStep.disable();
  1375.       this.ButPCodeStep.disable();
  1376.       this.ButPCodeStepOver.disable();
  1377.       this.ButBreak.disable();
  1378.       this.ButReset.disable();
  1379.    }
  1380.  
  1381.    private final void EnableRun() {
  1382.       this.ButRunModule.enable();
  1383.    }
  1384.  
  1385.    private final void DisableRun() {
  1386.       this.ButRunModule.disable();
  1387.    }
  1388.  
  1389.    private final void EnableCompiler() {
  1390.       this.ButCompile.enable();
  1391.       if (bWithMenu) {
  1392.          this.aCompilerMenu.enable();
  1393.       }
  1394.  
  1395.    }
  1396.  
  1397.    private final void DisableCompiler() {
  1398.       this.ButCompile.disable();
  1399.       if (bWithMenu) {
  1400.          this.aCompilerMenu.disable();
  1401.       }
  1402.  
  1403.    }
  1404. }
  1405.