X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2FSCL.java;h=52909e018bb36df8d1723d23b37f7321a46d0867;hb=a2a42428426818a7498d5a1705603fb8d3a8a95a;hp=691d82961e892389eb91b5842c03c36cfa49926c;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCL.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCL.java index 691d82961..52909e018 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCL.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCL.java @@ -17,13 +17,13 @@ import org.simantics.SimanticsPlatform.OntologyRecoveryPolicy; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; -import org.simantics.db.common.request.ReadRequest; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.external.EclipsePreferencePrimitiveRead; import org.simantics.db.layer0.util.RemoverUtil; import org.simantics.db.layer0.util.SimanticsClipboard; import org.simantics.db.service.DebugSupport; +import org.simantics.db.service.ServiceActivityMonitor; public class SCL { public static void killPlatformWrite(WriteGraph graph) throws DatabaseException { @@ -44,7 +44,7 @@ public class SCL { SimanticsPlatform.INSTANCE.shutdown(null); } public static void reconnectPlatform() throws Exception { - SimanticsPlatform.INSTANCE.reconnect(null); + SimanticsPlatform.INSTANCE.reconnect(Simantics.getDefaultDatabaseDriver()); } public static void synchronizeOntologies() throws Exception { SimanticsPlatform.INSTANCE.synchronizeOntologies(new NullProgressMonitor(), OntologyRecoveryPolicy.Merge, true); @@ -61,29 +61,33 @@ public class SCL { // but unfortunately this does not work either... // so we synchronize by a familiar write transaction // And then wait still some more - for(int i=0;i<3;i++) { - Simantics.getSession().syncRequest(new WriteRequest() { - @Override - public void perform(WriteGraph graph) throws DatabaseException { - } - - @Override - public String toString() { - return "Utils sync"; - } - }); - - // And then wait still some more - Simantics.getSession().syncRequest(new ReadRequest() { - @Override - public void run(ReadGraph graph) throws DatabaseException { - } - }); - } +// for(int i=0;i<3;i++) { + Simantics.getSession().syncRequest(new WriteRequest() { + @Override + public void perform(WriteGraph graph) throws DatabaseException { + } + + @Override + public String toString() { + return "Utils sync"; + } + }); +// +// // And then wait still some more +// Simantics.getSession().syncRequest(new ReadRequest() { +// @Override +// public void run(ReadGraph graph) throws DatabaseException { +// } +// }); +// } } public static void syncGraph() throws Exception { - sync(); + try { + Simantics.getSession().getService(ServiceActivityMonitor.class).waitForCompletion(); + } catch (InterruptedException e) { + throw new DatabaseException(e); + } // OK, now the experiment activate job should be scheduled // Wait for the job to finish