]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scenegraph.loader/src/org/simantics/scenegraph/loader/ScenegraphVariableAdapter.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scenegraph.loader / src / org / simantics / scenegraph / loader / ScenegraphVariableAdapter.java
diff --git a/bundles/org.simantics.scenegraph.loader/src/org/simantics/scenegraph/loader/ScenegraphVariableAdapter.java b/bundles/org.simantics.scenegraph.loader/src/org/simantics/scenegraph/loader/ScenegraphVariableAdapter.java
new file mode 100644 (file)
index 0000000..2bcbe5e
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.scenegraph.loader;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.adaption.SimpleContextualAdapter;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.StandardGraphChildVariable;\r
+import org.simantics.db.layer0.variable.Variable;\r
+\r
+public class ScenegraphVariableAdapter extends SimpleContextualAdapter<Variable, Variable> {\r
+\r
+       @Override\r
+       public Variable adapt(ReadGraph g, Resource source, Variable context) throws DatabaseException {\r
+               SceneGraphContext vc = ScenegraphLoaderUtils.getContext(g, context);\r
+               if(vc != null)\r
+                       return new ScenegraphVariable(context, source, null, /*context.adapt(g, SceneGraphContext.class).getRuntime()*/ null);\r
+               else\r
+                       return new StandardGraphChildVariable(context, null, source);\r
+       }\r
+\r
+}\r