01: /*
02: * Copyright 1999-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package com.opensymphony.webwork.util.classloader.compilers.eclipse;
17:
18: import com.opensymphony.webwork.util.classloader.problems.CompilationProblem;
19: import org.eclipse.jdt.core.compiler.IProblem;
20:
21: public class EclipseCompilationProblem implements CompilationProblem {
22:
23: private final IProblem problem;
24:
25: public EclipseCompilationProblem(final IProblem pProblem) {
26: problem = pProblem;
27: }
28:
29: public boolean isError() {
30: return problem.isError();
31: }
32:
33: public String getFileName() {
34: return new String(problem.getOriginatingFileName());
35: }
36:
37: public int getStartLine() {
38: return problem.getSourceLineNumber();
39: }
40:
41: public int getStartColumn() {
42: return problem.getSourceStart();
43: }
44:
45: public int getEndLine() {
46: return getStartLine();
47: }
48:
49: public int getEndColumn() {
50: return problem.getSourceEnd();
51: }
52:
53: public String getMessage() {
54: return problem.getMessage();
55: }
56:
57: public String toString() {
58: final StringBuffer sb = new StringBuffer();
59: sb.append(getFileName()).append(" (");
60: sb.append(getStartLine());
61: sb.append(":");
62: sb.append(getStartColumn());
63: sb.append(") : ");
64: sb.append(getMessage());
65: return sb.toString();
66: }
67:
68: public int getId() {
69: return problem.getID();
70: }
71:
72: }
|