MCPcopy Index your code
hub / github.com/processing/processing / JavaProblem

Class JavaProblem

java/src/processing/mode/java/pdex/JavaProblem.java:32–144  ·  view source on GitHub ↗

Wrapper class for IProblem that stores the tabIndex and line number according to its tab, including the original IProblem object

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected