From 67d67db602261580db9a1d380109acd6ebe7e60c Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Sun, 30 Jun 2013 02:05:39 +0530 Subject: [PATCH] an error msg for spl case --- pdex/src/processing/mode/experimental/ASTGenerator.java | 5 +++++ .../mode/experimental/ErrorCheckerService.java | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/pdex/src/processing/mode/experimental/ASTGenerator.java b/pdex/src/processing/mode/experimental/ASTGenerator.java index 7d06e953c..29348659d 100644 --- a/pdex/src/processing/mode/experimental/ASTGenerator.java +++ b/pdex/src/processing/mode/experimental/ASTGenerator.java @@ -1583,6 +1583,11 @@ public class ASTGenerator { editor.statusError("Highlight the class/function/variable name first"); return; } + + if(errorCheckerService.hasSyntaxErrors()){ + editor.statusError("Can't rename until syntax errors are fixed :("); + return; + } if (!frmRename.isVisible()){ frmRename.setVisible(true); SwingUtilities.invokeLater(new Runnable() { diff --git a/pdex/src/processing/mode/experimental/ErrorCheckerService.java b/pdex/src/processing/mode/experimental/ErrorCheckerService.java index 4f132412a..5f5389a2b 100644 --- a/pdex/src/processing/mode/experimental/ErrorCheckerService.java +++ b/pdex/src/processing/mode/experimental/ErrorCheckerService.java @@ -185,6 +185,7 @@ public class ErrorCheckerService implements Runnable{ defaultImportsOffset = pdePrepoc.getCoreImports().length + pdePrepoc.getDefaultImports().length + 1; astGenerator = new ASTGenerator(this); + syntaxErrors = true; } /** @@ -321,6 +322,12 @@ public class ErrorCheckerService implements Runnable{ } return false; } + + private boolean syntaxErrors; + + public boolean hasSyntaxErrors(){ + return syntaxErrors; + } private void syntaxCheck() { parser.setSource(sourceCode.toCharArray()); @@ -346,6 +353,8 @@ public class ErrorCheckerService implements Runnable{ problemsList.add(p); // System.out.println(p.toString()); } + + syntaxErrors = problems.length == 0 ? false : true; } protected URLClassLoader classLoader; private void compileCheck() {