From d27d2d3e0f76383fdb4c87c296e206888842d46d Mon Sep 17 00:00:00 2001 From: villberg Date: Mon, 9 Sep 2013 06:38:29 +0000 Subject: [PATCH] Fix refs #3552 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@27813 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../src/org/simantics/sysdyn/Functions.java | 23 +++++++++++++------ .../sysdyn/manager/SysdynExperiment.java | 8 ++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/Functions.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/Functions.java index 6a309d35..002925aa 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/Functions.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/Functions.java @@ -1,5 +1,6 @@ package org.simantics.sysdyn; +import java.util.HashMap; import java.util.Map; import org.simantics.databoard.binding.Binding; @@ -14,6 +15,7 @@ import org.simantics.db.layer0.variable.StandardGraphChildVariable; import org.simantics.db.layer0.variable.ValueAccessor; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.VariableMap; +import org.simantics.db.layer0.variable.VariableMapImpl; import org.simantics.layer0.Layer0; import org.simantics.operation.Layer0X; import org.simantics.scl.reflection.annotations.SCLValue; @@ -69,7 +71,7 @@ public class Functions { @SCLValue(type = "VariableMap") - public static VariableMap runProperties = new VariableMap() { + public static VariableMap runProperties = new VariableMapImpl() { @Override public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { @@ -82,12 +84,13 @@ public class Functions { } @Override - public void getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + return map; } }; @SCLValue(type = "VariableMap") - public static VariableMap valuePropertyProperties = new VariableMap() { + public static VariableMap valuePropertyProperties = new VariableMapImpl() { @Override public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { @@ -110,7 +113,8 @@ public class Functions { } @Override - public void getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + return map; // Collections.emptyList(); // StandardGraphChildVariable variable = (StandardGraphChildVariable)context; // collectPropertiesFromContext(graph, variable, variable.resource, map); @@ -120,7 +124,7 @@ public class Functions { @SCLValue(type = "VariableMap") - public static VariableMap runChildren = new VariableMap() { + public static VariableMap runChildren = new VariableMapImpl() { @Override public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { @@ -132,21 +136,26 @@ public class Functions { } @Override - public void getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { + StandardGraphChildVariable variable = (StandardGraphChildVariable)context; - All.getStandardChildDomainChildVariables(graph, context, map); + map = All.getStandardChildDomainChildVariables(graph, context, map); for(Map.Entry entry : graph.syncRequest(new StructuralChildMapOfResource(getConfiguration(graph, variable))).entrySet()) { String name = entry.getKey(); Resource child = entry.getValue(); Variable var = graph.getPossibleContextualAdapter(child, variable, Variable.class, Variable.class); if(var != null) { + if(map == null) map = new HashMap(); map.put(name, var); } else { System.err.println("No adapter for " + child + " in " + variable.getURI(graph)); } } + + return map; + } Resource getConfiguration(ReadGraph graph, Variable run) throws DatabaseException { diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java index e6905109..d7c488df 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java @@ -30,6 +30,7 @@ import org.eclipse.core.runtime.preferences.DefaultScope; import org.eclipse.core.runtime.preferences.IScopeContext; import org.osgi.service.prefs.Preferences; import org.simantics.db.ReadGraph; +import org.simantics.db.RequestProcessor; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.VirtualGraph; @@ -651,7 +652,7 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment, } @Override - public void refresh(Session session) { + public void refresh(RequestProcessor session) { session.asyncRequest(new ReadRequest() { @Override @@ -661,6 +662,11 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment, }); } + + @Override + public void refresh(Session session) { + refresh((RequestProcessor)session); + } @Override protected void localStateChange() { -- 2.47.1