]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/function/All.java
Spreadsheet updates cell values properly
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / src / org / simantics / spreadsheet / graph / function / All.java
index 0affbc1c56cade37845ebee95ed19a33155b19ca..98ef90231fc6be36999667b377ad46fe1cd5b516 100644 (file)
@@ -29,7 +29,6 @@ import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.common.utils.Logger;
 import org.simantics.db.common.utils.NameUtils;
 import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.layer0.StandardRealm;
 import org.simantics.db.layer0.exception.MissingVariableException;
 import org.simantics.db.layer0.function.StandardChildDomainChildren;
 import org.simantics.db.layer0.request.PossibleActiveRun;
@@ -50,6 +49,7 @@ import org.simantics.document.server.io.IFont;
 import org.simantics.document.server.io.ITableCell;
 import org.simantics.layer0.Layer0;
 import org.simantics.scl.reflection.annotations.SCLValue;
+import org.simantics.simulator.toolkit.StandardRealm;
 import org.simantics.simulator.variable.exceptions.NodeManagerException;
 import org.simantics.spreadsheet.CellEditor;
 import org.simantics.spreadsheet.ClientModel;
@@ -200,7 +200,7 @@ public class All {
             SpreadsheetCell sc = book.get(sheet.getName(graph), r.startRow, r.startColumn);
             sc.setContent(value);
 //          book.accept(new InvalidateAll());
-            List<SpreadsheetCell> changed = book.invalidate(sc);
+//                     List<SpreadsheetCell> changed = book.invalidate(sc); //Invalidation handled by SpreadsheetNodeManager
             realm.asyncExec(new Runnable() {
 
                 @Override
@@ -620,20 +620,21 @@ public class All {
                
             private CellEditor<Write> getPossibleCellEditor(WriteGraph graph, String location, Variant value) throws DatabaseException {
                 SpreadsheetResource SHEET = SpreadsheetResource.getInstance(graph);
-                Range range = SpreadsheetUtils.decodeCellAbsolute(location);
-                
-                List<Variable> cells = SpreadsheetGraphUtils.possibleConfigurationCellVariables(graph, sheet, range);
-                if (cells.isEmpty()) {
-                    if (value == null) {
-                        return null;
-                    } else {
-                        cells = SpreadsheetGraphUtils.getOrCreateConfigurationCellVariables(graph, sheet, range);
-                    }
-                }
-                if (cells.size() != 1)
-                    throw new DatabaseException("Can edit only one cell at a time!");
-                
-                return cells.iterator().next().getPropertyValue(graph, SHEET.cellEditor);
+                   Range range = SpreadsheetUtils.decodePossibleCellAbsolute(location);
+                   if(range == null) return null; //No editor found
+                   
+                   List<Variable> cells = SpreadsheetGraphUtils.possibleConfigurationCellVariables(graph, sheet, range);
+                   if (cells.isEmpty()) {
+                       if (value == null) {
+                           return null;
+                       } else {
+                           cells = SpreadsheetGraphUtils.getOrCreateConfigurationCellVariables(graph, sheet, range);
+                       }
+                   }
+                   if (cells.size() != 1)
+                       throw new DatabaseException("Can edit only one cell at a time!");
+                       
+                   return cells.iterator().next().getPropertyValue(graph, SHEET.cellEditor);
             }
 
                @Override