The Script Plug-in is the easiest way to add customized features to Astah for your specific needs using API.
Astah moved its Java Runtime from Java7 to Java8 since version 7.0 and due to its update, the script you were using in Astah 6.9 or earlier will no longer function in version 7.0 or later. You need a small tweak to make it run.
How to update your existing Script
1. importPackage
Use one of the following notations ;
Before
importPackage(com.change_vision.jude.api.inf.editor);
//use the classes in the package
(A) Use JavaImporter
with(new JavaImporter(com.change_vision.jude.api.inf.editor)) {
//use the classes in the package
}
(B) Load “nashorn:mozilla_compat.js”
load("nashorn:mozilla_compat.js");
importPackage(com.change_vision.jude.api.inf.editor);
//use the classes in the package
(C) Use Java.type
var TransactionManager = Java.type("com.change_vision.jude.api.inf.editor.TransactionManager");
//use the class
2. println
Before
println("Astah");
(A) Use print instead of println
print("Astah");
(B) Add println=print;
println=print;
println("Astah");
3. .class
Before
var classes = astah.findElements(IClass);
Add .class
var classes = astah.findElements(IClass.class);
Reference
Please refer to the following website for more details.
https://wiki.openjdk.java.net/display/Nashorn/Rhino+Migration+Guide
Cheers,
SJ
