1 import "Simantics/Entity" hiding (findFreshName)
3 importJava "org.simantics.modeling.Rename" where
6 renameNode resource newName
8 Renames the given `resource` with the given `newName` and returns
13 > renameNode resource "NewName"
14 "Succesfully renamed oldName to NewName"
18 renameNode :: Resource -> String -> <WriteGraph> String
21 renameMBNode entity newName
23 Renames the given `entity` with the given `newName` and returns
28 > renameMBNode entity "NewName"
29 "Succesfully renamed oldName to NewName"
33 @deprecated "This function is equivalent to renameNode."
34 renameMBNode :: Resource -> String -> <WriteGraph> String
35 renameMBNode entity newname = renameNode entity newname
37 importJava "org.simantics.db.common.utils.NameUtils" where
38 @JavaName findFreshName
40 findFreshName name container
42 Finds fresh and unused name with proposition `name` under the given `container`
43 and returns the freshName
47 freshName = findFreshName "Model" currentProject ()
49 findFreshName :: String -> Resource -> <ReadGraph> String
55 Gets safe name for the given `resource` and returns the name
59 name = getSafeName (toResource model)
61 getSafeName :: Resource -> <ReadGraph> String