use of com.intellij.problems.Problem in project intellij-community by JetBrains.
the class AutoMakeMessageHandler method informWolf.
private void informWolf(Project project, CmdlineRemoteProto.Message.BuilderMessage.CompileMessage message) {
final String srcPath = message.getSourceFilePath();
if (srcPath != null && !project.isDisposed()) {
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(srcPath);
if (vFile != null) {
final int line = (int) message.getLine();
final int column = (int) message.getColumn();
if (line > 0 && column > 0) {
final Problem problem = myWolf.convertToProblem(vFile, line, column, new String[] { message.getText() });
myWolf.weHaveGotProblems(vFile, Collections.singletonList(problem));
} else {
myWolf.queue(vFile);
}
}
}
}
use of com.intellij.problems.Problem in project intellij-community by JetBrains.
the class WolfTheProblemSolverImpl method reportProblems.
@Override
public void reportProblems(@NotNull final VirtualFile file, @NotNull Collection<Problem> problems) {
if (problems.isEmpty()) {
clearProblems(file);
return;
}
if (!isToBeHighlighted(file))
return;
boolean hasProblemsBefore;
boolean fireChanged;
synchronized (myProblems) {
final ProblemFileInfo oldInfo = myProblems.remove(file);
hasProblemsBefore = oldInfo != null;
ProblemFileInfo newInfo = new ProblemFileInfo();
myProblems.put(file, newInfo);
for (Problem problem : problems) {
newInfo.problems.add(problem);
newInfo.hasSyntaxErrors |= ((ProblemImpl) problem).isSyntaxOnly();
}
fireChanged = hasProblemsBefore && !oldInfo.equals(newInfo);
}
doQueue(file);
if (!hasProblemsBefore) {
fireProblemListeners.problemsAppeared(file);
} else if (fireChanged) {
fireProblemListeners.problemsChanged(file);
}
}
use of com.intellij.problems.Problem 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.Problem in project intellij-community by JetBrains.
the class GeneralHighlightingPass method convertToProblems.
private static List<Problem> convertToProblems(@NotNull Collection<HighlightInfo> infos, @NotNull VirtualFile file, final boolean hasErrorElement) {
List<Problem> problems = new SmartList<>();
for (HighlightInfo info : infos) {
if (info.getSeverity() == HighlightSeverity.ERROR) {
Problem problem = new ProblemImpl(file, info, hasErrorElement);
problems.add(problem);
}
}
return problems;
}
use of com.intellij.problems.Problem 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
}
}
Aggregations