Quantcast

Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Mickael Istria-5

Hi all,

As the deadline for EclipseCon France is approaching, and since there is some motivation about allowing people to code (parts of) IDEs in HTML & JavaScript without Java, I'm wondering what is the current state of coding Eclipse UI elements (such as views, editors, dialogs...) in HTML and JavaScript, relying on the browser widget. Does anyone here actually uses it? If so, is this easily doable with a recent Eclipse Platform?

Also, if someone happens to feel comfortable enough with this topic, I believe it would make a good submission for EclipseCon France. Something like "How to a nice and integrated Eclipse view with HTML & JS (and webgl?)" would be a catchy topic IMHO.

Cheers,
--
Mickael Istria
Eclipse developer for Red Hat Developers
My blog - My Tweets

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Leo Ufimtsev-2
Well, webkit1's Javascript evaluation() is somewhat prone to crashing the VM. But on Webkit2 javascript() evaluation works well.
BrowserFunction works in as far as calling java from javascript and passing values to it. Which can be used to tie in some handlers from buttons.

I could potentially glue something together that uses the Browser as backend for U.I. Does anyone have ideas on what to put into the U.I? What to present etc..




On Fri, Mar 24, 2017 at 5:48 PM, Mickael Istria <[hidden email]> wrote:

Hi all,

As the deadline for EclipseCon France is approaching, and since there is some motivation about allowing people to code (parts of) IDEs in HTML & JavaScript without Java, I'm wondering what is the current state of coding Eclipse UI elements (such as views, editors, dialogs...) in HTML and JavaScript, relying on the browser widget. Does anyone here actually uses it? If so, is this easily doable with a recent Eclipse Platform?

Also, if someone happens to feel comfortable enough with this topic, I believe it would make a good submission for EclipseCon France. Something like "How to a nice and integrated Eclipse view with HTML & JS (and webgl?)" would be a catchy topic IMHO.

Cheers,
--
Mickael Istria
Eclipse developer for Red Hat Developers
My blog - My Tweets

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev



--
Leo Ufimtsev
Software Engineer, Eclipse team.
Toronto, Canada

Red Hat, Inc.
[hidden email] | http://DeveloperBlog.RedHat.com/

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Mickael Istria-5
On 03/27/2017 04:31 PM, Leo Ufimtsev wrote:
Well, webkit1's Javascript evaluation() is somewhat prone to crashing the VM. But on Webkit2 javascript() evaluation works well.
BrowserFunction works in as far as calling java from javascript and passing values to it. Which can be used to tie in some handlers from buttons.

I could potentially glue something together that uses the Browser as backend for U.I. Does anyone have ideas on what to put into the U.I? What to present etc..

Actually, I think it would be worth re-trying the tuto from https://www.eclipsecon.org/2010/sessions/index5daf.html?id=1418 or similar to check whether it's still valid.
And if it is, simply freshen up memories on this topic with blog posts or presentations at EclipseCons.
--
Mickael Istria
Eclipse developer for Red Hat Developers
My blog - My Tweets

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Mickael Istria-5
On 03/27/2017 04:54 PM, Mickael Istria wrote:
On 03/27/2017 04:31 PM, Leo Ufimtsev wrote:
Well, webkit1's Javascript evaluation() is somewhat prone to crashing the VM. But on Webkit2 javascript() evaluation works well.
BrowserFunction works in as far as calling java from javascript and passing values to it. Which can be used to tie in some handlers from buttons.

I could potentially glue something together that uses the Browser as backend for U.I. Does anyone have ideas on what to put into the U.I? What to present etc..

Actually, I think it would be worth re-trying the tuto from https://www.eclipsecon.org/2010/sessions/index5daf.html?id=1418 or similar to check whether it's still valid.
Here is a better link: https://www.slideshare.net/bokowski/embedding-web-uis-in-your-eclipse-application
--
Mickael Istria
Eclipse developer for Red Hat Developers
My blog - My Tweets

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Lars Vogel-2
In reply to this post by Mickael Istria-5
As for scripting integration like JS the EASE project provides hooks
into the Eclipse IDE. Not sure if they can build full views.

Best regards, Lars

On Mon, Mar 27, 2017 at 4:54 PM, Mickael Istria <[hidden email]> wrote:

> On 03/27/2017 04:31 PM, Leo Ufimtsev wrote:
>
> Well, webkit1's Javascript evaluation() is somewhat prone to crashing the
> VM. But on Webkit2 javascript() evaluation works well.
> BrowserFunction works in as far as calling java from javascript and passing
> values to it. Which can be used to tie in some handlers from buttons.
>
> I could potentially glue something together that uses the Browser as backend
> for U.I. Does anyone have ideas on what to put into the U.I? What to present
> etc..
>
> Actually, I think it would be worth re-trying the tuto from
> https://www.eclipsecon.org/2010/sessions/index5daf.html?id=1418 or similar
> to check whether it's still valid.
> And if it is, simply freshen up memories on this topic with blog posts or
> presentations at EclipseCons.
> --
> Mickael Istria
> Eclipse developer for Red Hat Developers
> My blog - My Tweets
>
> _______________________________________________
> platform-ui-dev mailing list
> [hidden email]
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/platform-ui-dev



--
Eclipse Platform UI and e4 project co-lead
CEO vogella GmbH

Haindaalwisch 17a, 22395 Hamburg
Amtsgericht Hamburg: HRB 127058
Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel
USt-IdNr.: DE284122352
Fax (040) 5247 6322, Email: [hidden email], Web: http://www.vogella.com
_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Mickael Istria-5
In reply to this post by Mickael Istria-5
I just opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=514294 to track creation of a PDE template for a Browser view.
--
Mickael Istria
Eclipse developer for Red Hat Developers
My blog - My Tweets

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Christian Pontesegger
In reply to this post by Lars Vogel-2
For the EASE project I am planning to provide an API to build full
views. While already working on a proof of concept I identified 2
challenges so far:

a) come up with a simple, yet powerful API

b) persistence layer of e4

Currently the workbench persists everything that you create - also
dynamically created views. Problem there is that it just persists the
view, not the content within the view. This results in all kinds of
broken perspectives after a restart. There is a ticket open for that topic:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=378815

As long as this issues is not solved I do not see a clear way for EASE
to provide scripted UIs. If we can find a solution here I will volunteer
to prepare a demo for ECE 2017 :)

Christian

On 28.03.2017 10:42, Lars Vogel wrote:
> As for scripting integration like JS the EASE project provides hooks
> into the Eclipse IDE. Not sure if they can build full views.
>
> Best regards, Lars
>
>

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Mickael Istria-5
In reply to this post by Lars Vogel-2
On 03/28/2017 10:42 AM, Lars Vogel wrote:
As for scripting integration like JS the EASE project provides hooks
into the Eclipse IDE. Not sure if they can build full views.
Indeed, it would be great to show how to inject the EASE "libraries" for JS to manipulate Eclipse Platform into a Web-based view.
@Christian: is this something you already tried? Basically, the idea is to imagine you're provided a Browser widget, is it possible to add EASE JS libs in its JS context?
--
Mickael Istria
Eclipse developer for Red Hat Developers
My blog - My Tweets

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Christian Pontesegger
No, did not try that. Depends on which JS engines are used in the
browser widgets on the different platforms. However if these engines
support to access the running JRE we could imjplement EASE support quite
easily. Would be really nice to mix EASE code in an HTML rendered
browser widget. Any more information on the browser JS engines available?

Christian


On 30.03.2017 08:48, Mickael Istria wrote:
> @Christian: is this something you already tried? Basically, the idea
> is to imagine you're provided a Browser widget, is it possible to add
> EASE JS libs in its JS context?

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Mickael Istria-5
On 03/30/2017 04:46 PM, Christian Pontesegger wrote:
No, did not try that. Depends on which JS engines are used in the browser widgets on the different platforms. However if these engines support to access the running JRE we could imjplement EASE support quite easily. Would be really nice to mix EASE code in an HTML rendered browser widget. Any more information on the browser JS engines available?
Sorry, I don't know anything more about it that the slideshare link I posted earlier...

--
Mickael Istria
Eclipse developer for Red Hat Developers
My blog - My Tweets

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Christian Pontesegger
In reply to this post by Christian Pontesegger
Ok, after playing a little with the browser widget I can say that it is
possible to inject EASE into the browser. It takes some effort to allow
to load EASE modules, but it is doable. Return types from the script
engine into the Java world seem so be somewhat limited. I guess same
counts for method call parameters. It seems that only basic types can be
exchanged between JS and Java. Further the code is running in the UI
thread, which may not be nice for long running scripts. For UI callbacks
it would be sufficient I guess.

Christian

On 30.03.2017 16:46, Christian Pontesegger wrote:

> No, did not try that. Depends on which JS engines are used in the
> browser widgets on the different platforms. However if these engines
> support to access the running JRE we could imjplement EASE support
> quite easily. Would be really nice to mix EASE code in an HTML
> rendered browser widget. Any more information on the browser JS
> engines available?
>
> Christian
>
>
> On 30.03.2017 08:48, Mickael Istria wrote:
>> @Christian: is this something you already tried? Basically, the idea
>> is to imagine you're provided a Browser widget, is it possible to add
>> EASE JS libs in its JS context?
>

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Leo Ufimtsev-2
On Thu, Mar 30, 2017 at 1:58 PM, Christian Pontesegger <[hidden email]> wrote:
Ok, after playing a little with the browser widget I can say that it is possible to inject EASE into the browser. It takes some effort to allow to load EASE modules, but it is doable. Return types from the script engine into the Java world seem so be somewhat limited. I guess same counts for method call parameters. It seems that only basic types can be exchanged between JS and Java.

Yea, officially, as per evaluate(), only the following types are supported:
 * <li>javascript null or undefined -> <code>null</code></li>
 * <li>javascript number -> <code>java.lang.Double</code></li>
 * <li>javascript string -> <code>java.lang.String</code></li>
 * <li>javascript boolean -> <code>java.lang.Boolean</code></li>
 * <li>javascript array whose elements are all of supported types -> <code>java.lang.Object[]</code></li>
 
Further the code is running in the UI thread, which may not be nice for long running scripts. For UI callbacks it would be sufficient I guess

On webkit2, technically the javascript/webkit2 runs in a separate process, but SWT ui thread loops in the gtk_event_loop until webkit2 finishes the call to be compliant to the SWT api (which is sync). I.e, technically it would be possible to implement an async call / return mechanism, but that would require OS X and Win32 to implement something similar on their end also.


Christian


On 30.03.2017 16:46, Christian Pontesegger wrote:
No, did not try that. Depends on which JS engines are used in the browser widgets on the different platforms. However if these engines support to access the running JRE we could imjplement EASE support quite easily. Would be really nice to mix EASE code in an HTML rendered browser widget. Any more information on the browser JS engines available?

Christian


On 30.03.2017 08:48, Mickael Istria wrote:
@Christian: is this something you already tried? Basically, the idea is to imagine you're provided a Browser widget, is it possible to add EASE JS libs in its JS context?


_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev



--
Leo Ufimtsev
Software Engineer, Eclipse team.
Toronto, Canada

Red Hat, Inc.
[hidden email] | http://DeveloperBlog.RedHat.com/

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Christian Pontesegger



On 31.03.2017 19:10, Leo Ufimtsev wrote:

Yea, officially, as per evaluate(), only the following types are supported:
 * <li>javascript null or undefined -> <code>null</code></li>
 * <li>javascript number -> <code>java.lang.Double</code></li>
 * <li>javascript string -> <code>java.lang.String</code></li>
 * <li>javascript boolean -> <code>java.lang.Boolean</code></li>
 * <li>javascript array whose elements are all of supported types -> <code>java.lang.Object[]</code></li>
Yes, I did read about that in the slideset mentioned by Mickael. Does this also hold true within a script block?
I did see that I could call
  new java.lang.String("")
in the Interpreter. I guess if that works I could instantiate anything the classloader has access to, right? Then could I bind a java Object to a variable and access the java object in the next line?

eg
var file = new java.io.File("...")
file.exists()

If that would be possible the limits of passing basic Datatypes would only apply for results returned by a script, not for script internal processes.
 
Further the code is running in the UI thread, which may not be nice for long running scripts. For UI callbacks it would be sufficient I guess

On webkit2, technically the javascript/webkit2 runs in a separate process, but SWT ui thread loops in the gtk_event_loop until webkit2 finishes the call to be compliant to the SWT api (which is sync). I.e, technically it would be possible to implement an async call / return mechanism, but that would require OS X and Win32 to implement something similar on their end also.
Would be something to think about in case this scenario gets interesting for a larger community. Lets see how many interested people step up here in this thread.

Christian

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Coding an Eclipse plugin with HTML, JS (and Eclipse Browser)

Leo Ufimtsev-2
Bug 510905

On Fri, Mar 31, 2017 at 2:49 PM, Christian Pontesegger <[hidden email]> wrote:



On 31.03.2017 19:10, Leo Ufimtsev wrote:

Yea, officially, as per evaluate(), only the following types are supported:
 * <li>javascript null or undefined -> <code>null</code></li>
 * <li>javascript number -> <code>java.lang.Double</code></li>
 * <li>javascript string -> <code>java.lang.String</code></li>
 * <li>javascript boolean -> <code>java.lang.Boolean</code></li>
 * <li>javascript array whose elements are all of supported types -> <code>java.lang.Object[]</code></li>
Yes, I did read about that in the slideset mentioned by Mickael. Does this also hold true within a script block?
I did see that I could call
  new java.lang.String("")
in the Interpreter. I guess if that works I could instantiate anything the classloader has access to, right? Then could I bind a java Object to a variable and access the java object in the next line?

Well, in general what happens is that we take the javascript string that we get in Browser and execute it in Webkit. Then Webkit executes it in Native C code inside it's javaScriptCore engine, and when it's ready it does a callback back to java. Java then tries to read the return value. If it recognizes one of the primitive types, it converts them into java Objects (not primitives). If we get some non-recognized object, an exception is thrown. Technically it would be possible to implement other return types, but this would require Win32/Cocoa cooperation.

Browser function goes the other way. It allows you to register a function into javascript, so that when javascript calls that function a callback is made back to java. This way some javascript event can invoke Java.
Note: At time of writing, on webkit2, the browser function works, but at the end of the call, java does not return a value back to javascript because webkit2 api is async.   See: Bug 510905
But this is not used as much in practice. (from the 956 repos on git.eclipse, only nebular/rich text editor uses it).


eg
var file = new java.io.File("...")
file.exists()

If that would be possible the limits of passing basic Datatypes would only apply for results returned by a script, not for script internal processes.
 
Further the code is running in the UI thread, which may not be nice for long running scripts. For UI callbacks it would be sufficient I guess

On webkit2, technically the javascript/webkit2 runs in a separate process, but SWT ui thread loops in the gtk_event_loop until webkit2 finishes the call to be compliant to the SWT api (which is sync). I.e, technically it would be possible to implement an async call / return mechanism, but that would require OS X and Win32 to implement something similar on their end also.
Would be something to think about in case this scenario gets interesting for a larger community. Lets see how many interested people step up here in this thread.
 

Christian

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev



--
Leo Ufimtsev
Software Engineer, Eclipse team.
Toronto, Canada

Red Hat, Inc.
[hidden email] | http://DeveloperBlog.RedHat.com/

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Loading...