import org.simantics.db.RequestProcessor;
import org.simantics.db.Resource;
import org.simantics.db.Session;
+import org.simantics.db.VirtualGraph;
import org.simantics.db.common.ResourceArray;
import org.simantics.db.common.exception.DebugException;
import org.simantics.db.common.procedure.adapter.AsyncProcedureAdapter;
// Internal state machine handling END
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
/**
* @param processor
* @param canvas
* @throws DatabaseException
*/
public GraphToDiagramSynchronizer(RequestProcessor processor, ICanvasContext canvas, IElementClassProvider elementClassProvider) throws DatabaseException {
+ this(processor,canvas,elementClassProvider, null);
+ }
+ public GraphToDiagramSynchronizer(RequestProcessor processor, ICanvasContext canvas, IElementClassProvider elementClassProvider, VirtualGraph virtualGraph) throws DatabaseException {
if (processor == null)
throw new IllegalArgumentException("null processor");
if (canvas == null)
this.session = processor.getSession();
this.canvas = canvas;
- this.modificationQueue = new ModificationQueue(session, errorHandler);
+ this.modificationQueue = new ModificationQueue(session, errorHandler, virtualGraph);
processor.syncRequest(new ReadRequest() {
@Override
*******************************************************************************/
package org.simantics.diagram.synchronization.graph;
+import org.simantics.db.VirtualGraph;
import org.simantics.db.WriteGraph;
import org.simantics.db.common.request.WriteRequest;
import org.simantics.db.exception.DatabaseException;
import org.simantics.diagram.internal.timing.Timing;
import org.simantics.diagram.synchronization.ErrorHandler;
import org.simantics.diagram.synchronization.IModification;
-import org.simantics.utils.logging.TimeLogger;
/**
* A graph database write request that composes several {@link IModification}
this.errorHandler = errorHandler;
this.modifications = modifications;
}
+
+ public ModificationProcessRequest(ErrorHandler errorHandler, IModification[] modifications, VirtualGraph provider) {
+ super(provider);
+ this.errorHandler = errorHandler;
+ this.modifications = modifications;
+ }
+
@Override
public void perform(final WriteGraph g) throws DatabaseException {
import java.util.Deque;
import org.simantics.db.RequestProcessor;
+import org.simantics.db.VirtualGraph;
import org.simantics.diagram.internal.DebugPolicy;
import org.simantics.diagram.synchronization.ErrorHandler;
import org.simantics.diagram.synchronization.IModification;
private final RequestProcessor writebackProcessor;
private final ErrorHandler errorHandler;
private final Deque<IModification> writebackQueue = new ArrayDeque<IModification>();
-
+ private final VirtualGraph virtualGraph;
+
public ModificationQueue(RequestProcessor writebackProcessor, ErrorHandler errorHandler) {
this.writebackProcessor = writebackProcessor;
this.errorHandler = errorHandler;
+ this.virtualGraph = null;
+ }
+
+ public ModificationQueue(RequestProcessor writebackProcessor, ErrorHandler errorHandler, VirtualGraph virtualGraph) {
+ this.writebackProcessor = writebackProcessor;
+ this.errorHandler = errorHandler;
+ this.virtualGraph = virtualGraph;
}
public void dispose() {
}
+
ModificationProcessRequest createModificationRequest() {
IModification[] mods = IModification.NONE;
mods = writebackQueue.toArray(IModification.NONE);
writebackQueue.clear();
}
- return new ModificationProcessRequest(errorHandler, mods);
+ return new ModificationProcessRequest(errorHandler, mods, virtualGraph);
}
void dispatchModifications() {
import org.simantics.databoard.Bindings;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
+import org.simantics.db.VirtualGraph;
import org.simantics.db.common.ResourceArray;
import org.simantics.db.common.primitiverequest.PossibleAdapter;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.management.ISessionContext;
import org.simantics.db.procedure.Listener;
import org.simantics.db.request.Read;
+import org.simantics.db.service.VirtualGraphSupport;
import org.simantics.diagram.adapter.DefaultConnectionClassFactory;
import org.simantics.diagram.adapter.FlagClassFactory;
import org.simantics.diagram.adapter.GraphToDiagramSynchronizer;
fillInitialDiagramHints(initialHints);
final RuntimeDiagramManager runtimeDiagramManager = RuntimeDiagramManager.create(Simantics.getSession(), resource, modelURI, RVI);
+ VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class);
synchronizer = Simantics.getSession().syncRequest(new Read<GraphToDiagramSynchronizer>() {
@Override
if(val != null && navigation == null) { // Set only if navigation has not been set manually
navigation = val;
}
- GraphToDiagramSynchronizer sync = new GraphToDiagramSynchronizer(graph, ctx,createElementClassProvider(graph));
+ VirtualGraph virtualGraph = support.getGraph(graph, resource);
+ GraphToDiagramSynchronizer sync;
+ if (virtualGraph != null) {
+ sync = new GraphToDiagramSynchronizer(graph, ctx,createElementClassProvider(graph), virtualGraph);
+ } else {
+ sync = new GraphToDiagramSynchronizer(graph, ctx,createElementClassProvider(graph));
+ }
sync.set(ModelingSynchronizationHints.MODELING_RESOURCE, ModelingResources.getInstance(graph));
diagram = sync.loadDiagram(new NullProgressMonitor(), graph, null, resource, runtimeDiagramManager.getRuntimeDiagram(), structuralPath, initialHints); // FIXME