Merge commit 'ffdf837'
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / SCL.java
index bfa42b40e18707e020bd27b0d0a9fb9de3654a8f..24e50c0f7606c2cdde27fefdb0fb8a20a2d32d65 100644 (file)
@@ -16,13 +16,13 @@ import org.simantics.SimanticsPlatform.OntologyRecoveryPolicy;
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.request.ReadRequest;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.request.external.EclipsePreferencePrimitiveRead;\r
 import org.simantics.db.layer0.util.RemoverUtil;\r
 import org.simantics.db.layer0.util.SimanticsClipboard;\r
 import org.simantics.db.service.DebugSupport;\r
+import org.simantics.db.service.ServiceActivityMonitor;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 \r
@@ -64,29 +64,33 @@ public class SCL {
        //  but unfortunately this does not work either...\r
        // so we synchronize by a familiar write transaction\r
         // And then wait still some more\r
-               for(int i=0;i<3;i++) {\r
-              Simantics.getSession().syncRequest(new WriteRequest() {\r
-                   @Override\r
-                   public void perform(WriteGraph graph) throws DatabaseException {\r
-                   }\r
-\r
-                       @Override\r
-                       public String toString() {\r
-                               return "Utils sync";\r
-                       }\r
-              });\r
-\r
-              // And then wait still some more\r
-              Simantics.getSession().syncRequest(new ReadRequest() {\r
-                  @Override\r
-                  public void run(ReadGraph graph) throws DatabaseException {\r
-                  }\r
-             });\r
-               }\r
+//             for(int i=0;i<3;i++) {\r
+       Simantics.getSession().syncRequest(new WriteRequest() {\r
+            @Override\r
+            public void perform(WriteGraph graph) throws DatabaseException {\r
+            }\r
+\r
+               @Override\r
+               public String toString() {\r
+                       return "Utils sync";\r
+               }\r
+       });\r
+//\r
+//            // And then wait still some more\r
+//            Simantics.getSession().syncRequest(new ReadRequest() {\r
+//                @Override\r
+//                public void run(ReadGraph graph) throws DatabaseException {\r
+//                }\r
+//           });\r
+//             }\r
     }\r
 \r
     public static void syncGraph() throws Exception {\r
-        sync();\r
+        try {\r
+            Simantics.getSession().getService(ServiceActivityMonitor.class).waitForCompletion();\r
+        } catch (InterruptedException e) {\r
+            throw new DatabaseException(e);\r
+        }\r
 \r
                // OK, now the experiment activate job should be scheduled\r
                // Wait for the job to finish\r