X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fvariable%2FProxyVariables.java;h=ddfe108cb713a409f1da67df7e688748bdb94606;hp=db552650b09c7098074bfd069b954a9b5d80ca15;hb=d4be6acae73573577010753ad17c646b33a48e57;hpb=bbb010408d256235b4d2dcfb87bf31f49fc1f8a6 diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/ProxyVariables.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/ProxyVariables.java index db552650b..ddfe108cb 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/ProxyVariables.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/ProxyVariables.java @@ -2,9 +2,29 @@ package org.simantics.db.layer0.variable; import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ProxyVariables { - + + private static final Logger LOGGER = LoggerFactory.getLogger(ProxyVariables.class); + + public static Variable tryToOwn(ReadGraph graph, Variable parent, Variable variable) { + if (variable instanceof ProxyVariableSupport) { + ProxyVariableSupport pvs = (ProxyVariableSupport) variable; + return pvs.attachTo(graph, parent); + } + return null; + } + + public static Variable tryToOwnRenamed(ReadGraph graph, Variable parent, Variable variable, String name) { + if (variable instanceof ProxyVariableSupport) { + ProxyVariableSupport pvs = (ProxyVariableSupport) variable; + return pvs.attachToRenamed(graph, parent, name); + } + return null; + } + public static Variable inputVariable(ReadGraph graph, Variable context) throws DatabaseException { Variable session = graph.syncRequest(new ProxySessionRequest(context)); if(session == null) return null; @@ -52,7 +72,7 @@ public class ProxyVariables { return input; } } catch (Throwable t) { - t.printStackTrace(); + LOGGER.error("proxySessionVariable failed", t); return null; } @@ -72,7 +92,7 @@ public class ProxyVariables { } } catch (Throwable t) { - t.printStackTrace(); + LOGGER.error("proxyVariableBase failed", t); return null; } @@ -108,7 +128,7 @@ public class ProxyVariables { } } catch (Throwable t) { - t.printStackTrace(); + LOGGER.error("proxyVariableRoot failed", t); return null; } @@ -118,5 +138,4 @@ public class ProxyVariables { return proxyVariableRoot(graph, variable) != null; } - }