Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: jguerra on November 08, 2008, 01:47:35 am
-
Hi,
In a shape script, I want to modify part of the text on an element only when the element is instantiated. I went through the property list and I didn't see anyone indicating something such as "isinstance"or similar. Is there any way to find that out?
Thanks
-
Could you check for a non-null value of the "classifier" property?
if(hasproperty("classifier",""))
{
print("no classifier");
}
else
{
print("classifier=#classifier#");
}
-
Awesome !!
Thanks for the clues!. I updated the code snipped and this is what it looks like the now.
...
if(hasproperty("classifier",""))
{
printwrapped("#name#");
} else
{
printwrapped("#name#:#classifier.name#");
}
...
So, based on the criteria of whether or not we are dealing with an instance, the script prints out the name of the element (no instance, classifier == "") or the pattern <instance_name>:<classifier_name>. The Shape script was tested out on 7.1 b833 with no probs and the code snipped above works nicely and it does what it's meant to do!!
Thanks