This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 266772 - JavaScript support for XWT
Summary: JavaScript support for XWT
Status: RESOLVED FIXED
Alias: None
Product: XWT
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-02 19:22 EST by Yves YANG CLA
Modified: 2018-09-25 12:09 EDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yves YANG CLA 2009-03-02 19:22:50 EST
I think the JavaScript support could be:
   1. online JavaScript codes in XWT
   2. Associate/invoke an event to a JavaScript function
Comment 1 Angelo ZERR CLA 2009-03-04 06:04:32 EST
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} />
Comment 2 Frank Gerhardt CLA 2009-10-21 08:21:28 EDT
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>
Comment 3 Yves YANG CLA 2009-11-02 05:46:46 EST
More detail design is here:
http://wiki.eclipse.org/JFace_Data_Binding/Rhino
Comment 4 Yves YANG CLA 2009-11-02 05:59:25 EST
> 
> 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.
Comment 5 Paul Webster CLA 2009-11-03 10:54:22 EST
(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
Comment 6 Lars Vogel CLA 2018-09-25 12:09:59 EDT
AFAIK org.eclipse.e4.languages has never been finished. Please reopen if you know more them I do.