From: aclement Date: Wed, 25 Mar 2009 16:19:48 +0000 (+0000) Subject: 269912: dont build message contexts for messages that will be output in the IDE X-Git-Tag: V1_6_4~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c732808dbf2daf655dc1c9ce4cddb20b8c27ab1a;p=aspectj.git 269912: dont build message contexts for messages that will be output in the IDE --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index 15df3fc6e..9f763e26a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -1082,7 +1082,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour if (unitResult.hasProblems() || unitResult.hasTasks()) { IProblem[] problems = unitResult.getAllProblems(); for (int i = 0; i < problems.length; i++) { - IMessage message = EclipseAdapterUtils.makeMessage(unitResult.compilationUnit, problems[i], getBcelWorld()); + IMessage message = EclipseAdapterUtils.makeMessage(unitResult.compilationUnit, problems[i], getBcelWorld(),progressListener); handler.handleMessage(message); } } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java index d84e2d557..7c92b223e 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java @@ -16,6 +16,7 @@ package org.aspectj.ajdt.internal.core.builder; import java.io.File; import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.IProgressListener; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.Message; import org.aspectj.bridge.SourceLocation; @@ -107,24 +108,31 @@ public class EclipseAdapterUtils { /** * Extract source location file, start and end lines, and context. Column is not extracted correctly. + * @param progressListener * * @return ISourceLocation with correct file and lines but not column. */ - public static ISourceLocation makeSourceLocation(ICompilationUnit unit, IProblem problem) { + public static ISourceLocation makeSourceLocation(ICompilationUnit unit, IProblem problem, IProgressListener progressListener) { int line = problem.getSourceLineNumber(); File file = new File(new String(problem.getOriginatingFileName())); - String context = makeLocationContext(unit, problem); - // XXX 0 column is wrong but recoverable from makeLocationContext - return new SourceLocation(file, line, line, 0, context); + // cheat here...269912 - don't build the context if under IDE control + if (progressListener!=null) { + return new SourceLocation(file, line, line, 0, null); + } else { + String context = makeLocationContext(unit, problem); + // XXX 0 column is wrong but recoverable from makeLocationContext + return new SourceLocation(file, line, line, 0, context); + } } /** * Extract message text and source location, including context. * * @param world + * @param progressListener */ - public static IMessage makeMessage(ICompilationUnit unit, IProblem problem, World world) { - ISourceLocation sourceLocation = makeSourceLocation(unit, problem); + public static IMessage makeMessage(ICompilationUnit unit, IProblem problem, World world, IProgressListener progressListener) { + ISourceLocation sourceLocation = makeSourceLocation(unit, problem, progressListener); IProblem[] seeAlso = problem.seeAlso(); // If the user has turned off classfile line number gen, then we may not be able to tell them // about all secondary locations (pr209372)