@Override
public Color calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
DiagramSettings ds = graph.syncRequest(new DiagramSettingsRequest(runtimeDiagram), TransientCacheAsyncListener.instance());
- if (ds.elementColoringFunction.isPresent()) {
- if (DEBUG)
- System.out.print("elementColoringFunction: " + ds.elementColoringFunction + "(" + groupItem + "): ");
- Double t = Simantics.applySCLRead(graph, ds.elementColoringFunction.get(), groupItem);
- if (DEBUG)
- System.out.print(t);
- if (t != null) {
- Color result = ds.coloringGradient.get(t);
- //System.out.println("color(" + t + "): " + result);
- return result;
+ // Prevent PendingVariableExceptions from coming through
+ boolean wasSynchronous = graph.setSynchronous(true);
+ try {
+ if (ds.elementColoringFunction.isPresent()) {
+ if (DEBUG)
+ System.out.print("elementColoringFunction: " + ds.elementColoringFunction + "(" + groupItem + "): ");
+ Double t = Simantics.applySCLRead(graph, ds.elementColoringFunction.get(), groupItem);
+ if (DEBUG)
+ System.out.print(t);
+ if (t != null) {
+ Color result = ds.coloringGradient.get(t);
+ //System.out.println("color(" + t + "): " + result);
+ return result;
+ }
}
}
+ finally {
+ graph.setSynchronous(wasSynchronous);
+ }
return null;
}