Wrapper class for IProblem that stores the tabIndex and line number according to its tab, including the original IProblem object
| 30 | * according to its tab, including the original IProblem object |
| 31 | */ |
| 32 | public class JavaProblem implements Problem { |
| 33 | /** Error Message. Processed form of IProblem.getMessage() */ |
| 34 | private final String message; |
| 35 | |
| 36 | /** The type of error - WARNING or ERROR. */ |
| 37 | private final int type; |
| 38 | |
| 39 | /** The tab number the error belongs to. */ |
| 40 | private final int tabIndex; |
| 41 | |
| 42 | /** Line number (pde code) of the error */ |
| 43 | private final int lineNumber; |
| 44 | |
| 45 | private int startOffset; |
| 46 | |
| 47 | private int stopOffset; |
| 48 | |
| 49 | /** |
| 50 | * If the error is a 'cannot find type' contains the list of suggested imports |
| 51 | */ |
| 52 | private String[] importSuggestions; |
| 53 | |
| 54 | static final int ERROR = 1; |
| 55 | static final int WARNING = 2; |
| 56 | |
| 57 | |
| 58 | public JavaProblem(String message, int type, int tabIndex, int lineNumber) { |
| 59 | this.message = message; |
| 60 | this.type = type; |
| 61 | this.tabIndex = tabIndex; |
| 62 | this.lineNumber = lineNumber; |
| 63 | |
| 64 | // Default to 0, 1 unless a longer section is specified |
| 65 | this.startOffset = 0; |
| 66 | this.stopOffset = 1; |
| 67 | } |
| 68 | |
| 69 | |
| 70 | /** |
| 71 | * @param iProblem - The IProblem which is being wrapped |
| 72 | * @param tabIndex - The tab number to which the error belongs to |
| 73 | * @param lineNumber - Line number(pde code) of the error |
| 74 | * @param badCode - The code iProblem refers to. |
| 75 | */ |
| 76 | static public JavaProblem fromIProblem(IProblem iProblem, int tabIndex, |
| 77 | int lineNumber, String badCode) { |
| 78 | int type = 0; |
| 79 | if (iProblem.isError()) { |
| 80 | type = ERROR; |
| 81 | } else if (iProblem.isWarning()) { |
| 82 | type = WARNING; |
| 83 | } |
| 84 | String message = CompileErrorMessageSimplifier.getSimplifiedErrorMessage(iProblem, badCode); |
| 85 | return new JavaProblem(message, type, tabIndex, lineNumber); |
| 86 | } |
| 87 | |
| 88 | |
| 89 | public void setPDEOffsets(int startOffset, int stopOffset){ |
nothing calls this directly
no outgoing calls
no test coverage detected