use of com.intellij.problems.WolfTheProblemSolver in project intellij-community by JetBrains.
the class CompilerTask method informWolf.
private void informWolf(final CompilerMessage message) {
WolfTheProblemSolver wolf = WolfTheProblemSolver.getInstance(myProject);
VirtualFile file = getVirtualFile(message);
wolf.queue(file);
}
use of com.intellij.problems.WolfTheProblemSolver in project intellij-community by JetBrains.
the class GeneralHighlightingPass method reportErrorsToWolf.
private void reportErrorsToWolf() {
// e.g. errors in evaluate expression
if (!getFile().getViewProvider().isPhysical())
return;
Project project = getFile().getProject();
// do not report problems in libraries
if (!PsiManager.getInstance(project).isInProject(getFile()))
return;
VirtualFile file = getFile().getVirtualFile();
if (file == null)
return;
List<Problem> problems = convertToProblems(getInfos(), file, myHasErrorElement);
WolfTheProblemSolver wolf = WolfTheProblemSolver.getInstance(project);
boolean hasErrors = DaemonCodeAnalyzerEx.hasErrors(project, getDocument());
if (!hasErrors || isWholeFileHighlighting()) {
wolf.reportProblems(file, problems);
} else {
wolf.weHaveGotProblems(file, problems);
}
}
use of com.intellij.problems.WolfTheProblemSolver in project intellij-community by JetBrains.
the class OutputParser method processJavacMessages.
private static void processJavacMessages(final List<String> javacMessages, final AntBuildMessageView messageView, final Project project) {
if (javacMessages == null) {
return;
}
final com.intellij.compiler.OutputParser outputParser = new JavacOutputParser(project);
com.intellij.compiler.OutputParser.Callback callback = new com.intellij.compiler.OutputParser.Callback() {
private int myIndex = -1;
@Nullable
public String getCurrentLine() {
if (myIndex >= javacMessages.size()) {
return null;
}
return javacMessages.get(myIndex);
}
public String getNextLine() {
final int size = javacMessages.size();
final int next = Math.min(myIndex + 1, javacMessages.size());
myIndex = next;
if (next >= size) {
return null;
}
return javacMessages.get(next);
}
@Override
public void pushBack(String line) {
myIndex--;
}
public void message(final CompilerMessageCategory category, final String message, final String url, final int lineNum, final int columnNum) {
StringTokenizer tokenizer = new StringTokenizer(message, "\n", false);
final String[] strings = new String[tokenizer.countTokens()];
//noinspection ForLoopThatDoesntUseLoopVariable
for (int idx = 0; tokenizer.hasMoreTokens(); idx++) {
strings[idx] = tokenizer.nextToken();
}
ApplicationManager.getApplication().runReadAction(() -> {
VirtualFile file = url == null ? null : VirtualFileManager.getInstance().findFileByUrl(url);
messageView.outputJavacMessage(convertCategory(category), strings, file, url, lineNum, columnNum);
if (file != null && category == CompilerMessageCategory.ERROR) {
final WolfTheProblemSolver wolf = WolfTheProblemSolver.getInstance(project);
final Problem problem = wolf.convertToProblem(file, lineNum, columnNum, strings);
wolf.weHaveGotNonIgnorableProblems(file, Collections.singletonList(problem));
}
});
}
public void setProgressText(String text) {
}
public void fileProcessed(String path) {
}
public void fileGenerated(String path) {
}
};
try {
while (true) {
if (!outputParser.processMessageLine(callback)) {
break;
}
}
} catch (Exception e) {
//ignore
}
}
use of com.intellij.problems.WolfTheProblemSolver in project intellij-community by JetBrains.
the class AntBuildMessageView method outputError.
public void outputError(String error, int priority) {
updateErrorAndWarningCounters(priority);
final AntMessage message = createErrorMessage(priority, error);
addCommand(new AddMessageCommand(message));
WolfTheProblemSolver wolf = WolfTheProblemSolver.getInstance(myProject);
wolf.queue(message.getFile());
}
use of com.intellij.problems.WolfTheProblemSolver in project android by JetBrains.
the class RenderErrorContributor method reportRelevantCompilationErrors.
private void reportRelevantCompilationErrors(@NotNull RenderLogger logger, @NotNull RenderTask renderTask) {
Module module = logger.getModule();
if (module == null) {
return;
}
Project project = module.getProject();
WolfTheProblemSolver wolfgang = WolfTheProblemSolver.getInstance(project);
if (!wolfgang.hasProblemFilesBeneath(module)) {
return;
}
HtmlBuilder builder = new HtmlBuilder();
String summary = null;
if (logger.seenTagPrefix(TAG_RESOURCES_PREFIX)) {
// Do we have errors in the res/ files?
// See if it looks like we have aapt problems
boolean haveResourceErrors = wolfgang.hasProblemFilesBeneath(virtualFile -> virtualFile.getFileType() == StdFileTypes.XML);
if (haveResourceErrors) {
summary = "Resource errors";
builder.addBold("This project contains resource errors, so aapt did not succeed, " + "which can cause rendering failures. Fix resource problems first.").newline().newline();
}
} else if (renderTask.getLayoutlibCallback().isUsed()) {
boolean hasJavaErrors = wolfgang.hasProblemFilesBeneath(virtualFile -> virtualFile.getFileType() == StdFileTypes.JAVA);
if (hasJavaErrors) {
summary = "Compilation errors";
builder.addBold("This project contains Java compilation errors, " + "which can cause rendering failures for custom views. " + "Fix compilation problems first.").newline().newline();
}
}
if (summary == null) {
return;
}
addIssue().setSeverity(HighlightSeverity.ERROR).setSummary(summary).setHtmlContent(builder).build();
}
Aggregations