X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fscl%2FSCLUtil.java;h=ae6bac4baeff7716b0795d16ceb8b780b2e6a88c;hb=53d55c24c779745f188bdb18d32f71d20acb61b2;hp=9007432b329f81f86a3a1b2db2a33695c812410c;hpb=f36217aeeb09c0c46f99886ee99772156ce9cfe6;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scl/SCLUtil.java b/org.simantics.plant3d/src/org/simantics/plant3d/scl/SCLUtil.java index 9007432b..ae6bac4b 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scl/SCLUtil.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scl/SCLUtil.java @@ -17,57 +17,57 @@ import org.simantics.plant3d.utils.ComponentUtils; import org.simantics.plant3d.utils.P3DUtil; public class SCLUtil { - - public static P3DScriptNodeMap load(final Resource root) throws DatabaseException { - try { - ControlPointFactory.preloadCache(); - ComponentUtils.preloadCache(); - } catch (Exception e) { - throw new DatabaseException(e); - } - return Simantics.getSession().syncRequest(new Read() { - @Override - public P3DScriptNodeMap perform(ReadGraph graph) throws DatabaseException { - PipingRules.setEnabled(false); - IMappingSchema schema = SchemaBuilder.getSchema(graph); - IMapping mapping = Mappings.createWithListening(schema); - P3DRootNode rootNode = (P3DRootNode)mapping.map(graph, root); - try { - P3DUtil.finalizeDBLoad(rootNode); - } catch (Exception e) { - throw new DatabaseException(e); - } - P3DScriptNodeMap nodeMap = new P3DScriptNodeMap(Simantics.getSession(), mapping, rootNode); - return nodeMap; - - } - }); - - } - - public static P3DRootNode loadReadOnly(final Resource root) throws DatabaseException { - try { - ControlPointFactory.preloadCache(); - ComponentUtils.preloadCache(); - } catch (Exception e) { - throw new DatabaseException(e); - } - return Simantics.getSession().syncRequest(new Read() { - @Override - public P3DRootNode perform(ReadGraph graph) throws DatabaseException { - PipingRules.setEnabled(false); - IMappingSchema schema = SchemaBuilder.getSchema(graph); - IMapping mapping = Mappings.createWithoutListening(schema); - P3DRootNode rootNode = (P3DRootNode)mapping.map(graph, root); - try { - P3DUtil.finalizeDBLoad(rootNode); - } catch (Exception e) { - throw new DatabaseException(e); - } - return rootNode; - - } - }); - } + + public static P3DScriptNodeMap load(final Resource root) throws DatabaseException { + try { + ControlPointFactory.preloadCache(); + ComponentUtils.preloadCache(); + } catch (Exception e) { + throw new DatabaseException(e); + } + return Simantics.getSession().syncRequest(new Read() { + @Override + public P3DScriptNodeMap perform(ReadGraph graph) throws DatabaseException { + PipingRules.setEnabled(false); + IMappingSchema schema = SchemaBuilder.getSchema(graph); + IMapping mapping = Mappings.createWithListening(schema); + P3DRootNode rootNode = (P3DRootNode)mapping.map(graph, root); + try { + P3DUtil.finalizeDBLoad(rootNode); + } catch (Exception e) { + throw new DatabaseException(e); + } + P3DScriptNodeMap nodeMap = new P3DScriptNodeMap(Simantics.getSession(), mapping, rootNode); + return nodeMap; + + } + }); + + } + + public static P3DRootNode loadReadOnly(final Resource root) throws DatabaseException { + try { + ControlPointFactory.preloadCache(); + ComponentUtils.preloadCache(); + } catch (Exception e) { + throw new DatabaseException(e); + } + return Simantics.getSession().syncRequest(new Read() { + @Override + public P3DRootNode perform(ReadGraph graph) throws DatabaseException { + PipingRules.setEnabled(false); + IMappingSchema schema = SchemaBuilder.getSchema(graph); + IMapping mapping = Mappings.createWithoutListening(schema); + P3DRootNode rootNode = (P3DRootNode)mapping.map(graph, root); + try { + P3DUtil.finalizeDBLoad(rootNode); + } catch (Exception e) { + throw new DatabaseException(e); + } + return rootNode; + + } + }); + } }