mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 06:09:17 +01:00
Move to error checker
This commit is contained in:
@@ -969,7 +969,7 @@ public class ASTGenerator {
|
||||
matchedClass2 = matchedClass2.replace('/', '.'); //package name
|
||||
String matchedClass = matchedClass2.substring(0, matchedClass2.length() - 6);
|
||||
int d = matchedClass.lastIndexOf('.');
|
||||
if (!ignorableImport(matchedClass,matchedClass.substring(d + 1))) {
|
||||
if (!errorCheckerService.ignorableSuggestionImport(matchedClass)) {
|
||||
matchedClass = matchedClass.substring(d + 1); //class name
|
||||
// display package name in grey
|
||||
String html = "<html>" + matchedClass + " : <font color=#777777>" +
|
||||
@@ -3521,43 +3521,6 @@ public class ASTGenerator {
|
||||
}
|
||||
|
||||
|
||||
protected boolean ignorableImport(String impName, String fullClassName) {
|
||||
for (ImportStatement impS : errorCheckerService.getProgramImports()) {
|
||||
if (impName.toLowerCase().startsWith(impS.getPackageName().toLowerCase())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (ImportStatement impS : errorCheckerService.codeFolderImports) {
|
||||
if (impName.toLowerCase().startsWith(impS.getPackageName().toLowerCase())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (JavaMode.suggestionsMap == null
|
||||
|| JavaMode.suggestionsMap.keySet().size() == 0) {
|
||||
log("SuggestionsMap is null or empty, won't be able to trim class names");
|
||||
return true;
|
||||
}
|
||||
final String include = "include";
|
||||
final String exclude = "exclude";
|
||||
|
||||
if (impName.startsWith("processing")) {
|
||||
if (JavaMode.suggestionsMap.get(include).contains(impName)) {
|
||||
return false;
|
||||
} else if (JavaMode.suggestionsMap.get(exclude).contains(impName)) {
|
||||
return true;
|
||||
}
|
||||
} else if (impName.startsWith("java")) {
|
||||
if (JavaMode.suggestionsMap.get(include).contains(impName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isAddableASTNode(ASTNode node) {
|
||||
switch (node.getNodeType()) {
|
||||
// case ASTNode.STRING_LITERAL:
|
||||
|
||||
@@ -920,6 +920,40 @@ public class ErrorCheckerService implements Runnable {
|
||||
}
|
||||
|
||||
|
||||
protected boolean ignorableSuggestionImport(String impName) {
|
||||
String impNameLc = impName.toLowerCase();
|
||||
|
||||
for (ImportStatement impS : programImports) {
|
||||
if (impNameLc.startsWith(impS.getPackageName().toLowerCase())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (ImportStatement impS : codeFolderImports) {
|
||||
if (impNameLc.startsWith(impS.getPackageName().toLowerCase())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
final String include = "include";
|
||||
final String exclude = "exclude";
|
||||
|
||||
if (impName.startsWith("processing")) {
|
||||
if (JavaMode.suggestionsMap.get(include).contains(impName)) {
|
||||
return false;
|
||||
} else if (JavaMode.suggestionsMap.get(exclude).contains(impName)) {
|
||||
return true;
|
||||
}
|
||||
} else if (impName.startsWith("java")) {
|
||||
if (JavaMode.suggestionsMap.get(include).contains(impName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/** Options for the JDT Compiler */
|
||||
protected Map<String, String> compilerSettings;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user