[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-incubator-e4-dev] SWT port to Flex

Patrick Mueller wrote on 09/19/2008 05:48:16 PM:
> I think my main problem boils down to: I want more API on SWT
> Browser so I can talk from inside the browser to outside (Java), and
> probably finer control over talking to the inside (browser) from the
> outside (Java) than the current "run this hunk of _javascript_ code"
> method.  For example, it would be nice to have direct access to the
> DOM from Java.


I believe this is already possible, by using Mozilla's XPCOM interface to the SWT.MOZILLA variant of the SWT Browser widget.  It's just not very well documented.  For a taste of what's possible, here is a snippet that talks to some of the XPCOM interfaces:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet277.java?view=co

For the EclipseCon e4 demo, I had a bunch of _javascript_ implementing a simple "Problems View" using DHTML and XHR.  Identical copies of this code ran in a real browser, talking to a remote Eclipse REST service, or inside of a SWT Browser in Eclipse, talking to the in-process Resources model.  The basic idea was to provide a custom implementation of XMLHTTPRequest in the Eclipse case that talked to Java by passing Strings back and forth.

The problem with this approach, I believe, is the footprint you get from creating many instances of SWT Browser, but I might be wrong on that. Maybe someone from the SWT team can correct me if I am wrong.

Bottom line: What you want may already be possible with SWT, today.

May I ask where you are going with this?

Boris