Пример #1
0
 /**
  * Displays a message dialog containing the error specified in parameter.
  *
  * @param error a String representing an error message to display.
  */
 private void displayError(String error) {
   JOptionPane.showMessageDialog(
       mailsListPane.getParent(),
       error,
       String.format(
           i18n.get("mailslist.err.title"), Configuration.INSTANCE.get("application.name")),
       JOptionPane.ERROR_MESSAGE);
 }
Пример #2
0
  /**
   * Adds this object to the SMTP logs appender observable, to intercept logs.
   *
   * <p>The goal is to be informed when the log appender will received some debug SMTP logs.<br>
   * When a log is written, the appender will notify this class which will display it in the text
   * area.
   */
  private void addObserverToSmtpLogAppender() {
    Logger smtpLogger = LoggerFactory.getLogger(org.subethamail.smtp.server.Session.class);
    String appenderName = Configuration.INSTANCE.get("logback.appender.name");

    @SuppressWarnings("unchecked")
    SMTPLogsAppender<ILoggingEvent> appender =
        (SMTPLogsAppender<ILoggingEvent>)
            ((AppenderAttachable<ILoggingEvent>) smtpLogger).getAppender(appenderName);
    if (appender == null) {
      LoggerFactory.getLogger(LogsPane.class).error("Can't find logger: {}", appenderName);
    } else {
      appender.getObservable().addObserver(this);
    }
  }