]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Fix
authorvillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 9 Sep 2013 06:38:29 +0000 (06:38 +0000)
committervillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 9 Sep 2013 06:38:29 +0000 (06:38 +0000)
refs #3552

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@27813 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn/src/org/simantics/sysdyn/Functions.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java

index 6a309d35af0bb8e715aec6d5aa734f621b2d4a5a..002925aa564a47e816242b907940ac18bb6b9d5a 100644 (file)
@@ -1,5 +1,6 @@
 package org.simantics.sysdyn;\r
 \r
+import java.util.HashMap;\r
 import java.util.Map;\r
 \r
 import org.simantics.databoard.binding.Binding;\r
@@ -14,6 +15,7 @@ import org.simantics.db.layer0.variable.StandardGraphChildVariable;
 import org.simantics.db.layer0.variable.ValueAccessor;\r
 import org.simantics.db.layer0.variable.Variable;\r
 import org.simantics.db.layer0.variable.VariableMap;\r
+import org.simantics.db.layer0.variable.VariableMapImpl;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.operation.Layer0X;\r
 import org.simantics.scl.reflection.annotations.SCLValue;\r
@@ -69,7 +71,7 @@ public class Functions {
        \r
 \r
        @SCLValue(type = "VariableMap")\r
-       public static VariableMap runProperties = new VariableMap() {\r
+       public static VariableMap runProperties = new VariableMapImpl() {\r
 \r
            @Override\r
            public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException {\r
@@ -82,12 +84,13 @@ public class Functions {
            }\r
 \r
            @Override\r
-           public void getVariables(ReadGraph graph, Variable context, Map<String, Variable> map) throws DatabaseException {\r
+           public Map<String, Variable> getVariables(ReadGraph graph, Variable context, Map<String, Variable> map) throws DatabaseException {\r
+               return map;\r
            }\r
        };\r
 \r
     @SCLValue(type = "VariableMap")\r
-       public static VariableMap valuePropertyProperties = new VariableMap() {\r
+       public static VariableMap valuePropertyProperties = new VariableMapImpl() {\r
        \r
                @Override\r
                public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException {\r
@@ -110,7 +113,8 @@ public class Functions {
                }\r
 \r
                @Override\r
-               public void getVariables(ReadGraph graph, Variable context, Map<String, Variable> map) throws DatabaseException {\r
+               public Map<String, Variable> getVariables(ReadGraph graph, Variable context, Map<String, Variable> map) throws DatabaseException {\r
+                   return map;\r
 //                     Collections.emptyList();\r
 //             StandardGraphChildVariable variable = (StandardGraphChildVariable)context;\r
 //             collectPropertiesFromContext(graph, variable, variable.resource, map);\r
@@ -120,7 +124,7 @@ public class Functions {
        \r
        \r
        @SCLValue(type = "VariableMap")\r
-       public static VariableMap runChildren = new VariableMap() {\r
+       public static VariableMap runChildren = new VariableMapImpl() {\r
        \r
                @Override\r
                public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException {\r
@@ -132,21 +136,26 @@ public class Functions {
                }\r
 \r
                @Override\r
-               public void getVariables(ReadGraph graph, Variable context, Map<String, Variable> map) throws DatabaseException {\r
+               public Map<String, Variable> getVariables(ReadGraph graph, Variable context, Map<String, Variable> map) throws DatabaseException {\r
+                   \r
                        StandardGraphChildVariable variable = (StandardGraphChildVariable)context;\r
                        \r
-                       All.getStandardChildDomainChildVariables(graph, context, map);\r
+                       map = All.getStandardChildDomainChildVariables(graph, context, map);\r
                        \r
                        for(Map.Entry<String, Resource> entry : graph.syncRequest(new StructuralChildMapOfResource(getConfiguration(graph, variable))).entrySet()) {\r
                                String name = entry.getKey();\r
                                Resource child = entry.getValue();\r
                                Variable var = graph.getPossibleContextualAdapter(child, variable, Variable.class, Variable.class);\r
                                if(var != null) {\r
+                           if(map == null) map = new HashMap<String,Variable>();\r
                                        map.put(name, var);\r
                                } else {\r
                                        System.err.println("No adapter for " + child + " in " + variable.getURI(graph));\r
                                }\r
                        }\r
+                       \r
+                       return map;\r
+                       \r
                }\r
                \r
                Resource getConfiguration(ReadGraph graph, Variable run) throws DatabaseException {\r
index e690510951a736a282f41f8788e4e516d76f5735..d7c488df82d8b459a40e5cc0730af7523a0de6f1 100644 (file)
@@ -30,6 +30,7 @@ import org.eclipse.core.runtime.preferences.DefaultScope;
 import org.eclipse.core.runtime.preferences.IScopeContext;\r
 import org.osgi.service.prefs.Preferences;\r
 import org.simantics.db.ReadGraph;\r
+import org.simantics.db.RequestProcessor;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.Session;\r
 import org.simantics.db.VirtualGraph;\r
@@ -651,7 +652,7 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment,
     }\r
 \r
     @Override\r
-    public void refresh(Session session) {\r
+    public void refresh(RequestProcessor session) {\r
         session.asyncRequest(new ReadRequest() {\r
 \r
             @Override\r
@@ -661,6 +662,11 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment,
 \r
         });\r
     }\r
+    \r
+    @Override\r
+    public void refresh(Session session) {\r
+        refresh((RequestProcessor)session);\r
+    }\r
 \r
     @Override\r
     protected void localStateChange() {\r