private static void doRun(final Project project, final VirtualFile instanceFile, final VirtualFile schemaFile) {
    saveFiles(instanceFile, schemaFile);

    final MessageViewHelper helper = new MessageViewHelper(
      project, RelaxngBundle.message("relaxng.message-viewer.tab-title.validate-relax-ng"), KEY);

    helper.openMessageView(() -> doRun(project, instanceFile, schemaFile));

    final Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(
      () -> ApplicationManager.getApplication().runReadAction(() -> {
        final MessageViewHelper.ErrorHandler eh = helper.new ErrorHandler();

        doValidation(instanceFile, schemaFile, eh);

        SwingUtilities.invokeLater(
          () -> {
            if (!eh.hadErrorOrWarning()) {
              SwingUtilities.invokeLater(
                () -> {
                  helper.close();
                  WindowManager.getInstance().getStatusBar(project).setInfo(
                    XmlBundle.message("xml.validate.no.errors.detected.status.message"));
                }
              );
            }
          }
        );
      }));

    helper.setProcessController(new NewErrorTreeViewPanel.ProcessController() {
      @Override
      public void stopProcess() {
        future.cancel(true);
      }

      @Override
      public boolean isProcessStopped() {
        return future.isDone();
      }
    });
  }
private static void doRun(final Project project, final VirtualFile instanceFile, final VirtualFile schemaFile)