import org.simantics.db.common.request.ResourceRead;
import org.simantics.db.common.request.WriteRequest;
import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.variable.Variable;
import org.simantics.db.request.Read;
import org.simantics.db.service.TransactionSupport;
import org.simantics.db.service.VirtualGraphSupport;
import org.simantics.g2d.element.ElementHints;
import org.simantics.g2d.element.IElement;
import org.simantics.g2d.scenegraph.ICanvasSceneGraphProvider;
+import org.simantics.g2d.scenegraph.ICanvasSceneGraphProvider2;
import org.simantics.modeling.ModelingResources;
import org.simantics.scenegraph.INode;
import org.simantics.scenegraph.adapters.ISceneGraphProvider;
}
public static ICanvasSceneGraphProvider loadSceneGraphProviderForDiagram(ICanvasContext context, Resource model, Resource diagram, String diagramRVI) throws DatabaseException, InterruptedException {
+ return loadSceneGraphProviderForDiagram(context, model, diagram, diagramRVI, null);
+ }
+
+ public static ICanvasSceneGraphProvider loadSceneGraphProviderForDiagram(ICanvasContext context, Resource model, Resource diagram, String diagramRVI, Variable run) throws DatabaseException, InterruptedException {
String modelURI = Simantics.getSession().syncRequest(Queries.uri(model));
ISceneGraphProvider provider = Simantics.getSession().syncRequest( Queries.adapt( diagram, ISceneGraphProvider.class ) );
ICanvasSceneGraphProvider cp = (ICanvasSceneGraphProvider) provider;
- cp.initializeSceneGraph(context, modelURI, diagramRVI);
+ if(cp instanceof ICanvasSceneGraphProvider2) {
+ ((ICanvasSceneGraphProvider2)cp).initializeSceneGraph(context, modelURI, diagramRVI, run);
+
+ } else {
+ cp.initializeSceneGraph(context, modelURI, diagramRVI);
+ }
NodeUtil.waitPending(cp.getCanvasContext().getThreadAccess(), context.getSceneGraph());
Simantics.getSession().getService(TransactionSupport.class).waitCompletion();
return cp;
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.scenegraph;
+
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.g2d.canvas.ICanvasContext;
+import org.simantics.scenegraph.g2d.G2DSceneGraph;
+
+/**
+ * @author Antti Villberg
+ */
+public interface ICanvasSceneGraphProvider2 extends ICanvasSceneGraphProvider {
+
+ public G2DSceneGraph initializeSceneGraph(ICanvasContext context, String modelURI, String RVI, Variable experiment);
+
+}
import org.simantics.databoard.Bindings;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
+import org.simantics.db.Session;
import org.simantics.db.common.ResourceArray;
import org.simantics.db.common.primitiverequest.PossibleAdapter;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.exception.ManyObjectsForFunctionalRelationException;
import org.simantics.db.exception.NoSingleResultException;
import org.simantics.db.exception.ServiceException;
+import org.simantics.db.layer0.variable.Variable;
import org.simantics.db.management.ISessionContext;
import org.simantics.db.request.Read;
import org.simantics.diagram.adapter.DefaultConnectionClassFactory;
import org.simantics.g2d.participant.TransformUtil;
import org.simantics.g2d.participant.ZoomToAreaHandler;
import org.simantics.g2d.scenegraph.ICanvasSceneGraphProvider;
+import org.simantics.g2d.scenegraph.ICanvasSceneGraphProvider2;
import org.simantics.modeling.ModelingResources;
import org.simantics.modeling.mapping.ComponentCopyAdvisor;
import org.simantics.modeling.mapping.ElementCopyAdvisor;
* @author J-P Laine
*
*/
-public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDiagramUpdateSupport {
+public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider2, IDiagramUpdateSupport {
protected boolean isSymbol = false;
protected Resource resource;
@Override
public G2DSceneGraph initializeSceneGraph(ICanvasContext context, String modelURI, String RVI) {
G2DSceneGraph sg = context.getSceneGraph();
- return initializeSceneGraph(context, sg, modelURI, RVI, "");
+ return initializeSceneGraph(context, sg, modelURI, RVI, "", null);
}
+
+
+ @Override
+ public G2DSceneGraph initializeSceneGraph(ICanvasContext context, String modelURI, String RVI,
+ Variable experiment) {
+ G2DSceneGraph sg = context.getSceneGraph();
+ return initializeSceneGraph(context, sg, modelURI, RVI, "", experiment);
+ }
+
/**
* @param sg
private G2DSceneGraph initializeSceneGraph(G2DSceneGraph sg, String modelURI, String RVI, String view) {
IThreadWorkQueue thread = AWTThread.getThreadAccess();
ctx = new CanvasContext(thread, sg); // By giving the scene graph instance as parameter, we can use external serializer
- return initializeSceneGraph(ctx, sg, modelURI, RVI, view);
+ return initializeSceneGraph(ctx, sg, modelURI, RVI, view, null);
}
protected GraphToDiagramSynchronizer createSynchronizer(ReadGraph graph) throws DatabaseException {
)
);
}
+
+ protected RuntimeDiagramManager createRuntimeDiagramManager(Session session, Resource resource, String modelURI, String RVI, Variable experiment) throws DatabaseException {
+ return RuntimeDiagramManager.create(session, resource, modelURI, RVI);
+ }
/**
* @param sg
* @param initialHints
* @return
*/
- private G2DSceneGraph initializeSceneGraph(ICanvasContext context, G2DSceneGraph sg, String modelURI, String RVI, String view) {
+ private G2DSceneGraph initializeSceneGraph(ICanvasContext context, G2DSceneGraph sg, String modelURI, String RVI, String view, Variable run) {
this.ctx = (CanvasContext) context;
this.view = view;
if(view != null) {
initialHints.setHint(SynchronizationHints.COPY_ADVISOR, getCopyAdvisor());
- final RuntimeDiagramManager runtimeDiagramManager = RuntimeDiagramManager.create(Simantics.getSession(), resource, modelURI, RVI);
+ final RuntimeDiagramManager runtimeDiagramManager = createRuntimeDiagramManager(Simantics.getSession(), resource, modelURI, RVI, run);
synchronizer = Simantics.getSession().syncRequest(new Read<GraphToDiagramSynchronizer>() {
@Override