예제 #1
0
  private void doAddMessage(final CompilerMessage message) {
    synchronized (myMessageViewLock) {
      if (myErrorTreeView != null) {
        final Navigatable navigatable = message.getNavigatable();
        final VirtualFile file = message.getVirtualFile();
        final CompilerMessageCategory category = message.getCategory();
        final int type = translateCategory(category);
        final String[] text = convertMessage(message);
        if (navigatable != null) {
          final String groupName =
              file != null ? file.getPresentableUrl() : category.getPresentableText();
          myErrorTreeView.addMessage(
              type,
              text,
              groupName,
              navigatable,
              message.getExportTextPrefix(),
              message.getRenderTextPrefix(),
              message.getVirtualFile());
        } else {
          myErrorTreeView.addMessage(type, text, file, -1, -1, message.getVirtualFile());
        }

        final boolean shouldAutoActivate =
            !myMessagesAutoActivated
                && (CompilerMessageCategory.ERROR.equals(category)
                    || (CompilerMessageCategory.WARNING.equals(category)
                        && !ErrorTreeViewConfiguration.getInstance(myProject).isHideWarnings()));
        if (shouldAutoActivate) {
          myMessagesAutoActivated = true;
          activateMessageView();
        }
      }
    }
  }
예제 #2
0
  public void addMessage(final CompilerMessage message) {
    prepareMessageView();

    final CompilerMessageCategory messageCategory = message.getCategory();
    if (CompilerMessageCategory.WARNING.equals(messageCategory)) {
      myWarningCount += 1;
    } else if (CompilerMessageCategory.ERROR.equals(messageCategory)) {
      myErrorCount += 1;
      informWolf(message);
    }

    if (ApplicationManager.getApplication().isDispatchThread()) {
      openMessageView();
      doAddMessage(message);
    } else {
      final Window window = getWindow();
      final ModalityState modalityState =
          window != null ? ModalityState.stateForComponent(window) : ModalityState.NON_MODAL;
      ApplicationManager.getApplication()
          .invokeLater(
              new Runnable() {
                @Override
                public void run() {
                  if (!myProject.isDisposed()) {
                    openMessageView();
                    doAddMessage(message);
                  }
                }
              },
              modalityState);
    }
  }
예제 #3
0
 public static int translateCategory(CompilerMessageCategory category) {
   if (CompilerMessageCategory.ERROR.equals(category)) {
     return MessageCategory.ERROR;
   }
   if (CompilerMessageCategory.WARNING.equals(category)) {
     return MessageCategory.WARNING;
   }
   if (CompilerMessageCategory.STATISTICS.equals(category)) {
     return MessageCategory.STATISTICS;
   }
   if (CompilerMessageCategory.INFORMATION.equals(category)) {
     return MessageCategory.INFORMATION;
   }
   LOG.error("Unknown message category: " + category);
   return 0;
 }