]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Shortcut tab in equation tab doesn't update the variable colors if there are syntax...
authormiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 25 Jan 2013 10:31:02 +0000 (10:31 +0000)
committermiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 25 Jan 2013 10:31:02 +0000 (10:31 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26679 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java

index 88cf7e1bed1683c9889cf0db5c69bba1f396c124..15c8ddaa3e1689b044e1b4ce35a7e5c8f5073f30 100644 (file)
@@ -123,6 +123,7 @@ public class ExpressionUtils {
         HashMap<ExpressionField, HashMap<String, List<Token>>> functionReferences = new HashMap<ExpressionField, HashMap<String, List<Token>>>();\r
 \r
         // Build references and variable array\r
+        boolean parsingSucceeded = false;\r
         for(ExpressionField ef : expression.getExpressionFields()) {\r
             ef.resetAnnotations();\r
             String textString = ef.getExpression();\r
@@ -141,6 +142,7 @@ public class ExpressionUtils {
 \r
                 functionReferences.put(ef, parser.getFunctionCallReferences());\r
 \r
+                parsingSucceeded = true;\r
             } catch (ParseException e1) {\r
                 ef.setSyntaxError(new SyntaxError(e1.currentToken, "Syntax Error"));\r
             } catch (TokenMgrError err) {\r
@@ -229,7 +231,8 @@ public class ExpressionUtils {
         // Check that the variables that exist have connections and the connected variables have references in the expressions\r
         if(!(expression instanceof StockExpression)) { \r
 \r
-            if(variableTable != null && !variableTable.isDisposed()) {\r
+            // If there are syntax errors, keep the previous coloring.\r
+            if(parsingSucceeded && variableTable != null && !variableTable.isDisposed()) {\r
                 TableItem[] connectedVariables = variableTable.getItems();\r
                 for(TableItem ti : connectedVariables) {\r
                     if(!variables.contains(ti.getText())) {\r