Пример #1
0
 public void startModelValidating() {
   if (!isModelValid() && !validationStarted) {
     validationStarted = true;
     EventQueue.invokeLater(
         () -> {
           Scripts.LocalContext context = Scripts.getContext();
           RP.execute(
               () -> {
                 Scripts.setContext(context);
                 try {
                   validateModel();
                 } catch (Exception ex) {
                   Logger.getLogger(PlatypusDataObject.class.getName())
                       .log(Level.WARNING, ex.getMessage(), ex);
                 } finally {
                   Scripts.setContext(null);
                   EventQueue.invokeLater(
                       () -> {
                         validationStarted = false;
                         setModelValid(true);
                       });
                 }
               });
         });
   }
 }
    public void displayError(
        final String errorText, final Throwable exception, final boolean setFocus) {
      if (errorText == null) throw new NullPointerException("errorText");

      PROJECT_PROCESSOR.execute(
          new Runnable() {
            @Override
            public void run() {
              InputOutput io = IOProvider.getDefault().getIO(outputCaption, false);
              if (setFocus) {
                io.select();
              }

              OutputWriter err = io.getErr();
              outputLock.lock();
              try {
                err.println();
                err.println(errorText);
                if (exception != null) {
                  exception.printStackTrace(err);
                }
              } finally {
                outputLock.unlock();
                err.close();
              }
            }
          });
    }