/**
   * Clear the results and display notice to say an error occurred.
   *
   * @param error the error that occurred.
   */
  public void displayErrorResult(final Throwable error) {
    // match some friendly error messages.
    String errorText = null;
    if (error.getCause() != null && error.getCause() instanceof CheckstyleException) {

      for (final Pattern errorPattern : CHECKSTYLE_ERROR_PATTERNS.keySet()) {
        final Matcher errorMatcher = errorPattern.matcher(error.getCause().getMessage());
        if (errorMatcher.find()) {
          final Object[] args = new Object[errorMatcher.groupCount()];

          for (int i = 0; i < errorMatcher.groupCount(); ++i) {
            args[i] = errorMatcher.group(i + 1);
          }

          errorText = CheckStyleBundle.message(CHECKSTYLE_ERROR_PATTERNS.get(errorPattern), args);
        }
      }
    }

    if (errorText == null) {
      errorText = CheckStyleBundle.message("plugin.results.error");
    }

    treeModel.clear();
    treeModel.setRootText(errorText);

    clearProgress();
  }
  public void displayWarningResult(final String messageKey) {
    clearProgress();

    treeModel.clear();
    treeModel.setRootMessage(messageKey);
  }
  /**
   * Clear the results and display a 'scan in progress' notice.
   *
   * @param size the number of files being scanned.
   */
  public void displayInProgress(final int size) {
    setProgressBarMax(size);

    treeModel.clear();
    treeModel.setRootMessage("plugin.results.in-progress");
  }