From: Hannu Niemistö Date: Thu, 18 Oct 2018 10:13:33 +0000 (+0300) Subject: Made SCLExpressionIssueProvider component requests synchronous X-Git-Tag: v1.43.0~136^2~323 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=92ad7da377109c556029f64566e3a2ab67ac57c6;hp=a52f0324c9435755d3da3f053794c077f7d58213 Made SCLExpressionIssueProvider component requests synchronous gitlab #149 Change-Id: I1104380dd544f3bc957cd008e46e9b284dd2f207 --- diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/issue/SCLExpressionIssueProvider.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/issue/SCLExpressionIssueProvider.java index 46142247f..1d04928c8 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/issue/SCLExpressionIssueProvider.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/issue/SCLExpressionIssueProvider.java @@ -12,13 +12,12 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.simantics.Simantics; -import org.simantics.db.AsyncReadGraph; import org.simantics.db.Disposable; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; -import org.simantics.db.common.procedure.adapter.AsyncListenerAdapter; import org.simantics.db.common.procedure.adapter.DisposableListener; import org.simantics.db.common.procedure.adapter.DisposableSyncListener; +import org.simantics.db.common.procedure.adapter.SyncListenerAdapter; import org.simantics.db.common.request.TernaryRead; import org.simantics.db.common.request.UnaryRead; import org.simantics.db.common.request.UniqueRead; @@ -185,7 +184,7 @@ public class SCLExpressionIssueProvider implements SCLIssueProvider { } } - private static class ComponentSyncListenerAdapter extends AsyncListenerAdapter> implements Disposable { + private static class ComponentSyncListenerAdapter extends SyncListenerAdapter> implements Disposable { private ConcurrentHashMap currentlyListening = new ConcurrentHashMap<>(); private boolean disposed; @@ -196,7 +195,7 @@ public class SCLExpressionIssueProvider implements SCLIssueProvider { } @Override - public void execute(AsyncReadGraph graph, Set newComponents) { + public void execute(ReadGraph graph, Set newComponents) throws DatabaseException { if (currentlyListening.isEmpty() && newComponents.isEmpty()) { // we can stop here as nothing will change return; @@ -217,7 +216,7 @@ public class SCLExpressionIssueProvider implements SCLIssueProvider { for (Resource addedComponent : addedComponents) { SCLValueDisposableSyncListener listener = new SCLValueDisposableSyncListener(callback); currentlyListening.put(addedComponent, listener); - graph.asyncRequest(new SCLValueRequest(addedComponent), listener); + graph.syncRequest(new SCLValueRequest(addedComponent), listener); } }