]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.db/src/org/simantics/scl/db/SCLFunctions.java
Fixed argument passing in async/sync read/write SCL functions
[simantics/platform.git] / bundles / org.simantics.scl.db / src / org / simantics / scl / db / SCLFunctions.java
index 9f242b28c8efade8dc8d606d4c6409bd94b86a69..bca7ba2481ff641b5a7d4c300ed80642cb751ac2 100644 (file)
@@ -177,7 +177,7 @@ public class SCLFunctions {
 
     private static Object[] NO_ARGS = new Object[] { Tuple0.INSTANCE };
 
 
     private static Object[] NO_ARGS = new Object[] { Tuple0.INSTANCE };
 
-    public static <T> void asyncRead(final Function f) throws DatabaseException {    
+    public static <T> void asyncRead(final Function f) throws DatabaseException {
         asyncRead(f, NO_ARGS);
     }
 
         asyncRead(f, NO_ARGS);
     }
 
@@ -189,7 +189,7 @@ public class SCLFunctions {
                 SCLContext.push(context);
                 context.put(GRAPH, graph);
                 try {
                 SCLContext.push(context);
                 context.put(GRAPH, graph);
                 try {
-                    f.apply(Tuple0.INSTANCE);
+                    f.applyArray(args);
                 } finally {
                     SCLContext.pop();
                 }
                 } finally {
                     SCLContext.pop();
                 }
@@ -213,7 +213,7 @@ public class SCLFunctions {
                     SCLContext.push(context);
                     ReadGraph oldGraph = (ReadGraph)context.put(GRAPH, graph);
                     try {
                     SCLContext.push(context);
                     ReadGraph oldGraph = (ReadGraph)context.put(GRAPH, graph);
                     try {
-                        return (T)f.apply(Tuple0.INSTANCE);
+                        return (T)f.applyArray(args);
                     } finally {
                         context.put(GRAPH, oldGraph);
                         SCLContext.pop();
                     } finally {
                         context.put(GRAPH, oldGraph);
                         SCLContext.pop();
@@ -236,7 +236,7 @@ public class SCLFunctions {
                     SCLContext.push(context);
                     context.put(GRAPH, graph);
                     try {
                     SCLContext.push(context);
                     context.put(GRAPH, graph);
                     try {
-                        f.apply(args);
+                        f.applyArray(args);
                     } finally {
                         SCLContext.pop();
                     }
                     } finally {
                         SCLContext.pop();
                     }
@@ -255,7 +255,7 @@ public class SCLFunctions {
         final SCLContext context = SCLContext.getCurrent();
         Object graph = context.get(GRAPH);
         if (graph != null && graph instanceof WriteGraph) {
         final SCLContext context = SCLContext.getCurrent();
         Object graph = context.get(GRAPH);
         if (graph != null && graph instanceof WriteGraph) {
-            return (T)f.apply(Tuple0.INSTANCE);
+            return (T)f.applyArray(args);
         } else {
             if (graph != null) {
                 LOGGER.error(
         } else {
             if (graph != null) {
                 LOGGER.error(
@@ -270,7 +270,7 @@ public class SCLFunctions {
                     SCLReportingHandler oldPrinter = (SCLReportingHandler)context.put(SCLReportingHandler.REPORTING_HANDLER, printer);
                     ReadGraph oldGraph = (ReadGraph)context.put(GRAPH, graph);
                     try {
                     SCLReportingHandler oldPrinter = (SCLReportingHandler)context.put(SCLReportingHandler.REPORTING_HANDLER, printer);
                     ReadGraph oldGraph = (ReadGraph)context.put(GRAPH, graph);
                     try {
-                        return (T)f.apply(args);
+                        return (T)f.applyArray(args);
                     } finally {
                         context.put(GRAPH, oldGraph);
                         context.put(SCLReportingHandler.REPORTING_HANDLER, oldPrinter);
                     } finally {
                         context.put(GRAPH, oldGraph);
                         context.put(SCLReportingHandler.REPORTING_HANDLER, oldPrinter);