Exemplo n.º 1
0
  /**
   * Applies the status to the status line of a dialog page.
   *
   * @param page the dialog page
   * @param status the status to apply
   */
  public static void applyToStatusLine(DialogPage page, IStatus status) {
    if (status == null) {
      page.setMessage(null, IMessageProvider.NONE);
      page.setErrorMessage(null);
      return;
    }

    String message = status.getMessage();

    if (message != null && message.length() == 0) {
      message = null;
    }

    switch (status.getSeverity()) {
      case IStatus.OK:
        page.setMessage(message, IMessageProvider.NONE);
        page.setErrorMessage(null);
        break;
      case IStatus.WARNING:
        page.setMessage(message, IMessageProvider.WARNING);
        page.setErrorMessage(null);
        break;
      case IStatus.INFO:
        page.setMessage(message, IMessageProvider.INFORMATION);
        page.setErrorMessage(null);
        break;
      default:
        page.setMessage(null);
        page.setErrorMessage(message);
        break;
    }
  }
Exemplo n.º 2
0
 /** Clears the normal message from the message line. */
 protected void clearMessage() {
   if (page != null) {
     page.setMessage(null);
   }
 }