Ejemplo n.º 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();
        }
      }
    }
  }
Ejemplo n.º 2
0
 @Override
 public int hashCode() {
   int result;
   result = myCategory.hashCode();
   result = 29 * result + myMessage.hashCode();
   result = 29 * result + (myFile != null ? myFile.hashCode() : 0);
   result = 29 * result + myRow;
   result = 29 * result + myColumn;
   return result;
 }
Ejemplo n.º 3
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof CompilerMessage)) return false;

    final CompilerMessageImpl compilerMessage = (CompilerMessageImpl) o;

    if (myColumn != compilerMessage.myColumn) return false;
    if (myRow != compilerMessage.myRow) return false;
    if (!myCategory.equals(compilerMessage.myCategory)) return false;
    if (myFile != null ? !myFile.equals(compilerMessage.myFile) : compilerMessage.myFile != null)
      return false;
    if (!myMessage.equals(compilerMessage.myMessage)) return false;

    return true;
  }
 @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();
   }
 }