import org.simantics.db.common.request.WriteRequest;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.request.Read;
+import org.simantics.db.service.TransactionSupport;
import org.simantics.db.service.VirtualGraphSupport;
import org.simantics.diagram.stubs.DiagramResource;
import org.simantics.diagram.ui.DiagramModelHints;
G2DSceneGraph sg = provider.initializeSceneGraph(new G2DSceneGraph(), modelURI, diagramRVI);
NodeUtil.waitPending(cp.getCanvasContext().getThreadAccess(), sg);
-
- return cp.getCanvasContext();
- }
-
- /**
- * @deprecated this leaks ICanvasSceneGraphProvider, use
- * {@link #loadSceneGraphProvider(ICanvasContext, Resource, Resource, String)}
- * instead
- */
- public static ICanvasContext loadDiagram(ICanvasContext context, Resource model, Resource composite, String diagramRVI) throws DatabaseException, InterruptedException {
- String modelURI = Simantics.getSession().syncRequest(Queries.uri(model));
- ISceneGraphProvider provider = Simantics.getSession().syncRequest( Queries.adapt( composite, ISceneGraphProvider.class ) );
- ICanvasSceneGraphProvider cp = (ICanvasSceneGraphProvider) provider;
- cp.initializeSceneGraph(context, modelURI, diagramRVI);
-
- NodeUtil.waitPending(cp.getCanvasContext().getThreadAccess(), context.getSceneGraph());
+ Simantics.getSession().getService(TransactionSupport.class).waitCompletion();
return cp.getCanvasContext();
}
G2DSceneGraph sg = cp.initializeSceneGraph(new G2DSceneGraph(), modelURI, diagramRVI);
NodeUtil.waitPending(cp.getCanvasContext().getThreadAccess(), sg);
+ Simantics.getSession().getService(TransactionSupport.class).waitCompletion();
return cp;
}
ICanvasSceneGraphProvider cp = (ICanvasSceneGraphProvider) provider;
cp.initializeSceneGraph(context, modelURI, diagramRVI);
NodeUtil.waitPending(cp.getCanvasContext().getThreadAccess(), context.getSceneGraph(), timeoutMs);
+ Simantics.getSession().getService(TransactionSupport.class).waitCompletion();
return cp;
}
ICanvasSceneGraphProvider cp = (ICanvasSceneGraphProvider) provider;
cp.initializeSceneGraph(context, modelURI, diagramRVI);
NodeUtil.waitPending(cp.getCanvasContext().getThreadAccess(), context.getSceneGraph());
+ Simantics.getSession().getService(TransactionSupport.class).waitCompletion();
return cp;
}