|
From: | Bertalan Fodor |
Subject: | Re: which language for programming |
Date: | Wed, 22 Nov 2006 16:31:10 +0100 |
User-agent: | Thunderbird 1.5.0.8 (Windows/20061025) |
Java is a very powerful and versatile system (it's not just a language), and one of the current standards of enterprise application programming.
Now, here is an example of a macro written in Java/BeanShell used in LilyPondTool - it will set the score size. This will work only in jEdit with installed LilyPondTool, because it uses LilyPondTool's and jEdit's features. But you can see, that it's not too complicated.
firstAsset = lilytool.macrohelp.MacroUtils.getFirstAsset(view).start.getOffset()); // LilyPondTool finds the position of the first element in our LilyPond source file start=textArea.getLineStartOffset(textArea.getLineOfOffset(firstAsset); // we find the position of the first character of the first element
textArea.setCaretPosition(start); // set the current caret position at startsize=Macros.input(view, "Global staff size:", "20"); // get the required staff size from the user
if (size!=null) { // if something has inputtedtext="#(set-global-staff-size "+size+")"; // this will be the text we write textArea.setSelectedText(text+"\n\n"); // we write the text into the text area textArea.setCaretPosition(start+text.length()); // set the caret position after the newly inserted text textArea.setSelection(new Selection.Range(start, start+text.length())); // select the text we inserted
}
[Prev in Thread] | Current Thread | [Next in Thread] |