public void processException(Exception e) {

    final ErrorWindow window;
    FriendlyErrorInfoSPI info = null;
    if (e.getMessage().contains("WrappedException")) {
      WrappedException we = (WrappedException) e.getCause();
      // java issue
      info = new DefaultFriendlyJavaErrorInfo();

    } else if (e.getMessage().contains("EcmaError")) {
      info = new DefaultFriendlyJavascriptErrorInfo();
    } else {
      info = new DefaultFriendlyErrorInfo();
    }
    window = new ErrorWindow(info.getSummary(), info.getSolutions());
    TextAreaOutputStream output = new TextAreaOutputStream(window.getDetailsArea());
    e.printStackTrace(new PrintStream(output));
    SwingUtilities.invokeLater(
        new Runnable() {

          public void run() {
            HUD mainHUD = HUDManagerFactory.getHUDManager().getHUD("main");

            HUDComponent component = mainHUD.createComponent(window);
            window.setHUDComponent(component);
            component.setDecoratable(true);
            component.setPreferredLocation(Layout.CENTER);

            mainHUD.addComponent(component);

            component.setVisible(true);
          }
        });
    logger.warning("Error in evaluation()!");
  }
Example #2
0
  public void checkWinWindow(Boolean win) {

    // if the user did not win then an error will be thrown by a window
    if (!win) {
      ErrorWindow ew = new ErrorWindow("Not Win", null, 0);
      ew.setVisible(true);
      time.start();
    }
    // if user did win then a new "WinWindow" will pop up
    else {
      WinWindow ww = new WinWindow(timeCount, counterPress, getLevel);
      ww.setVisible(true);
    }
  }
Example #3
0
 private void loginButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_loginButtonActionPerformed
   if (check()) {
     System.out.println("OK");
     MainWindow.main(this);
     this.setVisible(false);
   } else ErrorWindow.main("Ошибка входа в систему!", this);
 } // GEN-LAST:event_loginButtonActionPerformed
  /** Updates the error table in the Error Window. */
  public synchronized void updateErrorTable() {

    try {
      String[][] errorData = new String[problemsList.size()][3];
      for (int i = 0; i < problemsList.size(); i++) {
        errorData[i][0] = problemsList.get(i).message;
        errorData[i][1] = editor.getSketch().getCode(problemsList.get(i).tabIndex).getPrettyName();
        errorData[i][2] = problemsList.get(i).lineNumber + "";
      }

      // initializeErrorWindow();

      if (errorWindow != null) {
        DefaultTableModel tm = new DefaultTableModel(errorData, XQErrorTable.columnNames);
        if (errorWindow.isVisible()) errorWindow.updateTable(tm);
        ((XQEditor) editor).updateTable(tm);

        // A rotating slash animation on the title bar to show
        // that error checker thread is running

        slashAnimationIndex++;
        if (slashAnimationIndex == slashAnimation.length) slashAnimationIndex = 0;
        if (editor != null) {
          String info =
              slashAnimation[slashAnimationIndex]
                  + " T:"
                  + (System.currentTimeMillis() - lastTimeStamp)
                  + "ms";
          errorWindow.setTitle("Problems - " + editor.getSketch().getName() + " " + info);
        }
      }

    } catch (Exception e) {
      System.out.println("Exception at updateErrorTable() " + e);
      e.printStackTrace();
      stopThread();
    }
  }