String sourceCode = units[classIdx].getSourceCode();
IProblem[] problems = getJavaCompilationErrors(result);
for (int i = 0; i < problems.length; i++)
{
IProblem problem = problems[i];
//if (problem.isError())
{
problemBuffer.append(i + 1);
problemBuffer.append(". ");
problemBuffer.append(problem.getMessage());
if (
problem.getSourceStart() >= 0
&& problem.getSourceEnd() >= 0
)
{
int problemStartIndex = sourceCode.lastIndexOf("\n", problem.getSourceStart()) + 1;
int problemEndIndex = sourceCode.indexOf("\n", problem.getSourceEnd());
if (problemEndIndex < 0)
{
problemEndIndex = sourceCode.length();
}
problemBuffer.append("\n");
problemBuffer.append(
sourceCode.substring(
problemStartIndex,
problemEndIndex
)
);
problemBuffer.append("\n");
for(int j = problemStartIndex; j < problem.getSourceStart(); j++)
{
problemBuffer.append(" ");
}
if (problem.getSourceStart() == problem.getSourceEnd())
{
problemBuffer.append("^");
}
else
{
problemBuffer.append("<");
for(int j = problem.getSourceStart() + 1; j < problem.getSourceEnd(); j++)
{
problemBuffer.append("-");
}
problemBuffer.append(">");
}