Exemple #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();
        }
      }
    }
  }
  @Override
  public void addMessage(CompilerMessage msg) {
    if (ApplicationManager.getApplication().isUnitTestMode()) {
      LOG.info("addMessage: " + msg + " this=" + this);
    }

    Collection<CompilerMessage> messages = myMessages.get(msg.getCategory());
    if (messages == null) {
      messages = new LinkedHashSet<CompilerMessage>();
      myMessages.put(msg.getCategory(), messages);
    }
    if (messages.add(msg)) {
      myTask.addMessage(msg);
    }

    if (ApplicationManager.getApplication().isCompilerServerMode()) {
      VirtualFile virtualFile = msg.getVirtualFile();
      CompilerClientConnector.getInstance(myProject)
          .addMessage(
              msg.getCategory(),
              msg.getMessage(),
              virtualFile == null ? null : virtualFile.getPath(),
              msg.getLine(),
              msg.getColumn());
    } else {
      ProblemsView.getInstance(myProject).addMessage(msg);
    }
  }
Exemple #3
0
 private static VirtualFile getVirtualFile(final CompilerMessage message) {
   VirtualFile virtualFile = message.getVirtualFile();
   if (virtualFile == null) {
     Navigatable navigatable = message.getNavigatable();
     if (navigatable instanceof OpenFileDescriptor) {
       virtualFile = ((OpenFileDescriptor) navigatable).getFile();
     }
   }
   return virtualFile;
 }