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;
if (!graph.hasStatement(parameter))
return null;
- Variable componentVariable = Variables.getVariable(graph, parameter);
+ Variable componentVariable = Variables.getPossibleVariable(graph, parameter);
+ if (componentVariable == null) {
+ // Resource might be deleted already and therefore no URI available for variable building
+ return null;
+ }
Variable propertyVariable = componentVariable.getProperty(graph, parameter2);
Variable typeVariable = Variables.getVariable(graph, type);
}
}
- private static class ComponentSyncListenerAdapter extends SyncListenerAdapter<Set<Resource>> implements Disposable {
+ private static class ComponentSyncListenerAdapter extends AsyncListenerAdapter<Set<Resource>> implements Disposable {
private ConcurrentHashMap<Resource, SCLValueDisposableSyncListener> currentlyListening = new ConcurrentHashMap<>();
private boolean disposed;
}
@Override
- public void execute(ReadGraph graph, Set<Resource> newComponents) {
+ public void execute(AsyncReadGraph graph, Set<Resource> newComponents) {
if (currentlyListening.isEmpty() && newComponents.isEmpty()) {
// we can stop here as nothing will change
return;