]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge commit '621bec7'
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sat, 17 Sep 2016 11:37:47 +0000 (14:37 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sat, 17 Sep 2016 11:37:47 +0000 (14:37 +0300)
bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalUtil.java

index 9c29290a50e03e2e1da3e01c6afc591aa6b4d9ea..e15f5036d9be684d25fe5f2e7d8b315b229f8b36 100644 (file)
@@ -619,15 +619,19 @@ public class TypicalUtil {
                 // Attach the same symbol contributions to the created typical\r
                 // diagram type as are attached to the model-designated\r
                 // contribution source diagram type.\r
+                boolean clonedIndexRootContribution = false;\r
                 for (Resource symbolContributionSource : cloneSymbolContributionsFrom) {\r
                     for (Resource contribution : graph.getObjects(symbolContributionSource, DIA.HasSymbolContribution)) {\r
                         graph.claim(diagramType, DIA.HasSymbolContribution, contribution);\r
+                        clonedIndexRootContribution |= graph.isInstanceOf(contribution, DIA.IndexRootSymbolContribution);\r
                     }\r
                 }\r
 \r
-                Resource indexContribution = graph.newResource();\r
-                graph.claim(indexContribution, L0.InstanceOf, DIA.IndexRootSymbolContribution);\r
-                graph.claim(diagramType, DIA.HasSymbolContribution, indexContribution);\r
+                if (!clonedIndexRootContribution) {\r
+                    Resource indexContribution = graph.newResource();\r
+                    graph.claim(indexContribution, L0.InstanceOf, DIA.IndexRootSymbolContribution);\r
+                    graph.claim(diagramType, DIA.HasSymbolContribution, indexContribution);\r
+                }\r
 \r
                 // Add comment to change set.\r
                 CommentMetadata cm = graph.getMetadata(CommentMetadata.class);\r