Eclipse icon

In the OLE and ActiveX Interoperability lecture you learned how to embed ActiveX controls in the Eclipse Platform. Learning how to work with the SWT OLE API is an important part of this example but this example also re-enforces what you’ve learned so far about the contribution, resource, and editor frameworks. The goals of this example are to illustrate the principals of building an Eclipse-aware user interface while leveraging the investment in legacy code. 

Running the Solution

  1. From the Plug-in Development perspective, launch the run-time instance of Eclipse (Run > Run As > Run-time Workbench).
  2. Create a new project, and add an *.htm file. The new file will open using this plug-in's editor.
  3. Create some text in the WYSIWYG (IE) editor page and then use the Bold, Underline, and Italic buttons on the Workbench toolbar or use the actions available on the menu bar.
  4. Switch to the default text editor page and look at the raw HTML. 

The following figure shows the running example with the Internet Explorer ActiveX control and JFace Text working together inside a Multi-page editor. The ActiveX control is running inside the tab labeled, Soln: IE HTML Editor and the JFace Text editor is running inside the index.htm tab of the editor.

ActiveX Browser and JFace Text Editor in
OLE HTML Editor

The plug-in also writes information messages into the host console.

Roadmap of the Solution

The editor provides you with a multi-page editor containing two pages. The editor page implements a text editor used to edit the *.htm source file. The other page implements a WYSIWYG HTML editor page based on the IE Web Browser ActiveX control. The fun part of the example adds in menu and toolbar action contributions which allows the user to set the font to bold, italic, and underline.

Plugin Utilities

Class (All) Description
ActiveXEditorImages Convenience class for storing references to image descriptors used by the OLE editor.
InteropeditPlugin The main plug-in class.

Editors

Using the IE Web Browser control, we integrate that web browser's editing capability into an Eclipse multi-page editor using editor input from Eclipse resources and connect custom actions to the Workbench toolbar and menus.

Class (All) Description
ActiveXBrowserView This class hosts the IE ActiveX control (Shdocvw.dll).
ActiveXHTMLEditor This class manages the life cycle of two editor pages inside this multi-page editor. The class keeps the editor contents synchronized and handles Save and Save As actions.
ActiveXMultiPageEditorContributor Manages the installation/deinstallation of global actions for multi-page editors. Responsible for the redirection of global actions to the active editor. A multi-page contributor replaces the contributors for the individual editors in the multi-page editor.
ActiveXWebBrowser This class wrappers, or is a proxy to, an aggragate of OLE automation objects contained in the Microsoft Web Browser control and the Dynamic HTML (DHTML) Object Model (DOM) in the MSHTML control. Shell.Explorer (OleControSite).

 The IDL files; shdocvw.idl for the browser control and mshtml.idl for the HTML control, are included here for reference.