]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Guard graph SCL module compilation 82/4482/1
authorAntti Villberg <antti.villberg@semantum.fi>
Tue, 6 Oct 2020 13:51:28 +0000 (16:51 +0300)
committerJani Simomaa <jani.simomaa@semantum.fi>
Tue, 6 Oct 2020 20:11:05 +0000 (20:11 +0000)
gitlab #616

Change-Id: I882a5414884f1838710ae02c80e153399dc38b9f

bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphModuleSourceRepository.java

index 8eed51aca7ed70401b7ddafb7da5a13bab85b2ff..a70844cd375c8956adb593cb71406e92d782e963 100644 (file)
@@ -12,6 +12,8 @@ import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.procedure.SyncListener;
 import org.simantics.db.request.Read;
+import org.simantics.db.request.ReadExt;
+import org.simantics.db.request.RequestFlags;
 import org.simantics.layer0.Layer0;
 import org.simantics.modeling.ModelingUtils;
 import org.simantics.modeling.internal.Activator;
@@ -137,6 +139,29 @@ public enum GraphModuleSourceRepository implements ModuleSourceRepository {
         }
     }
 
+    static class PossibleResourceIU extends UnaryRead<String,Resource> implements ReadExt {
+
+        public PossibleResourceIU(String parameter) {
+            super(parameter);
+        }
+
+        @Override
+        public Resource perform(ReadGraph graph) throws DatabaseException {
+            return graph.getPossibleResource(parameter);
+        }
+
+        @Override
+        public boolean isImmutable(ReadGraph graph) throws DatabaseException {
+            return false;
+        }
+
+        @Override
+        public int getType() {
+            return RequestFlags.IMMEDIATE_UPDATE;
+        }
+        
+    }
+    
     static class ReadModuleSource extends UnaryRead<String, ModuleSource> {
         public ReadModuleSource(String moduleName) {
             super(moduleName);
@@ -144,7 +169,7 @@ public enum GraphModuleSourceRepository implements ModuleSourceRepository {
 
         @Override
         public ModuleSource perform(ReadGraph graph) throws DatabaseException {
-            Resource moduleResource = graph.getPossibleResource(parameter);
+            Resource moduleResource = graph.syncRequest(new PossibleResourceIU(parameter));
             if(moduleResource == null)
                 return null;
             Layer0 L0 = Layer0.getInstance(graph);