| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9efa410 commit 1dc08f6
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2285,26 +2285,6 @@ public void statusHalted() { | |||
| 2285 | 2285 | } | |
| 2286 | 2286 | ||
| 2287 | 2287 | ||
| 2288 | - /** | ||
| 2289 | - * @return the Problem for the most relevant error or warning on 'line', | ||
| 2290 | - * defaulting to the first. | ||
| 2291 | - */ | ||
| 2292 | - @Override | ||
| 2293 | - protected Problem findProblem(int line) { | ||
| 2294 | - List<Problem> l = findProblems(line); | ||
| 2295 | - if (l.size() == 0) return null; | ||
| 2296 | - Problem worst = l.get(0); | ||
| 2297 | - | ||
| 2298 | - for (Problem p : l) { | ||
| 2299 | - if (p instanceof JavaProblem && ((!(worst instanceof JavaProblem)) || | ||
| 2300 | - ((JavaProblem)p).getPriority() > ((JavaProblem)worst).getPriority())) { | ||
| 2301 | - worst = p; | ||
| 2302 | - } | ||
| 2303 | - } | ||
| 2304 | - return worst; | ||
| 2305 | - } | ||
| 2306 | - | ||
| 2307 | - | ||
| 2308 | 2288 | /** | |
| 2309 | 2289 | * Updates the error table in the Error Window. | |
| 2310 | 2290 | * Overridden to handle the fugly import suggestions text. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,10 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | 21 | package processing.mode.java.pdex; | |
| 22 | 22 | ||
| 23 | - import java.util.Arrays; | ||
| 24 | - | ||
| 25 | 23 | import org.eclipse.jdt.core.compiler.IProblem; | |
| 26 | - import static org.eclipse.jdt.core.compiler.IProblem.*; | ||
| 27 | 24 | ||
| 28 | 25 | import processing.app.Problem; | |
| 29 | 26 | ||
@@ -56,65 +53,18 @@ public class JavaProblem implements Problem { | |||
| 56 | 53 | */ | |
| 57 | 54 | private int type; | |
| 58 | 55 | ||
| 59 | - /** | ||
| 60 | - * Priority: bigger = higher. Currently 7 to 10 for errors, | ||
| 61 | - * 4 for warning. | ||
| 62 | - * <p> | ||
| 63 | - * The logic of the numbers in the priorityN arrays is that if ECJ wants a | ||
| 64 | - * token got rid of entirely it's most likely the root of the problem. If it | ||
| 65 | - * wants more tokens, that might have been caused by an unterminated string | ||
| 66 | - * or something but it's also likely to be the “real” error. Only if the | ||
| 67 | - * syntax is good are mismatched argument lists and so on of any real | ||
| 68 | - * significance. These rankings are entirely made up so can be changed to | ||
| 69 | - * support any other plausible scenario. | ||
| 70 | - */ | ||
| 71 | - private int priority; | ||
| 72 | - | ||
| 73 | - static private final int[] priority10 = { | ||
| 74 | - ParsingError, | ||
| 75 | - ParsingErrorDeleteToken, | ||
| 76 | - ParsingErrorDeleteTokens, | ||
| 77 | - ParsingErrorInvalidToken, | ||
| 78 | - ParsingErrorMergeTokens, | ||
| 79 | - ParsingErrorMisplacedConstruct, | ||
| 80 | - ParsingErrorNoSuggestion, | ||
| 81 | - ParsingErrorNoSuggestionForTokens, | ||
| 82 | - ParsingErrorOnKeyword, | ||
| 83 | - ParsingErrorOnKeywordNoSuggestion, | ||
| 84 | - ParsingErrorReplaceTokens, | ||
| 85 | - ParsingErrorUnexpectedEOF | ||
| 86 | - }; | ||
| 87 | - static private final int[] priority9 = { | ||
| 88 | - InvalidCharacterConstant, | ||
| 89 | - UnterminatedString | ||
| 90 | - }; | ||
| 91 | - static private final int[] priority8 = { | ||
| 92 | - ParsingErrorInsertToComplete, | ||
| 93 | - ParsingErrorInsertToCompletePhrase, | ||
| 94 | - ParsingErrorInsertToCompleteScope, | ||
| 95 | - ParsingErrorInsertTokenAfter, | ||
| 96 | - ParsingErrorInsertTokenBefore, | ||
| 97 | - }; | ||
| 98 | - // Sorted so I can do a one-line binary search later. | ||
| 99 | - static { | ||
| 100 | - Arrays.sort(priority10); | ||
| 101 | - Arrays.sort(priority9); | ||
| 102 | - Arrays.sort(priority8); | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | 56 | /** | |
| 106 | 57 | * If the error is a 'cannot find type' contains the list of suggested imports | |
| 107 | 58 | */ | |
| 108 | 59 | private String[] importSuggestions; | |
| 109 | 60 | ||
| 110 | 61 | public static final int ERROR = 1, WARNING = 2; | |
| 111 | 62 | ||
| 112 | - public JavaProblem(String message, int type, int tabIndex, int lineNumber, int priority) { | ||
| 63 | + public JavaProblem(String message, int type, int tabIndex, int lineNumber) { | ||
| 113 | 64 | this.message = message; | |
| 114 | 65 | this.type = type; | |
| 115 | 66 | this.tabIndex = tabIndex; | |
| 116 | 67 | this.lineNumber = lineNumber; | |
| 117 | - this.priority = priority; | ||
| 118 | 68 | } | |
| 119 | 69 | ||
| 120 | 70 | /** | |
@@ -127,24 +77,13 @@ public JavaProblem(String message, int type, int tabIndex, int lineNumber, int p | |||
| 127 | 77 | public static JavaProblem fromIProblem(IProblem iProblem, | |
| 128 | 78 | int tabIndex, int lineNumber, String badCode) { | |
| 129 | 79 | int type = 0; | |
| 130 | - int priority = 0; | ||
| 131 | - if (iProblem.isError()) { | ||
| 80 | + if(iProblem.isError()) { | ||
| 132 | 81 | type = ERROR; | |
| 133 | - if (Arrays.binarySearch(priority10, iProblem.getID()) >= 0) { | ||
| 134 | - priority = 10; | ||
| 135 | - } else if (Arrays.binarySearch(priority9, iProblem.getID()) >= 0) { | ||
| 136 | - priority = 9; | ||
| 137 | - } else if (Arrays.binarySearch(priority8, iProblem.getID()) >= 0) { | ||
| 138 | - priority = 8; | ||
| 139 | - } else { | ||
| 140 | - priority = 7; | ||
| 141 | - } | ||
| 142 | 82 | } else if (iProblem.isWarning()) { | |
| 143 | 83 | type = WARNING; | |
| 144 | - priority = 4; | ||
| 145 | 84 | } | |
| 146 | 85 | String message = ErrorMessageSimplifier.getSimplifiedErrorMessage(iProblem, badCode); | |
| 147 | - return new JavaProblem(message, type, tabIndex, lineNumber, priority); | ||
| 86 | + return new JavaProblem(message, type, tabIndex, lineNumber); | ||
| 148 | 87 | } | |
| 149 | 88 | ||
| 150 | 89 | public void setPDEOffsets(int startOffset, int stopOffset){ | |
@@ -195,10 +134,6 @@ public void setImportSuggestions(String[] a) { | |||
| 195 | 134 | importSuggestions = a; | |
| 196 | 135 | } | |
| 197 | 136 | ||
| 198 | - public int getPriority() { | ||
| 199 | - return priority; | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | 137 | @Override | |
| 203 | 138 | public String toString() { | |
| 204 | 139 | return "TAB " + tabIndex + ",LN " + lineNumber + "LN START OFF: " | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1193,7 +1193,7 @@ static private List<JavaProblem> checkForCurlyQuotes(PreprocessedSketch ps) { | |||
| 1193 | 1193 | int tabLine = ps.tabOffsetToTabLine(tabIndex, tabOffset); | |
| 1194 | 1194 | ||
| 1195 | 1195 | String message = Language.interpolate("editor.status.bad_curly_quote", q); | |
| 1196 | - JavaProblem problem = new JavaProblem(message, JavaProblem.ERROR, tabIndex, tabLine, 10); | ||
| 1196 | + JavaProblem problem = new JavaProblem(message, JavaProblem.ERROR, tabIndex, tabLine); | ||
| 1197 | 1197 | problem.setPDEOffsets(tabOffset, tabOffset+1); | |
| 1198 | 1198 | ||
| 1199 | 1199 | problems.add(problem); | |
@@ -1229,7 +1229,7 @@ static private List<JavaProblem> checkForCurlyQuotes(PreprocessedSketch ps) { | |||
| 1229 | 1229 | } else { | |
| 1230 | 1230 | message = Language.interpolate("editor.status.bad_curly_quote", q); | |
| 1231 | 1231 | } | |
| 1232 | - JavaProblem p = new JavaProblem(message, JavaProblem.ERROR, in.tabIndex, line, 10); | ||
| 1232 | + JavaProblem p = new JavaProblem(message, JavaProblem.ERROR, in.tabIndex, line); | ||
| 1233 | 1233 | p.setPDEOffsets(tabStart, tabStop); | |
| 1234 | 1234 | problems2.add(p); | |
| 1235 | 1235 | } | |
@@ -1255,7 +1255,7 @@ static private List<JavaProblem> checkForMissingBraces(PreprocessedSketch ps) { | |||
| 1255 | 1255 | new JavaProblem(braceResult[0] < 0 | |
| 1256 | 1256 | ? Language.interpolate("editor.status.missing.left_curly_bracket") | |
| 1257 | 1257 | : Language.interpolate("editor.status.missing.right_curly_bracket"), | |
| 1258 | - JavaProblem.ERROR, tabIndex, braceResult[1], 8); | ||
| 1258 | + JavaProblem.ERROR, tabIndex, braceResult[1]); | ||
| 1259 | 1259 | problem.setPDEOffsets(braceResult[3], braceResult[3] + 1); | |
| 1260 | 1260 | problems.add(problem); | |
| 1261 | 1261 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments