]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java
Grant access to diagram APIs to enable web based diagram editing
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / sg / DiagramSceneGraphProvider.java
index 97d23f05f271f14214a6ec38e5382d407c5476aa..61305ade0c58e8bc8162ff5308e34b3e1dbf3ffe 100644 (file)
@@ -171,6 +171,10 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi
         }
     }
 
         }
     }
 
+    public GraphToDiagramSynchronizer getGraphToDiagramSynchronizer() {
+        return synchronizer;
+    }
+
     protected CopyPasteStrategy getCopyPasteStrategy() {
                try {
                        CopyPasteStrategy cpStrategy = Simantics.getSession().syncRequest(new PossibleAdapter<CopyPasteStrategy>(resource, CopyPasteStrategy.class));
     protected CopyPasteStrategy getCopyPasteStrategy() {
                try {
                        CopyPasteStrategy cpStrategy = Simantics.getSession().syncRequest(new PossibleAdapter<CopyPasteStrategy>(resource, CopyPasteStrategy.class));
@@ -189,7 +193,7 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi
                return new MappedElementCopyAdvisor(new ElementCopyAdvisor(), new ComponentCopyAdvisor());
     }
     
                return new MappedElementCopyAdvisor(new ElementCopyAdvisor(), new ComponentCopyAdvisor());
     }
     
-    private void initContext(CanvasContext ctx) {
+    protected void initContext(CanvasContext ctx) {
         boolean unlock = false;
         if (!ctx.isLocked()) {
             ctx.setLocked(true);
         boolean unlock = false;
         if (!ctx.isLocked()) {
             ctx.setLocked(true);
@@ -431,7 +435,7 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi
 
         try {
             // FIXME: I have no idea if this works or not..
 
         try {
             // FIXME: I have no idea if this works or not..
-            diagram = SimanticsUI.getSession().syncRequest(new Read<IDiagram>() {
+            diagram = Simantics.getSession().syncRequest(new Read<IDiagram>() {
                 @Override
                 public IDiagram perform(ReadGraph graph) throws DatabaseException {
                     IDiagram d = synchronizer.loadDiagram(new NullProgressMonitor(), graph, null, structuralPath.resources[0], null, structuralPath.removeFromBeginning(0), hints);
                 @Override
                 public IDiagram perform(ReadGraph graph) throws DatabaseException {
                     IDiagram d = synchronizer.loadDiagram(new NullProgressMonitor(), graph, null, structuralPath.resources[0], null, structuralPath.removeFromBeginning(0), hints);