@Override
  public final void customize(
      final JList list,
      final T value,
      final int index,
      final boolean selected,
      final boolean hasFocus) {
    myText = StringBuilderSpinAllocator.alloc();
    try {
      doCustomize(list, value, index, selected, hasFocus);

      if (myText.length() == 0) {
        setText(null);
      } else {
        myText.insert(0, "<html><body style=\"white-space:nowrap\">");
        myText.append("</body></html>");
        setText(myText.toString());
      }
    } finally {
      StringBuilderSpinAllocator.dispose(myText);
      myText = null;
    }
  }
  private void doIndentCommenting(Commenter commenter) {
    CharSequence chars = myDocument.getCharsSequence();
    final FileType fileType = myFile.getFileType();
    Indent minIndent =
        computeMinIndent(myStartLine, myEndLine, chars, myCodeStyleManager, fileType);

    for (int line = myEndLine; line >= myStartLine; line--) {
      int lineStart = myDocument.getLineStartOffset(line);
      int offset = lineStart;
      final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
      try {
        while (true) {
          String space = buffer.toString();
          Indent indent = myCodeStyleManager.getIndent(space, fileType);
          if (indent.isGreaterThan(minIndent) || indent.equals(minIndent)) break;
          char c = chars.charAt(offset);
          if (c != ' ' && c != '\t') {
            String newSpace = myCodeStyleManager.fillIndent(minIndent, fileType);
            myDocument.replaceString(lineStart, offset, newSpace);
            offset = lineStart + newSpace.length();
            break;
          }
          buffer.append(c);
          offset++;
        }
      } finally {
        StringBuilderSpinAllocator.dispose(buffer);
      }
      commentLine(line, offset, commenter);
    }
  }
 @Nullable
 private static String getAdditionalDocumentation(PsiElement elem) {
   final XmlTag xmlTag = PsiTreeUtil.getParentOfType(elem, XmlTag.class);
   if (xmlTag == null) {
     return null;
   }
   final AntDomElement antElement = AntSupport.getAntDomElement(xmlTag);
   if (antElement instanceof AntFilesProvider) {
     final List<File> list =
         ((AntFilesProvider) antElement).getFiles(new HashSet<AntFilesProvider>());
     if (list.size() > 0) {
       final @NonNls StringBuilder builder = StringBuilderSpinAllocator.alloc();
       try {
         final XmlTag tag = antElement.getXmlTag();
         if (tag != null) {
           builder.append("<b>");
           builder.append(tag.getName());
           builder.append(":</b>");
         }
         for (File file : list) {
           if (builder.length() > 0) {
             builder.append("<br>");
           }
           builder.append(file.getPath());
         }
         return builder.toString();
       } finally {
         StringBuilderSpinAllocator.dispose(builder);
       }
     }
   }
   return null;
 }
 @NotNull
 public PsiReference[] getReferencesByElement(
     @NotNull PsiElement element, @NotNull final ProcessingContext context) {
   final AntTarget target = (AntTarget) element;
   final XmlAttribute attr = target.getSourceElement().getAttribute("depends", null);
   if (attr == null) {
     return PsiReference.EMPTY_ARRAY;
   }
   final XmlAttributeValue xmlAttributeValue = attr.getValueElement();
   if (xmlAttributeValue == null) {
     return PsiReference.EMPTY_ARRAY;
   }
   int offsetInPosition =
       xmlAttributeValue.getTextRange().getStartOffset()
           - target.getTextRange().getStartOffset()
           + 1;
   final String value = attr.getValue();
   final List<PsiReference> result = PsiReferenceListSpinAllocator.alloc();
   try {
     final StringBuilder builder = StringBuilderSpinAllocator.alloc();
     try {
       int i = 0;
       int rightBound;
       final int valueLen = value.length();
       do {
         rightBound = (i < valueLen) ? value.indexOf(',', i) : valueLen;
         if (rightBound < 0) rightBound = valueLen;
         builder.setLength(0);
         int j = i;
         for (; j < rightBound; ++j) {
           builder.append(value.charAt(j));
         }
         j = 0;
         final int len = builder.length();
         for (; j < len; ++j) {
           if (!Character.isWhitespace(builder.charAt(j))) break;
         }
         final String targetName = (len == 0 || j == len) ? "" : builder.substring(j);
         result.add(
             new AntTargetReference(
                 target,
                 targetName,
                 new TextRange(
                     offsetInPosition + i + j, offsetInPosition + i + j + targetName.length()),
                 attr));
         i = rightBound + 1;
       } while (rightBound < valueLen);
       return (result.size() > 0)
           ? result.toArray(new PsiReference[result.size()])
           : PsiReference.EMPTY_ARRAY;
     } finally {
       StringBuilderSpinAllocator.dispose(builder);
     }
   } finally {
     PsiReferenceListSpinAllocator.dispose(result);
   }
 }
  private String getDisplayInfoInternal(boolean showPackageInfo, int totalTextLength) {
    if (isValid()) {
      final int lineNumber = myXBreakpoint.getSourcePosition().getLine() + 1;
      String className = getClassName();
      final boolean hasClassInfo = className != null && className.length() > 0;
      final String methodName = getMethodName();
      final String displayName = methodName != null ? methodName + "()" : null;
      final boolean hasMethodInfo = displayName != null && displayName.length() > 0;
      if (hasClassInfo || hasMethodInfo) {
        final StringBuilder info = StringBuilderSpinAllocator.alloc();
        try {
          boolean isFile = myXBreakpoint.getSourcePosition().getFile().getName().equals(className);
          String packageName = null;
          if (hasClassInfo) {
            final int dotIndex = className.lastIndexOf(".");
            if (dotIndex >= 0 && !isFile) {
              packageName = className.substring(0, dotIndex);
              className = className.substring(dotIndex + 1);
            }

            if (totalTextLength != -1) {
              if (className.length() + (hasMethodInfo ? displayName.length() : 0)
                  > totalTextLength + 3) {
                int offset = totalTextLength - (hasMethodInfo ? displayName.length() : 0);
                if (offset > 0 && offset < className.length()) {
                  className = className.substring(className.length() - offset);
                  info.append("...");
                }
              }
            }

            info.append(className);
          }
          if (hasMethodInfo) {
            if (isFile) {
              info.append(":");
            } else if (hasClassInfo) {
              info.append(".");
            }
            info.append(displayName);
          }
          if (showPackageInfo && packageName != null) {
            info.append(" (").append(packageName).append(")");
          }
          return DebuggerBundle.message(
              "line.breakpoint.display.name.with.class.or.method", lineNumber, info.toString());
        } finally {
          StringBuilderSpinAllocator.dispose(info);
        }
      }
      return DebuggerBundle.message("line.breakpoint.display.name", lineNumber);
    }
    return DebuggerBundle.message("status.breakpoint.invalid");
  }
Пример #6
0
 private static String makePath(final String parentPath, final String name) {
   if (parentPath.length() == 0) {
     return name;
   }
   final StringBuilder builder = StringBuilderSpinAllocator.alloc();
   try {
     return builder.append(parentPath).append("/").append(name).toString();
   } finally {
     StringBuilderSpinAllocator.dispose(builder);
   }
 }
Пример #7
0
 public static String createMacroClassName(final String macroName) {
   @NonNls final StringBuilder builder = StringBuilderSpinAllocator.alloc();
   try {
     builder.append(ANT_MACRODEF_NAME);
     builder.append("[");
     builder.append(macroName);
     builder.append("]");
     return builder.toString();
   } finally {
     StringBuilderSpinAllocator.dispose(builder);
   }
 }
Пример #8
0
  private void runAction(final EvaluationContextImpl context, LocatableEvent event) {
    if (LOG_ENABLED || LOG_EXPRESSION_ENABLED) {
      final StringBuilder buf = StringBuilderSpinAllocator.alloc();
      try {
        if (LOG_ENABLED) {
          buf.append(getEventMessage(event));
          buf.append("\n");
        }
        final DebugProcessImpl debugProcess = context.getDebugProcess();
        final TextWithImports expressionToEvaluate = getLogMessage();
        if (LOG_EXPRESSION_ENABLED
            && expressionToEvaluate != null
            && !"".equals(expressionToEvaluate.getText())) {
          if (!debugProcess.isAttached()) {
            return;
          }

          try {
            ExpressionEvaluator evaluator =
                DebuggerInvocationUtil.commitAndRunReadAction(
                    getProject(),
                    new EvaluatingComputable<ExpressionEvaluator>() {
                      public ExpressionEvaluator compute() throws EvaluateException {
                        return EvaluatorBuilderImpl.build(
                            expressionToEvaluate,
                            ContextUtil.getContextElement(context),
                            ContextUtil.getSourcePosition(context));
                      }
                    });
            final Value eval = evaluator.evaluate(context);
            final String result =
                eval instanceof VoidValue ? "void" : DebuggerUtils.getValueAsString(context, eval);
            buf.append(result);
          } catch (EvaluateException e) {
            buf.append(DebuggerBundle.message("error.unable.to.evaluate.expression"));
            buf.append(" \"");
            buf.append(expressionToEvaluate);
            buf.append("\"");
            buf.append(" : ");
            buf.append(e.getMessage());
          }
          buf.append("\n");
        }
        if (buf.length() > 0) {
          debugProcess.printToConsole(buf.toString());
        }
      } finally {
        StringBuilderSpinAllocator.dispose(buf);
      }
    }
  }
Пример #9
0
 public String toString() {
   if (myCachedToString == null) {
     final StringBuilder builder = StringBuilderSpinAllocator.alloc();
     try {
       for (String text : myTexts) {
         builder.append(text);
       }
       myCachedToString = builder.toString();
     } finally {
       StringBuilderSpinAllocator.dispose(builder);
     }
   }
   return myCachedToString;
 }
 public String getDisplayName() {
   if (!isValid()) {
     return DebuggerBundle.message("status.breakpoint.invalid");
   }
   final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
   try {
     buffer.append(myClassPattern);
     buffer.append(".");
     buffer.append(myMethodName);
     buffer.append("()");
     return buffer.toString();
   } finally {
     StringBuilderSpinAllocator.dispose(buffer);
   }
 }
  @Override
  public String generateDocumentationContentStub(PsiComment contextComment) {
    if (!(contextComment instanceof GrDocComment)) {
      return null;
    }

    final GrDocCommentOwner owner = GrDocCommentUtil.findDocOwner((GrDocComment) contextComment);
    if (owner == null) return null;

    Project project = contextComment.getProject();
    final CodeDocumentationAwareCommenter commenter =
        (CodeDocumentationAwareCommenter)
            LanguageCommenters.INSTANCE.forLanguage(owner.getLanguage());

    StringBuilder builder = StringBuilderSpinAllocator.alloc();
    try {
      if (owner instanceof GrMethod) {
        final GrMethod method = (GrMethod) owner;
        JavaDocumentationProvider.generateParametersTakingDocFromSuperMethods(
            project, builder, commenter, method);

        final PsiType returnType = method.getInferredReturnType();
        if ((returnType != null || method.getModifierList().hasModifierProperty(GrModifier.DEF))
            && !PsiType.VOID.equals(returnType)) {
          builder.append(
              CodeDocumentationUtil.createDocCommentLine(RETURN_TAG, project, commenter));
          builder.append(LINE_SEPARATOR);
        }

        final PsiClassType[] references = method.getThrowsList().getReferencedTypes();
        for (PsiClassType reference : references) {
          builder.append(
              CodeDocumentationUtil.createDocCommentLine(THROWS_TAG, project, commenter));
          builder.append(reference.getClassName());
          builder.append(LINE_SEPARATOR);
        }
      } else if (owner instanceof GrTypeDefinition) {
        final PsiTypeParameterList typeParameterList = ((PsiClass) owner).getTypeParameterList();
        if (typeParameterList != null) {
          JavaDocumentationProvider.createTypeParamsListComment(
              builder, project, commenter, typeParameterList);
        }
      }
      return builder.length() > 0 ? builder.toString() : null;
    } finally {
      StringBuilderSpinAllocator.dispose(builder);
    }
  }
 private void reportProblem(final String qualifiedName, @Nullable Exception ex) {
   String reason = null;
   if (ex != null) {
     reason = ex.getLocalizedMessage();
   }
   if (reason == null || reason.length() == 0) {
     reason = DebuggerBundle.message("error.io.error");
   }
   final StringBuilder buf = StringBuilderSpinAllocator.alloc();
   try {
     buf.append(qualifiedName).append(" : ").append(reason);
     myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, buf.toString());
   } finally {
     StringBuilderSpinAllocator.dispose(buf);
   }
 }
Пример #13
0
 private static String getDigitPrefix(final String indexName) {
   final StringBuilder builder = StringBuilderSpinAllocator.alloc();
   try {
     for (int i = 0; i < indexName.length(); i++) {
       final char c = indexName.charAt(i);
       if (Character.isDigit(c)) {
         builder.append(c);
       } else {
         break;
       }
     }
     return builder.toString();
   } finally {
     StringBuilderSpinAllocator.dispose(builder);
   }
 }
 public String generateDoc(PsiElement element, PsiElement originalElement) {
   final String mainDoc = getMainDocumentation(originalElement);
   final String additionalDoc = getAdditionalDocumentation(originalElement);
   if (mainDoc == null && additionalDoc == null) {
     return null;
   }
   final StringBuilder builder = StringBuilderSpinAllocator.alloc();
   try {
     if (additionalDoc != null) {
       builder.append(additionalDoc);
     }
     if (mainDoc != null) {
       builder.append(mainDoc);
     }
     return builder.toString();
   } finally {
     StringBuilderSpinAllocator.dispose(builder);
   }
 }
Пример #15
0
 public void addJavacMessage(AntMessage message, String url) {
   final StringBuilder builder = StringBuilderSpinAllocator.alloc();
   try {
     final VirtualFile file = message.getFile();
     if (message.getLine() > 0) {
       if (file != null) {
         ApplicationManager.getApplication()
             .runReadAction(
                 new Runnable() {
                   public void run() {
                     String presentableUrl = file.getPresentableUrl();
                     builder.append(presentableUrl);
                     builder.append(' ');
                   }
                 });
       } else if (url != null) {
         builder.append(url);
         builder.append(' ');
       }
       builder.append('(');
       builder.append(message.getLine());
       builder.append(':');
       builder.append(message.getColumn());
       builder.append(") ");
     }
     addJavacMessageImpl(
         new AntMessage(
             message.getType(),
             message.getPriority(),
             builder.toString() + message.getText(),
             message.getFile(),
             message.getLine(),
             message.getColumn()));
   } finally {
     StringBuilderSpinAllocator.dispose(builder);
   }
 }
Пример #16
0
 public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
   final AntElement element = getElement();
   if (element instanceof AntProject || element instanceof AntCall || element instanceof AntAnt) {
     getAttribute().setValue(newElementName);
   } else if (element instanceof AntTarget) {
     int start =
         getElementStartOffset() + getReferenceStartOffset() - getAttributeValueStartOffset();
     final String value = getAttribute().getValue();
     final StringBuilder builder = StringBuilderSpinAllocator.alloc();
     try {
       if (start > 0) {
         builder.append(value.substring(0, start));
       }
       builder.append(newElementName);
       if (value.length() > start + getRangeInElement().getLength()) {
         builder.append(value.substring(start + getRangeInElement().getLength()));
       }
       getAttribute().setValue(builder.toString());
     } finally {
       StringBuilderSpinAllocator.dispose(builder);
     }
   }
   return element;
 }
Пример #17
0
 public AntMessage(
     AntBuildMessageView.MessageType type,
     int priority,
     String[] lines,
     VirtualFile file,
     int line,
     int column) {
   myType = type;
   myPriority = priority;
   myFile = file;
   myLine = line;
   myColumn = column;
   myTextLines = lines;
   final StringBuilder builder = StringBuilderSpinAllocator.alloc();
   try {
     for (final String aLine : lines) {
       builder.append(aLine);
       builder.append('\n');
     }
     myText = builder.toString();
   } finally {
     StringBuilderSpinAllocator.dispose(builder);
   }
 }
  public String generateDocumentationContentStub(PsiComment contextComment) {
    if (!(contextComment instanceof GrDocComment)) {
      return null;
    }

    final GrDocCommentOwner owner = GrDocCommentUtil.findDocOwner((GrDocComment) contextComment);
    if (owner == null) return null;

    Project project = contextComment.getProject();
    final CodeDocumentationAwareCommenter commenter =
        (CodeDocumentationAwareCommenter)
            LanguageCommenters.INSTANCE.forLanguage(owner.getLanguage());

    StringBuilder builder = StringBuilderSpinAllocator.alloc();
    try {
      if (owner instanceof GrMethod) {
        final GrMethod method = (GrMethod) owner;
        final GrParameter[] parameters = method.getParameters();
        final Map<String, String> param2Description = new HashMap<String, String>();
        final PsiMethod[] superMethods = method.findSuperMethods();

        for (PsiMethod superMethod : superMethods) {
          final PsiDocComment comment = superMethod.getDocComment();
          if (comment != null) {
            final PsiDocTag[] params = comment.findTagsByName("param");
            for (PsiDocTag param : params) {
              final PsiElement[] dataElements = param.getDataElements();
              if (dataElements != null) {
                String paramName = null;
                for (PsiElement dataElement : dataElements) {
                  if (dataElement instanceof PsiDocParamRef) {
                    paramName = dataElement.getReference().getCanonicalText();
                    break;
                  }
                }
                if (paramName != null) {
                  param2Description.put(paramName, param.getText());
                }
              }
            }
          }
        }
        for (PsiParameter parameter : parameters) {
          String description = param2Description.get(parameter.getName());
          if (description != null) {
            builder.append(CodeDocumentationUtil.createDocCommentLine("", project, commenter));
            if (description.indexOf('\n') > -1)
              description = description.substring(0, description.lastIndexOf('\n'));
            builder.append(description);
          } else {
            builder.append(
                CodeDocumentationUtil.createDocCommentLine(PARAM_TAG, project, commenter));
            builder.append(parameter.getName());
          }
          builder.append(LINE_SEPARATOR);
        }

        final PsiType returnType = method.getInferredReturnType();
        if ((returnType != null || method.getModifierList().hasModifierProperty(GrModifier.DEF))
            && returnType != PsiType.VOID) {
          builder.append(
              CodeDocumentationUtil.createDocCommentLine(RETURN_TAG, project, commenter));
          builder.append(LINE_SEPARATOR);
        }

        final PsiClassType[] references = method.getThrowsList().getReferencedTypes();
        for (PsiClassType reference : references) {
          builder.append(
              CodeDocumentationUtil.createDocCommentLine(THROWS_TAG, project, commenter));
          builder.append(reference.getClassName());
          builder.append(LINE_SEPARATOR);
        }
      } else if (owner instanceof GrTypeDefinition) {
        final PsiTypeParameterList typeParameterList = ((PsiClass) owner).getTypeParameterList();
        if (typeParameterList != null) {
          createTypeParamsListComment(builder, project, commenter, typeParameterList);
        }
      }
      return builder.length() > 0 ? builder.toString() : null;
    } finally {
      StringBuilderSpinAllocator.dispose(builder);
    }
  }
 @SuppressWarnings("HardCodedStringLiteral")
 @NotNull
 public String getDescription() {
   final StringBuilder buf = StringBuilderSpinAllocator.alloc();
   try {
     buf.append("<html><body>");
     buf.append(getDisplayName());
     if (myInvalidMessage != null && !myInvalidMessage.isEmpty()) {
       buf.append("<br><font color='red'>");
       buf.append(DebuggerBundle.message("breakpoint.warning", myInvalidMessage));
       buf.append("</font>");
     }
     buf.append("&nbsp;<br>&nbsp;");
     buf.append(DebuggerBundle.message("breakpoint.property.name.suspend.policy")).append(" : ");
     if (DebuggerSettings.SUSPEND_NONE.equals(getSuspendPolicy()) || !isSuspend()) {
       buf.append(DebuggerBundle.message("breakpoint.properties.panel.option.suspend.none"));
     } else if (DebuggerSettings.SUSPEND_ALL.equals(getSuspendPolicy())) {
       buf.append(DebuggerBundle.message("breakpoint.properties.panel.option.suspend.all"));
     } else if (DebuggerSettings.SUSPEND_THREAD.equals(getSuspendPolicy())) {
       buf.append(DebuggerBundle.message("breakpoint.properties.panel.option.suspend.thread"));
     }
     buf.append("&nbsp;<br>&nbsp;");
     buf.append(DebuggerBundle.message("breakpoint.property.name.log.message")).append(": ");
     buf.append(isLogEnabled() ? CommonBundle.getYesButtonText() : CommonBundle.getNoButtonText());
     if (isLogExpressionEnabled()) {
       buf.append("&nbsp;<br>&nbsp;");
       buf.append(DebuggerBundle.message("breakpoint.property.name.log.expression")).append(": ");
       buf.append(XmlStringUtil.escapeString(getLogMessage().getText()));
     }
     if (isConditionEnabled()
         && getCondition() != null
         && getCondition().getText() != null
         && !getCondition().getText().isEmpty()) {
       buf.append("&nbsp;<br>&nbsp;");
       buf.append(DebuggerBundle.message("breakpoint.property.name.condition")).append(": ");
       buf.append(XmlStringUtil.escapeString(getCondition().getText()));
     }
     if (isCountFilterEnabled()) {
       buf.append("&nbsp;<br>&nbsp;");
       buf.append(DebuggerBundle.message("breakpoint.property.name.pass.count")).append(": ");
       buf.append(getCountFilter());
     }
     if (isClassFiltersEnabled()) {
       buf.append("&nbsp;<br>&nbsp;");
       buf.append(DebuggerBundle.message("breakpoint.property.name.class.filters")).append(": ");
       ClassFilter[] classFilters = getClassFilters();
       for (ClassFilter classFilter : classFilters) {
         buf.append(classFilter.getPattern()).append(" ");
       }
     }
     if (isInstanceFiltersEnabled()) {
       buf.append("&nbsp;<br>&nbsp;");
       buf.append(DebuggerBundle.message("breakpoint.property.name.instance.filters"));
       InstanceFilter[] instanceFilters = getInstanceFilters();
       for (InstanceFilter instanceFilter : instanceFilters) {
         buf.append(Long.toString(instanceFilter.getId())).append(" ");
       }
     }
     buf.append("</body></html>");
     return buf.toString();
   } finally {
     StringBuilderSpinAllocator.dispose(buf);
   }
 }
  public boolean processMessageLine(Callback callback) {
    if (super.processMessageLine(callback)) {
      return true;
    }
    final String line = callback.getCurrentLine();
    if (line == null) {
      return false;
    }
    if (JavacResourcesReader.MSG_PATTERNS_START.equals(line)) {
      myParserActions.clear();
      while (true) {
        final String patternLine = callback.getNextLine();
        if (JavacResourcesReader.MSG_PATTERNS_END.equals(patternLine)) {
          break;
        }
        addJavacPattern(patternLine);
      }
      return true;
    }

    int colonIndex1 = line.indexOf(':');
    if (colonIndex1 == 1) { // drive letter
      colonIndex1 = line.indexOf(':', colonIndex1 + 1);
    }

    if (colonIndex1 >= 0) { // looks like found something like file path
      @NonNls String part1 = line.substring(0, colonIndex1).trim();
      if (part1.equalsIgnoreCase("error") /*jikes*/ || part1.equalsIgnoreCase("Caused by")) {
        addMessage(callback, CompilerMessageCategory.ERROR, line.substring(colonIndex1));
        return true;
      }
      if (part1.equalsIgnoreCase("warning")) {
        addMessage(callback, CompilerMessageCategory.WARNING, line.substring(colonIndex1));
        return true;
      }
      if (part1.equals("javac")) {
        addMessage(callback, CompilerMessageCategory.ERROR, line);
        return true;
      }

      final int colonIndex2 = line.indexOf(':', colonIndex1 + 1);
      if (colonIndex2 >= 0) {
        final String filePath = part1.replace(File.separatorChar, '/');
        final Boolean fileExists =
            ApplicationManager.getApplication()
                .runReadAction(
                    new Computable<Boolean>() {
                      public Boolean compute() {
                        return LocalFileSystem.getInstance().findFileByPath(filePath) != null;
                      }
                    });
        if (!fileExists.booleanValue()) {
          // the part one turned out to be something else than a file path
          return true;
        }
        try {
          final int lineNum = Integer.parseInt(line.substring(colonIndex1 + 1, colonIndex2).trim());
          String message = line.substring(colonIndex2 + 1).trim();
          CompilerMessageCategory category = CompilerMessageCategory.ERROR;
          if (message.startsWith(WARNING_PREFIX)) {
            message = message.substring(WARNING_PREFIX.length()).trim();
            category = CompilerMessageCategory.WARNING;
          }

          List<String> messages = new ArrayList<String>();
          messages.add(message);
          int colNum;
          String prevLine = null;
          do {
            final String nextLine = callback.getNextLine();
            if (nextLine == null) {
              return false;
            }
            if (nextLine.trim().equals("^")) {
              final CharSequence chars = prevLine == null ? line : prevLine;
              final int offset = Math.max(0, Math.min(chars.length(), nextLine.indexOf('^')));
              colNum = EditorUtil.calcColumnNumber(null, chars, 0, offset, myTabSize);
              String messageEnd = callback.getNextLine();
              while (isMessageEnd(messageEnd)) {
                messages.add(messageEnd.trim());
                messageEnd = callback.getNextLine();
              }
              if (messageEnd != null) {
                callback.pushBack(messageEnd);
              }
              break;
            }
            if (prevLine != null) {
              messages.add(prevLine);
            }
            prevLine = nextLine;
          } while (true);

          if (colNum >= 0) {
            messages = convertMessages(messages);
            final StringBuilder buf = StringBuilderSpinAllocator.alloc();
            try {
              for (final String m : messages) {
                if (buf.length() > 0) {
                  buf.append("\n");
                }
                buf.append(m);
              }
              addMessage(
                  callback,
                  category,
                  buf.toString(),
                  VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, filePath),
                  lineNum,
                  colNum + 1);
            } finally {
              StringBuilderSpinAllocator.dispose(buf);
            }
            return true;
          }
        } catch (NumberFormatException ignored) {
        }
      }
    }

    if (line.endsWith("java.lang.OutOfMemoryError")) {
      addMessage(
          callback,
          CompilerMessageCategory.ERROR,
          CompilerBundle.message("error.javac.out.of.memory"));
      return true;
    }

    addMessage(callback, CompilerMessageCategory.INFORMATION, line);
    return true;
  }
 @Nullable
 public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) { // todo!
   if (element instanceof PomTargetPsiElement) {
     final PomTarget pomTarget = ((PomTargetPsiElement) element).getTarget();
     if (pomTarget instanceof DomTarget) {
       final DomElement domElement = ((DomTarget) pomTarget).getDomElement();
       if (domElement instanceof AntDomTarget) {
         final AntDomTarget antTarget = (AntDomTarget) domElement;
         final String description = antTarget.getDescription().getRawText();
         if (description != null && description.length() > 0) {
           final String targetName = antTarget.getName().getRawText();
           final StringBuilder builder = StringBuilderSpinAllocator.alloc();
           try {
             builder.append("Target");
             if (targetName != null) {
               builder.append(" \"").append(targetName).append("\"");
             }
             final XmlElement xmlElement = antTarget.getXmlElement();
             if (xmlElement != null) {
               final PsiFile containingFile = xmlElement.getContainingFile();
               if (containingFile != null) {
                 final String fileName = containingFile.getName();
                 builder.append(" [").append(fileName).append("]");
               }
             }
             return builder.append(" ").append(description).toString();
           } finally {
             StringBuilderSpinAllocator.dispose(builder);
           }
         }
       }
     } else if (pomTarget instanceof DomChildrenDescription) {
       final DomChildrenDescription description = (DomChildrenDescription) pomTarget;
       Type type = null;
       try {
         type = description.getType();
       } catch (UnsupportedOperationException e) {
         LOG.info(e);
       }
       if (type instanceof Class && AntDomElement.class.isAssignableFrom(((Class) type))) {
         final String elemName = description.getName();
         if (elemName != null) {
           final AntDomElement.Role role = description.getUserData(AntDomElement.ROLE);
           final StringBuilder builder = StringBuilderSpinAllocator.alloc();
           try {
             if (role == AntDomElement.Role.TASK) {
               builder.append("Task ");
             } else if (role == AntDomElement.Role.DATA_TYPE) {
               builder.append("Data structure ");
             }
             builder.append(elemName);
             return builder.toString();
           } finally {
             StringBuilderSpinAllocator.dispose(builder);
           }
         }
       }
     }
   }
   return null;
 }