X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fscl%2Fissue%2FSCLExpressionIssueProvider.java;h=ccffb8e775daa086659fd17f8d5a7f9fc9f2fbca;hb=refs%2Fchanges%2F93%2F4893%2F1;hp=fbba1546ffbc2a0e81a75c95bea69c6e290b9584;hpb=aca33ac9ec17d1555f6413edaa339ad3692e29bb;p=simantics%2Fplatform.git 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 fbba1546f..ccffb8e77 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 @@ -1,6 +1,7 @@ package org.simantics.modeling.scl.issue; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Objects; @@ -45,11 +46,31 @@ public class SCLExpressionIssueProvider implements SCLIssueProvider { @Override public SCLIssueProvider getSCLIssueProvider() { - return new SCLExpressionIssueProvider(); + if (Boolean.getBoolean("org.simantics.scl.issues")) + return new SCLExpressionIssueProvider(); + else + return new DummyIssueProvider(); } } + public static class DummyIssueProvider implements SCLIssueProvider { + @Override + public void listenIssues(Runnable callback) { + + } + + @Override + public List getIssues() { + return Collections.emptyList(); + } + + @Override + public void dispose() { + + } + } + private static final Logger LOGGER = LoggerFactory.getLogger(SCLExpressionIssueProvider.class); private boolean disposed = false; private ComponentSyncListenerAdapter listener; @@ -145,7 +166,11 @@ public class SCLExpressionIssueProvider implements SCLIssueProvider { 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); @@ -191,7 +216,7 @@ public class SCLExpressionIssueProvider implements SCLIssueProvider { } @Override - public void execute(ReadGraph 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; @@ -212,7 +237,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); } }