1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.jci.compilers;
19
20 import org.apache.commons.jci.problems.CompilationProblem;
21 import org.eclipse.jdt.core.compiler.IProblem;
22
23
24
25
26
27
28 public final class EclipseCompilationProblem implements CompilationProblem {
29
30 private final IProblem problem;
31
32 public EclipseCompilationProblem(final IProblem pProblem) {
33 problem = pProblem;
34 }
35
36 public boolean isError() {
37 return problem.isError();
38 }
39
40 public String getFileName() {
41 return new String(problem.getOriginatingFileName());
42 }
43
44 public int getStartLine() {
45 return problem.getSourceLineNumber();
46 }
47
48 public int getStartColumn() {
49 return problem.getSourceStart();
50 }
51
52 public int getEndLine() {
53 return getStartLine();
54 }
55
56 public int getEndColumn() {
57 return problem.getSourceEnd();
58 }
59
60 public String getMessage() {
61 return problem.getMessage();
62 }
63
64 @Override
65 public String toString() {
66 final StringBuilder sb = new StringBuilder();
67 sb.append(getFileName()).append(" (");
68 sb.append(getStartLine());
69 sb.append(":");
70 sb.append(getStartColumn());
71 sb.append(") : ");
72 sb.append(getMessage());
73 return sb.toString();
74 }
75
76 public int getId() {
77 return problem.getID();
78 }
79
80 }