コード例 #1
0
  @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);
    }
  }
コード例 #2
0
ファイル: CompilerTask.java プロジェクト: Zeratyl-SK/consulo
 private static String[] convertMessage(final CompilerMessage message) {
   String text = message.getMessage();
   if (!text.contains("\n")) {
     return new String[] {text};
   }
   ArrayList<String> lines = new ArrayList<String>();
   StringTokenizer tokenizer = new StringTokenizer(text, "\n", false);
   while (tokenizer.hasMoreTokens()) {
     lines.add(tokenizer.nextToken());
   }
   return ArrayUtil.toStringArray(lines);
 }
コード例 #3
0
 @Override
 public void finished(
     boolean aborted, int errors, int warnings, final CompileContext compileContext) {
   try {
     for (CompilerMessageCategory category : CompilerMessageCategory.values()) {
       for (CompilerMessage message : compileContext.getMessages(category)) {
         final String msg = message.getMessage();
         if (category != CompilerMessageCategory.INFORMATION
             || !msg.startsWith("Compilation completed successfully")) {
           myMessages.add(category + ": " + msg);
         }
       }
     }
     if (errors > 0) {
       fail("Compiler errors occurred! " + StringUtil.join(myMessages, "\n"));
     }
     assertFalse("Code did not compile!", aborted);
   } catch (Throwable t) {
     myError = t;
   } finally {
     mySemaphore.up();
   }
 }