]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling/scl/Simantics/Typicals.scl
Sync git svn branch with SVN repository r33216.
[simantics/platform.git] / bundles / org.simantics.modeling / scl / Simantics / Typicals.scl
1 import "Simantics/Ontologies"\r
2 import "Simantics/Model"\r
3 \r
4 @private\r
5 toDiagrams composites = map (flip singleObject MOD.CompositeToDiagram) composites\r
6 \r
7 @private\r
8 importJava "org.simantics.modeling.typicals.SyncTypicalTemplatesToInstances" where\r
9     syncTypicals :: Boolean -> [Resource] -> [Resource] -> <WriteGraph> ()\r
10 \r
11 """\r
12     syncAllTypicals False currentModel\r
13 \r
14 Synchronizes all typical master diagrams in the specified model with all\r
15 instances of the found typical master diagrams.\r
16 \r
17 The first argument controls whether a log of the synchronization will be\r
18 stored in the database, in the model's Documents folder.\r
19 """\r
20 syncAllTypicals :: Boolean -> Resource -> <Proc> ()\r
21 syncAllTypicals log model = syncInstancesOfTypicalMasters log masterComposites\r
22     where\r
23         masterComposites = lift2Read searchByTypeShallow model MOD.MasterTypicalCompositeType\r
24 \r
25 """\r
26     syncInstancesOfTypicalMasters False [aMasterTypicalComposite]\r
27 \r
28 Synchronizes all instances of the specified typical master diagram(s).\r
29 \r
30 The first argument controls whether a log of the synchronization will be\r
31 stored in the database, in the model's Documents folder.\r
32 \r
33 The second argument expects diagram configuration composite resources.\r
34 """\r
35 syncInstancesOfTypicalMasters :: Boolean -> [Resource] -> <Proc> ()\r
36 syncInstancesOfTypicalMasters log typicalMasterComposites = syncWrite (\_ -> syncTypicals log masterDiagrams [])\r
37     where\r
38         masterDiagrams = lift1Read toDiagrams typicalMasterComposites\r
39 \r
40 """\r
41     syncTypicalInstances False [aTypicalInstance]\r
42 \r
43 Synchronizes the specified typical instance diagram(s) with their master\r
44 diagrams.\r
45 \r
46 The first argument controls whether a log of the synchronization will be\r
47 stored in the database, in the model's Documents folder.\r
48 \r
49 The second argument expects diagram configuration composite resources.\r
50 """\r
51 syncTypicalInstances :: Boolean -> [Resource] -> <Proc> ()\r
52 syncTypicalInstances log typicalInstanceComposites = let\r
53         instanceDiagrams = lift1Read toDiagrams typicalInstanceComposites\r
54     in\r
55         syncWrite (\_ -> syncTypicals log [] instanceDiagrams)\r