use of com.intellij.openapi.compiler.CompilerMessageCategory in project intellij-plugins by JetBrains.
the class FlexCompilerHandler method dispatchError.
private static void dispatchError(final String errLine, final CompilerMessagesBuffer messagesBuffer) {
final Matcher matcher = FlexCommonUtils.ERROR_PATTERN.matcher(errLine);
if (matcher.matches()) {
final String file = matcher.group(1);
final String additionalInfo = matcher.group(2);
final String line = matcher.group(3);
final String column = matcher.group(4);
final String type = matcher.group(5);
final String message = matcher.group(6);
final CompilerMessageCategory messageCategory = "Warning".equals(type) ? CompilerMessageCategory.WARNING : CompilerMessageCategory.ERROR;
final VirtualFile relativeFile = VfsUtil.findRelativeFile(file, null);
final StringBuilder fullMessage = new StringBuilder();
if (relativeFile == null)
fullMessage.append(file).append(": ");
if (additionalInfo != null)
fullMessage.append(additionalInfo).append(' ');
fullMessage.append(message);
messagesBuffer.addMessage(messageCategory, fullMessage.toString(), relativeFile != null ? relativeFile.getUrl() : null, line != null ? Integer.parseInt(line) : 0, column != null ? Integer.parseInt(column) : 0);
} else if (isErrorMessage(errLine)) {
final String errorPrefix = "Error: ";
final String errorText = errLine.startsWith(errorPrefix) ? errLine.substring(errorPrefix.length()) : errLine;
messagesBuffer.addMessage(CompilerMessageCategory.ERROR, errorText, null, -1, -1);
} else {
messagesBuffer.addMessage(CompilerMessageCategory.INFORMATION, errLine, null, -1, -1);
}
}
use of com.intellij.openapi.compiler.CompilerMessageCategory in project intellij-plugins by JetBrains.
the class ASC20CompilationTask method handleCompilerMessage.
/**
* @return <code>false</code> if error reported
*/
private boolean handleCompilerMessage(final FlexCompilationManager compilationManager, final String message) {
if ("^".equals(message)) {
// ignore this and previous line - no need to print source code in Messages tool window
myPreviousUnreportedMessage = null;
return true;
}
if ("command line".equals(message)) {
// ignore this line and print previous if any
printPreviousLine(compilationManager);
return true;
}
if (message.startsWith("Exception in thread \"")) {
printPreviousLine(compilationManager);
compilationManager.addMessage(this, CompilerMessageCategory.ERROR, message, null, -1, -1);
return false;
}
// see messages_en.properties from Falcon sources
if (message.startsWith("Warning: ") || message.startsWith("Error: ") || message.startsWith("Syntax error: ") || message.startsWith("Internal error: ")) {
final CompilerMessageCategory category = message.startsWith("Warning: ") ? CompilerMessageCategory.WARNING : CompilerMessageCategory.ERROR;
final int index = message.indexOf(": ");
final String usefulMessage = message.substring(index + ": ".length());
final Pair<String, Integer> sourcePathAndLine = FlexCommonUtils.getSourcePathAndLineFromASC20Message(myPreviousUnreportedMessage);
if (sourcePathAndLine == null) {
printPreviousLine(compilationManager);
compilationManager.addMessage(this, category, usefulMessage, null, -1, -1);
} else {
if (!isNotSupportedOptionFromGeneratedConfig(usefulMessage, sourcePathAndLine.first)) {
compilationManager.addMessage(this, category, usefulMessage, VfsUtilCore.pathToUrl(sourcePathAndLine.first), sourcePathAndLine.second, -1);
}
}
myPreviousUnreportedMessage = null;
return category == CompilerMessageCategory.WARNING;
}
printPreviousLine(compilationManager);
myPreviousUnreportedMessage = message;
return true;
}
Aggregations