]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Bugfixing sheets
authorAntti Villberg <antti.villberg@semantum.fi>
Wed, 23 Jan 2019 10:34:33 +0000 (12:34 +0200)
committerAntti Villberg <antti.villberg@semantum.fi>
Wed, 23 Jan 2019 10:34:33 +0000 (12:34 +0200)
Change-Id: I43f7781e858643409d26903e1ecb79198a6c77c2

bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java
bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetNodeManager.java

index ee57745ae857bf6bdf4cfd46ce6b0bba87364c2a..51f292929c440ff6bde32142ec34222633ad565e 100644 (file)
@@ -551,6 +551,7 @@ public class SpreadsheetGraphUtils {
                     Variable contextVariable = Variables.getVariable(graph, parameter);
                     Variable configVariable = Variables.getVariable(graph, parameter2);
                     Variable activeVariable = Variables.switchPossibleContext(graph, configVariable, contextVariable.getRepresents(graph));
+                    if(activeVariable == null) return Variant.ofInstance("Could not resolve " + configVariable.getURI(graph) + " for " + contextVariable.getURI(graph));
                     return activeVariable.getVariantValue(graph);
                 }
             }, new Listener<Variant>() {
@@ -562,7 +563,7 @@ public class SpreadsheetGraphUtils {
 
                 @Override
                 public void exception(Throwable t) {
-                    LOGGER.error("Error while evaluating variable value", t);
+                    LOGGER.error("Error while evaluating variable value, context = " + context + " uri=" + uri, t);
                 }
 
                 @Override
index 70ddf56bad8813d73f8b599c44c31bdb76dfbf86..a7bee9d4b5e0daf0af55359e3482cf5616af06f1 100644 (file)
@@ -21,6 +21,7 @@ import org.simantics.spreadsheet.solver.SpreadsheetCellContent;
 import org.simantics.spreadsheet.solver.SpreadsheetCellContentExpression;
 import org.simantics.spreadsheet.solver.SpreadsheetCellEditable;
 import org.simantics.spreadsheet.solver.SpreadsheetFormula;
+import org.simantics.spreadsheet.solver.SpreadsheetSCLConstant;
 import org.simantics.spreadsheet.solver.SpreadsheetTypeNode;
 import org.simantics.structural.stubs.StructuralResource2;
 
@@ -29,6 +30,7 @@ public class SpreadsheetNodeManager extends StandardVariableNodeManager<SheetNod
 
     public SpreadsheetNodeManager(SpreadsheetRealm realm) {
         super(realm, realm.getEngine());
+        new Exception().printStackTrace();
         realm.getEngine().registerListener(new SpreadsheetBookListener() {
             
             @Override
@@ -37,9 +39,11 @@ public class SpreadsheetNodeManager extends StandardVariableNodeManager<SheetNod
                     @Override
                     public void run() {
                         for(SpreadsheetCell cell : cells) {
-                            System.err.println("Modification in cell " + cell);
+                            System.err.println("Modification in cell " + cell.getName());
                             refreshVariable(new SpreadsheetCellContent(cell));
-                            refreshVariable(new SpreadsheetCellContentExpression(cell));
+                            Object content = cell.getContent();
+                            if(content instanceof SpreadsheetFormula || content instanceof SpreadsheetSCLConstant)
+                                refreshVariable(new SpreadsheetCellContentExpression(cell));
                         }
                     }
                 });