]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling/scl/Simantics/Rename.scl
Fixed Simantics/Diagram/setElements to resolve attachment relations
[simantics/platform.git] / bundles / org.simantics.modeling / scl / Simantics / Rename.scl
1 import "Simantics/Entity" hiding (findFreshName)
2
3 importJava "org.simantics.modeling.Rename" where
4     @JavaName renameNode
5     """
6         renameNode resource newName
7         
8     Renames the given `resource` with the given `newName` and returns
9     `string`
10     
11     Example:
12     
13         > renameNode resource "NewName"
14         "Succesfully renamed oldName to NewName"
15         
16     or error if failed
17     """
18     renameNode :: Resource -> String -> <WriteGraph> String
19
20 """
21     renameMBNode entity newName
22     
23 Renames the given `entity` with the given `newName` and returns
24 `string`
25
26 Example:
27
28     > renameMBNode entity "NewName"
29     "Succesfully renamed oldName to NewName"
30     
31 or error if failed
32 """
33 @deprecated "This function is equivalent to renameNode."
34 renameMBNode :: Resource -> String -> <WriteGraph> String
35 renameMBNode entity newname = renameNode entity newname
36
37 importJava "org.simantics.db.common.utils.NameUtils" where
38     @JavaName findFreshName
39     """
40         findFreshName name container
41         
42     Finds fresh and unused name with proposition `name` under the given `container`
43     and returns the freshName
44     
45     Example:
46     
47         freshName = findFreshName "Model" currentProject ()
48     """
49     findFreshName :: String -> Resource -> <ReadGraph> String
50     
51     @JavaName getSafeName
52     """
53         getSafeName resource
54         
55     Gets safe name for the given `resource` and returns the name
56     
57     Example:
58     
59         name = getSafeName (toResource model)
60     """
61     getSafeName :: Resource -> <ReadGraph> String