X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fprocedures%2FPropagateNewMarks.java;h=c9235361bae0bdb7000d2eb8a66e28d490daee26;hb=687435a49e86496511f8e92ff743211cb191838a;hp=58eae257f3dfc094fe41dd27b291d0589177890f;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/PropagateNewMarks.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/PropagateNewMarks.java index 58eae257f..c9235361b 100644 --- a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/PropagateNewMarks.java +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/PropagateNewMarks.java @@ -15,10 +15,23 @@ public class PropagateNewMarks implements Runnable { if(identities.markNew(child)) propagateNewMarks(child); } - + + /** + * Mark all parents of resources marked new as optional provisionally. This mark is removed + * in ValidateGraph.run, if the resource can be found in dependencies. + */ + private void propagateOptionalMarks(int child) { + int parent = identities.getParent(child); + if(parent >= 0 && !identities.isRoot(parent) && !identities.isNewResource(parent) && identities.markOptional(parent)) + propagateOptionalMarks(parent); + } + @Override public void run() { - for(int resource : identities.getNewResources()) - propagateNewMarks(resource); + int[] originalNewResources = identities.getNewResources(); + for(int resource : originalNewResources) + propagateNewMarks(resource); + for(int resource : originalNewResources) + propagateOptionalMarks(resource); } }