NetBeans ScriptEngine - update

I've just updated the my NetBeans Script module (see blog). Here is a list of the new features
  1. The script related menu items have its own menu call 'Scripts' in the main toolbar
  2. A script environment view which lets you look at what are the script modules and script engines that are installed
  3. A simple file system view of the script repository directory. Can you do most things like create and delete scripts and directory. However you cannot drag and drop files/directorys. Did not want to turn this into a full fledge file management thingy. The update view is not very optimized. Every time you add or delete a file, the entire view is reloaded.
  4. I've added a simple script console. For every script engine, you can now open a script console in NetBeans. Furthermore every console opened will have an object call Console that allows you to manipulate the console. JavaScript console will be the best support. The JS console is initialized with init.js from Mustang as well as a few additional functions. You can add console initialization scripts (aka .profile) in console directory. The name of this initialization script has to called globals.<script suffix>.
  5. I've added documentation to on the new features, programming objects, etc. It's probably not enough but will have to do for the time being. Go to Help -> Help Contents -> ScriptEngine entry
Here is a screenshot of the new features

Click to enlarge
You can get the latest NBM here and here. I've also change the license from CDDL to BSD.  If you are going to try the script module, here are the requirements
  1. NetBeans must be running on Mustang viz. use the --jdkhome when you  start NB
  2. I've tested the module on b82 onwards
  3. You must update NetBeans to use the beta version of Matisse.

Comments:

Really nice, I like the idea of the integrated console, but having difficulty with getting this to work with jython (my favorite). I can look into it myself, but I cannot find the link to your actual sources. How about getting it uploaded to dev.java.net ;-)

Posted by Sven Reimers on July 18, 2006 at 07:15 AM SGT #

Sven, you must use a scripting language that is JSR-223 compliant. Jython has a JSR-223 compliant engine in http://scripting.dev.java.net. Add that into the ScriptEngine and you should be able to get your console. BTW, the module is also on the scripting site mentioned above. Thanks for trying out the module.

Posted by Lee Chuk Munn on July 19, 2006 at 12:44 AM SGT #

Yeah I know, I got the ScriptEngine but get a failure that the init of the interpreter was not called: jy> print hallo Traceback (innermost last): (no code object) at line 0 java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:506) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java) at org.python.core.Py.compile_flags(Py.java) at org.python.core.Py.compile_flags(Py.java) at org.python.core.Py.compile_flags(Py.java) at org.python.core.__builtin__.compile(__builtin__.java) at com.sun.script.jython.JythonScriptEngine.compileScript(JythonScriptEngine.java:278) at com.sun.script.jython.JythonScriptEngine.eval(JythonScriptEngine.java:169) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:245) at org.chuk.lee.scriptengine.console.CommandProcessorBase.executeCommand(CommandProcessorBase.java:85) at org.chuk.lee.scriptengine.console.ScriptShellPanel.executeCommand(ScriptShellPanel.java:267) at org.chuk.lee.scriptengine.console.ScriptShellPanel.access$600(ScriptShellPanel.java:81) at org.chuk.lee.scriptengine.console.ScriptShellPanel$1.insertUpdate(ScriptShellPanel.java:140) at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:185) at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:734) at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:693) at javax.swing.text.PlainDocument.insertString(PlainDocument.java:114) at org.chuk.lee.scriptengine.console.EditableAtEndDocument.insertString(EditableAtEndDocument.java:80) at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:655) at javax.swing.text.JTextComponent.replaceSelection(JTextComponent.java:1351) at javax.swing.text.DefaultEditorKit$InsertBreakAction.actionPerformed(DefaultEditorKit.java:952) at javax.swing.plaf.basic.BasicTextUI$TextActionWrapper.actionPerformed(BasicTextUI.java:2023) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1634) at javax.swing.JComponent.processKeyBinding(JComponent.java:2824) at javax.swing.JComponent.processKeyBindings(JComponent.java:2859) at javax.swing.JComponent.processKeyEvent(JComponent.java:2787) at java.awt.Component.processEvent(Component.java:5776) at java.awt.Container.processEvent(Container.java:1984) at java.awt.Component.dispatchEventImpl(Component.java:4407) at java.awt.Container.dispatchEventImpl(Container.java:2042) at java.awt.Component.dispatchEvent(Component.java:4237) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1828) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:693) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:952) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:824) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:657) at java.awt.Component.dispatchEventImpl(Component.java:4279) at java.awt.Container.dispatchEventImpl(Container.java:2042) at java.awt.Window.dispatchEventImpl(Window.java:2411) at java.awt.Component.dispatchEvent(Component.java:4237) at java.awt.EventQueue.dispatchEvent(EventQueue.java:600) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) Caused by: java.lang.IllegalStateException: Jython interpreter state not initialized. You need to call PySystemState.initialize or PythonInterpreter.initialize. at org.python.core.InternalTables.createInternalTables(InternalTables.java) at org.python.core.PyJavaClass.lookup(PyJavaClass.java) at org.python.core.PyObject.<init>(PyObject.java) at org.python.core.PySequence.<init>(PySequence.java) at org.python.core.PyString.<init>(PyString.java) at org.python.core.Py.newString(Py.java) at org.python.pycode._pyx0.<clinit>(<unknown>) ... 52 more java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError Jython is a bit trickier to deal with (I wrote a console for NetBeans at the company I work for) so I may get it right if I can get the sources from you ... P.S. Still looking for actual sources ;-)

Posted by Sven Reimers on July 19, 2006 at 08:48 AM SGT #

Sven, The source are at https://scripting.dev.java.net/source/browse/scripting/applications Can you try the jython engine with jrunscript to see if it works first. My console is basically a relica (aka copy) of that. Let me know if you manage to fix it. Thanks for trying again.

Posted by Lee Chuk Munn on July 20, 2006 at 04:59 AM SGT #

Have you asked if the folks at netbeans.org or nbextras.org would post your plug-in / module ? I think it would be a nice addition :-)

Posted by charlie hunt on July 23, 2006 at 01:31 PM SGT #

Post a Comment:
Comments are closed for this entry.
About

Random thought at random intervals

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today