You can use any text editor to develop a scripting language. However, a standard text editor lacks of code assistant features. Most scripting languages are loose type. For example, to define a variable in JavaScript, you need to type:
var a; |
It is difficult to determine what type of "a" later in the source code. With BeanShell, you can use a variable without declaring it, for example:
a = new File("file.txt"); |
Or you can declare it first:
File a = new File("file.txt"); |
Java IDE does not officially support code completion for scripting languages. However, there is a workaround if you use BeanShell. First you need a Java IDE. If you do not have one, you can select NetBeans because it has the smallest file size. You can download the latest version of NetBeans at http://www.netbeans.org/downloads/index.html. The NetBeans Java SE package is enough. Second you need to set up a MagicDraw classpath.
To set up a classpath point in the MagicDraw library in NetBeans
To develop a BeanShell script in NetBeans
You need to create a public static method in a Java file, for example, main() method, to follow the standard Java programming language. At the end of the file, insert a statement to call the static method. See the example in create_project_elements.bsh in the <MagicDraw>/samples/product features/macros directory.
The official filename extension for BeanShell is .bsh. However, you can add a .java file to the BeanShell scripting language. |