Esempio n. 1
0
 public void evaluate() {
   try {
     // clear problems and console messages
     problemsView.setText("");
     consoleView.setText("");
     // update status view
     statusView.setText(" Parsing ...");
     tabbedPane.setSelectedIndex(0);
     LispExpr root = Parser.parse(textView.getText());
     statusView.setText(" Running ...");
     tabbedPane.setSelectedIndex(1);
     // update run button
     runButton.setIcon(stopImage);
     runButton.setActionCommand("Stop");
     // start run thread
     runThread = new RunThread(root);
     runThread.start();
   } catch (SyntaxError e) {
     tabbedPane.setSelectedIndex(0);
     System.err.println(
         "Syntax Error at " + e.getLine() + ", " + e.getColumn() + " : " + e.getMessage());
   } catch (Error e) {
     // parsing error
     System.err.println(e.getMessage());
     statusView.setText(" Errors.");
   }
 }
Esempio n. 2
0
    public void run() {
      try {
        while (runThread == this) {
          interpreter.evaluate(program);
          break;
        }
      } catch (Error e) {
        tabbedPane.setSelectedIndex(0);
        System.err.println("Runtime Error: " + e.getMessage());
      }

      // notify GUI that program execution finished
      runFinished();
    }
Esempio n. 3
0
 public void prettyPrint() {
   try {
     // clear old problem messages
     problemsView.setText("");
     // update status view
     statusView.setText(" Parsing ...");
     LispExpr root = Parser.parse(textView.getText());
     statusView.setText(" Pretty Printing ...");
     String newText = PrettyPrinter.prettyPrint(root);
     textView.setText(newText);
     statusView.setText(" Done.");
   } catch (Error e) {
     System.err.println(e.getMessage());
     statusView.setText(" Errors.");
   }
 }
Esempio n. 4
0
 public static void assumeNotHeadless() {
   boolean headless = true;
   try {
     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
     headless = ge.isHeadless();
   } catch (Exception e) {
     e.printStackTrace();
   } catch (Error e) {
     // Really not sure why this ever happens, maybe just jenkins issues
     e.printStackTrace();
   }
   if (headless) {
     System.out.println("You are trying to start a GUI in a headless environment. Aborting test");
   }
   org.junit.Assume.assumeTrue(!headless);
 }