Created
July 18, 2020 19:42
-
-
Save tkazimie/5a500d3e156c7fd36166ca2fe95a2047 to your computer and use it in GitHub Desktop.
Set the name prefix + colon for selected elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Set the name prefix for selected elements | |
* | |
* Requires jArchi - https://www.archimatetool.com | |
* | |
* This script adds given text + collon before the object name. | |
* If prefix with collon already existed it is replace by new one. | |
* In case of wrong selection effect can be reversed with crt-z (command-z on Mac) | |
* | |
* Script will prompt you: for the text | |
* | |
* | |
* Version 1: Set the name prefix for selected elements | |
* | |
* 2020 by [email protected] | |
* | |
*/ | |
var debug = false; | |
console.clear(); | |
console.log("New NameReplace Script"); | |
var txt = window.prompt("Please enter new prefix", "DB"); | |
debug? console.log("entered:"+txt):true; | |
$(selection).each(function(theConcept) { | |
debug? console.log("Elem name:"+theConcept.name+" type:"+theConcept.type):true; | |
if (theConcept.type != "archimate-diagram-model") { | |
var nm = theConcept.name; | |
if (nm.search(":") != -1) { | |
nm = nm.split(":")[1]; | |
} | |
debug? console.log("Name to replace:"+nm):true; | |
theConcept.name = txt + ":" + nm; | |
debug? console.log("Name replaced:"+theConcept.name):true; | |
} | |
}); | |
console.log("End nameReplace Script"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment