]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network/src/org/simantics/district/network/profile/VertexSymbolStyle.java
Disable throttling for now, as it doens't work.
[simantics/district.git] / org.simantics.district.network / src / org / simantics / district / network / profile / VertexSymbolStyle.java
index 96ff439235971ec19438150e36ff8f2cb019b68b..26a5564d5fade5e47180b437fd12b5c56f66032f 100644 (file)
@@ -6,7 +6,6 @@ import org.simantics.db.Resource;
 import org.simantics.db.common.procedure.adapter.TransientCacheListener;
 import org.simantics.db.common.request.ResourceRead;
 import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.layer0.exception.PendingVariableException;
 import org.simantics.district.network.ontology.DistrictNetworkResource;
 import org.simantics.layer0.Layer0;
 import org.simantics.scenegraph.INode;
@@ -26,18 +25,22 @@ public class VertexSymbolStyle extends ThrottledStyleBase<String> {
        @SuppressWarnings({ "rawtypes", "unchecked" })
        @Override
        public String calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
-
-               Function symbolFunction = getSymbolFunction(graph, entry);
-               if (symbolFunction == null)
-                       return null;
-               
+               // Prevent PendingVariableExceptions from coming through
+               boolean wasSynchronous = graph.setSynchronous(true);
                try {
-                       return (String) Simantics.applySCLRead(graph, symbolFunction, groupItem);
-               } catch (PendingVariableException e) {
-                       throw e;
-               } catch (Exception e) {
-                       LOGGER.error("Getting dynamic symbol for " + groupItem + " (" + graph.getPossibleRelatedValue(groupItem, Layer0.getInstance(graph).HasName) + ") failed", e);
-                       return null;
+                       Function symbolFunction = getSymbolFunction(graph, entry);
+                       if (symbolFunction == null)
+                               return null;
+                       
+                       try {
+                               return (String) Simantics.applySCLRead(graph, symbolFunction, groupItem);
+                       } catch (Exception e) {
+                               LOGGER.error("Getting dynamic symbol for " + groupItem + " (" + graph.getPossibleRelatedValue(groupItem, Layer0.getInstance(graph).HasName) + ") failed", e);
+                               return null;
+                       }
+               }
+               finally {
+                       graph.setSynchronous(wasSynchronous);
                }
        }