This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I have a swing application that is extensible through the scripting framework provided by javax.script.*. It is really just an engine that can be scripted. Users will run my application and choose a script to run or specify a script on the command line. I use the built-in features of Java scripting to expose a few key objects to the script and start it up. I want to edit the scripts in Netbeans since it is aware of the JavaScript syntax and obviously my main engine is also being edited and debugged in NetBeans. However the NetBeans support for JavaScript is assuming that the browser is running my script, not the java scripting engine from the JRE. As such, it complains about functions not being supported on certain browsers, when really all I’m doing is calling things like getName() on a java.io.File object. There is no way to tell the JavaScript component of NetBeans what objects I’m exporting to the scripting engine (and as what symbols) so that it can auto-complete while typing or verify that methods exist. e.g. my Java code will do: void setScript(File script) { this.script = script; javax.script.ScriptEngineManager sem = new ScriptEngineManager(); String name = script.getName(); String ext = name.substring(name.lastIndexOf('.')+1); engine = sem.getEngineByExtension(ext); if (engine == null) { throw new RuntimeException("No engine will handle " + ext + " files."); } } Object initScript() throws ScriptException, FileNotFoundException, NoSuchMethodException { engine.put("engine", this); engine.put("emailer", new Emailer()); return engine.eval(new FileReader(script)); } Users of my application can then add functionality by scripting various methods that I expose. A script would typically look like: result = engine.doSomethingCool(blah1, blah2, blah3); emailer.sendEmail("someDude@someCompany.com", "Processed "+blah1, result); You can see that "engine" and "emailer" refer to Java objects that I have exposed to the script. I think there is an opportunity here for NetBeans to better support javax.script.* regardless of the scripting language used.
I think this is an enhancement.