X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fscl%2FSimantics%2FRename.scl;h=cb048e037ff672cb87841f22bd53adab9316866f;hp=a7d2a3c192fa44ad954b36fdbed51885b9573723;hb=c26409b1caf2f1e560d37c5befd11b442399c3fe;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics.modeling/scl/Simantics/Rename.scl b/bundles/org.simantics.modeling/scl/Simantics/Rename.scl index a7d2a3c19..cb048e037 100644 --- a/bundles/org.simantics.modeling/scl/Simantics/Rename.scl +++ b/bundles/org.simantics.modeling/scl/Simantics/Rename.scl @@ -1,61 +1,61 @@ -import "Simantics/Entity" hiding (findFreshName) - -importJava "org.simantics.modeling.Rename" where - @JavaName renameNode - """ - renameNode resource newName - - Renames the given `resource` with the given `newName` and returns - `string` - - Example: - - > renameNode resource "NewName" - "Succesfully renamed oldName to NewName" - - or error if failed - """ - renameNode :: Resource -> String -> String - -""" - renameMBNode entity newName - -Renames the given `entity` with the given `newName` and returns -`string` - -Example: - - > renameMBNode entity "NewName" - "Succesfully renamed oldName to NewName" - -or error if failed -""" -renameMBNode :: Resource -> String -> String -renameMBNode entity newname = do - renameNode (toResource entity) newname - -importJava "org.simantics.db.common.utils.NameUtils" where - @JavaName findFreshName - """ - findFreshName name container - - Finds fresh and unused name with proposition `name` under the given `container` - and returns the freshName - - Example: - - freshName = findFreshName "Model" currentProject () - """ - findFreshName :: String -> Resource -> String - - @JavaName getSafeName - """ - getSafeName resource - - Gets safe name for the given `resource` and returns the name - - Example: - - name = getSafeName (toResource model) - """ +import "Simantics/Entity" hiding (findFreshName) + +importJava "org.simantics.modeling.Rename" where + @JavaName renameNode + """ + renameNode resource newName + + Renames the given `resource` with the given `newName` and returns + `string` + + Example: + + > renameNode resource "NewName" + "Succesfully renamed oldName to NewName" + + or error if failed + """ + renameNode :: Resource -> String -> String + +""" + renameMBNode entity newName + +Renames the given `entity` with the given `newName` and returns +`string` + +Example: + + > renameMBNode entity "NewName" + "Succesfully renamed oldName to NewName" + +or error if failed +""" +@deprecated "This function is equivalent to renameNode." +renameMBNode :: Resource -> String -> String +renameMBNode entity newname = renameNode entity newname + +importJava "org.simantics.db.common.utils.NameUtils" where + @JavaName findFreshName + """ + findFreshName name container + + Finds fresh and unused name with proposition `name` under the given `container` + and returns the freshName + + Example: + + freshName = findFreshName "Model" currentProject () + """ + findFreshName :: String -> Resource -> String + + @JavaName getSafeName + """ + getSafeName resource + + Gets safe name for the given `resource` and returns the name + + Example: + + name = getSafeName (toResource model) + """ getSafeName :: Resource -> String \ No newline at end of file