Community
Participate
Working Groups
I think the JavaScript support could be: 1. online JavaScript codes in XWT 2. Associate/invoke an event to a JavaScript function
Today XWT manage EMF and POJO binding capability. It should be cool to manage binding with scriptable object (Javascript or another scripting engine) like this : <script> function Person(name) { this.name = name; } var p = new Person(); p.name = 'XXX'; </script> <Text value={Binding source=p path=name} />
Is it possible to use JS event handlers (e.g. button)? <Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt" x:Class="ui.EventHandler"> <Shell.layout> <GridLayout/> </Shell.layout> <Button text="Click Me!" SelectionEvent="clickButton"> </Button> </Shell> It seems to require a Java class. How about supporting a factory like for using the extension registry, see http://wiki.eclipse.org/E4/JavaScript <extension point="org.eclipse.equinox.http.registry.servlets"> <servlet alias="/jsHello" class="org.eclipse.e4.languages.javascript.registry.JavaScriptFactory:some.func"> </servlet> </extension>
More detail design is here: http://wiki.eclipse.org/JFace_Data_Binding/Rhino
> > It seems to require a Java class. How about supporting a factory like for using > the extension registry, see http://wiki.eclipse.org/E4/JavaScript > > <extension > point="org.eclipse.equinox.http.registry.servlets"> > <servlet > alias="/jsHello" > > class="org.eclipse.e4.languages.javascript.registry.JavaScriptFactory:some.func"> > </servlet> > </extension> There is a limitation with EP, it can be used only with workbench. I think it is important to provide a solution more generic. There are two possibilities to put the JavaScript codes: - inline - external 1. Inline In case of inline, as proposed Angelo, we can create a new namespace "http://www.eclipse.org/rhino" to store JavaScript stuffs. 2. External We can also use Silverlight 1 solution: keep the JavaScript in a separate file with the namespace as XML file, but with extension js. For example, we have view Person.xwt, the JavaScript will be in the file Person.js. In this case, the extension "x:Class" should be removed in resource XWT for JavaScript. To support JavaScript model, we need a delegate IDataProvider.
(In reply to comment #4) > There is a limitation with EP, it can be used only with workbench. I think it > is important to provide a solution more generic. > There's nothing wrong with an easy to understand pattern that can load a resource in eclipse or outside. But one important part of Extension Points is to allowed an engine/library to load client code. In JavaScript I assume that's not as important (it's not a class, just a resource that needs to be loaded) but to load Java files you must go through extension points (so we don't fuss with classloaders). PW
AFAIK org.eclipse.e4.languages has never been finished. Please reopen if you know more them I do.