diff --git a/pdex/mode.properties b/pdex/mode.properties new file mode 100644 index 000000000..5029f1941 --- /dev/null +++ b/pdex/mode.properties @@ -0,0 +1,7 @@ +name=ExperimentalMode +authorList=[The Processing Foundation](http://processing.org) +url=https://github.com/processing/processing-experimental +sentence=The next generation of PDE +paragraph=Intelligent Code Completion, Live Error Checker, Debugger, Auto Refactor, etc. +version=@@version@@ +prettyVersion=@@pretty-version@@ diff --git a/pdex/src/processing/mode/experimental/ErrorCheckerService.java b/pdex/src/processing/mode/experimental/ErrorCheckerService.java index afc54b8cd..e1da5938b 100644 --- a/pdex/src/processing/mode/experimental/ErrorCheckerService.java +++ b/pdex/src/processing/mode/experimental/ErrorCheckerService.java @@ -193,6 +193,7 @@ public class ErrorCheckerService implements Runnable{ pdePrepoc.getDefaultImports().length + 1; astGenerator = new ASTGenerator(this); syntaxErrors = new AtomicBoolean(true); + containsErrors = new AtomicBoolean(true); errorMsgSimplifier = new ErrorMessageSimplifier(); tempErrorLog = new TreeMap(); } @@ -337,6 +338,15 @@ public class ErrorCheckerService implements Runnable{ + mainClassOffset); } + // Update error flag + containsErrors.set(false); + for (Problem p : problemsList) { + if (p.isError()){ + containsErrors.set(true); + break; + } + } + updateErrorTable(); editor.updateErrorBar(problemsList); updateEditorStatus(); @@ -363,31 +373,24 @@ public class ErrorCheckerService implements Runnable{ return false; } - protected AtomicBoolean syntaxErrors; + protected AtomicBoolean syntaxErrors, containsErrors; public boolean hasSyntaxErrors(){ return syntaxErrors.get(); } public boolean hasErrors(){ - synchronized (problemsList) { - for (Problem p : problemsList) { - if (p.isError()){ - return true; - } - } - return false; - } + return containsErrors.get(); } protected TreeMap tempErrorLog; private void syntaxCheck() { syntaxErrors.set(true); + containsErrors.set(true); parser.setSource(sourceCode.toCharArray()); parser.setKind(ASTParser.K_COMPILATION_UNIT); - @SuppressWarnings("unchecked") Map options = JavaCore.getOptions(); JavaCore.setComplianceOptions(JavaCore.VERSION_1_6, options); @@ -413,25 +416,31 @@ public class ErrorCheckerService implements Runnable{ // log(p.toString()); } - if (problems.length == 0) + if (problems.length == 0) { syntaxErrors.set(false); - else + containsErrors.set(false); + } else { syntaxErrors.set(true); + containsErrors.set(true); + } } + protected URLClassLoader classLoader; + private void compileCheck() { // Currently (Sept, 2012) I'm using Java's reflection api to load the // CompilationChecker class(from CompilationChecker.jar) that houses the - // Eclispe JDT compiler and call its getErrorsAsObj method to obtain + // Eclispe JDT compiler, and call its getErrorsAsObj method to obtain // errors. This way, I'm able to add the paths of contributed libraries // to the classpath of CompilationChecker, dynamically. The eclipse compiler - // needs all referenced libraries in the classpath. + // needs all referenced libraries in the classpath. Totally a hack. If you find + // a better method, do let me know. try { // NOTE TO SELF: If classpath contains null Strings - // URLClassLoader gets angry. Drops NPE bombs. + // URLClassLoader shoots NPE bullets. // If imports have changed, reload classes with new classpath. if (loadCompClass) { @@ -451,7 +460,7 @@ public class ErrorCheckerService implements Runnable{ FileFilter fileFilter = new FileFilter() { public boolean accept(File file) { return (file.getName().endsWith(".jar") && !file - .getName().startsWith("ExperimentalMode")); + .getName().startsWith(editor.getMode().getClass().getSimpleName())); } }; @@ -526,6 +535,7 @@ public class ErrorCheckerService implements Runnable{ Problem p = new Problem(problem, a[0], a[1]); if ((Boolean) errorList[i][8]) { p.setType(Problem.ERROR); + containsErrors.set(true); // set flag } if ((Boolean) errorList[i][9]) {