Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-help-dev] Embedding Mozilla


Nick,
       
        I have  been working on embedded Web Browser support for Eclipse that might be useful for you.  I have a collection of SWT widgets that embed Web Browser controls and provide two categories of APIs: Navigation, and DOM access.   The navigation APIs simply expose high level Web Browser function such as url navigation, forward, back, and status.   The DOM API uses the Java interface bindings for W3C DOM level 3.  The W3C DOM API is implemented via direct calls to the  native DOM interfaces of the embedded Web browser controls.

I have three versions of this SWT widget:
1. Windows - using Internet Explorer
2. Windows - using Mozilla
3. Linux/GTK - using Mozilla (This runs on a backlevel GTK.  I'm waiting for Mozilla embed support for GTK2 in order to run on the new Eclipse GTK 2 builds)

In the case of Internet Explorer the internal implementation has a direct Java API mapping of all the COM interfaces for accessing the browser DOM.  This extends the existing SWT support for COM/VTable binding to native components on Windows found in org.eclipse.swt.ole.win32.   These native COM interfaces are surfaced as Java classes and are used to implement the W3C DOM Interface. (I've also surfaced the Internet Explorer edit mode interfaces so this widget  also doubles as a light weight WYSIWYG HTML layout editor. Mozilla also provides an editor which I also plan on surfacing to Java)

As for Mozilla, I have an XPCOM package that is modeled after the COM interface handling in  org.eclipse.swt.ole.win32 for XPCOM bindings.  This works similar to the Internet Explorer version but surfaces all the XPCOM related interfaces for Mozilla access.   All the Java code for the  Mozilla-based widget is the same for both Windows and Linux.  The only difference is the SWT JNI library which includes a compile switch for Windows or Linux.  

In both cases developers can access the Web Browser specific APIs for DOM manipulation if Web Browser specific function is required.  However, the W3C DOM interface provided for both Web Browser controls  is sufficient for most DOM related function and provides portability across Eclipse plugins for Windows and Linux.

These controls can be used for simple Web Browser embedding and for Web Browser DOM programming in Eclipse.   Since these controls are SWT widgets they can easily integrate into existing projects.  The original goal of this project was to provide developers with a simple path for migrating Web-based tools and interfaces  to Eclipse.  Eclipse plug-in developers can simply instantiate these SWT widgets and call a getDocument() method  which returns an object of type org.w3c.dom.html.HTMLDocument.   The DOM interface allows developers to dynamically modify Web pages and create event handlers for processing HTML element events.  For example, an event handler can process button click events within a Web page or dynamically augment external Web pages with Eclipse specific handlers.

I would like to contribute these controls to Eclipse.  Please let me know if this is what you are looking for.

John Ponzo
IBM Research
jponzo@xxxxxxxxxx

Back to the top