From c3af66301f96544fb21f0ce770293ff8b5fda233 Mon Sep 17 00:00:00 2001 From: miettinen Date: Fri, 25 Jan 2013 10:31:02 +0000 Subject: [PATCH] Shortcut tab in equation tab doesn't update the variable colors if there are syntax errors in the expression. That is, when the equation is being written, the list doesn't constantly go yellow and back to normal again (refs #3961). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26679 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java index 88cf7e1b..15c8ddaa 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java @@ -123,6 +123,7 @@ public class ExpressionUtils { HashMap>> functionReferences = new HashMap>>(); // Build references and variable array + boolean parsingSucceeded = false; for(ExpressionField ef : expression.getExpressionFields()) { ef.resetAnnotations(); String textString = ef.getExpression(); @@ -141,6 +142,7 @@ public class ExpressionUtils { functionReferences.put(ef, parser.getFunctionCallReferences()); + parsingSucceeded = true; } catch (ParseException e1) { ef.setSyntaxError(new SyntaxError(e1.currentToken, "Syntax Error")); } catch (TokenMgrError err) { @@ -229,7 +231,8 @@ public class ExpressionUtils { // Check that the variables that exist have connections and the connected variables have references in the expressions if(!(expression instanceof StockExpression)) { - if(variableTable != null && !variableTable.isDisposed()) { + // If there are syntax errors, keep the previous coloring. + if(parsingSucceeded && variableTable != null && !variableTable.isDisposed()) { TableItem[] connectedVariables = variableTable.getItems(); for(TableItem ti : connectedVariables) { if(!variables.contains(ti.getText())) { -- 2.47.1