Bringing Chromium to Eclipse RCP

One of the most common questions I’m asked by my clients is whether it’s possible to utilize web-based UI frameworks (Angular, React, Vue, etc.) in an Eclipse RCP application. Until now, my answer has been no, largely because of the limitations of the SWT Browser control.

Well I’m happy to say that things are starting to change in this area, though there is still much work to do.

New SWT support for Microsoft Edge Chromium

In 2018 Microsoft made the surprising decision to base its future Edge browser on Chromium. Support for Edge Chromium is now available in one of two forms – the Edge browser itself and the new WebView2 control.

The WebView2 control is of particular interest because it allows for the embedding of web-based UI elements into native applications. And I’m happy to say that as of the 2021-03 Eclipse release, we can now embed this control in Eclipse RCP applications. While of course limited to the Win32 platform, this support for Chromium in Eclipse RCP makes it possible to fully leverage your web-based UI framework of choice.

To try this out, you’ll need to do two things:

  1. Install the WebView2 runtime (the Edge browser is not required). There are a variety of options for installing the runtime, and I think this situation will continue to evolve. Long-term, Microsoft is going to rely heavily on this control in their application suite and is now deploying the control along with it.
  2. In your SWT Browser control, pass the SWT.EDGE flag in the constructor. Alternatively, you can pass this argument on the command line: -Dorg.eclipse.swt.browser.DefaultType=edge

Here’s a simple Eclipse RCP application using the Edge Chromium browser.

The work left to do

Support for the WebView2 control in SWT is still experimental, and there’s a short but growing list of bugs/enhancement requests. Also, here is a list of the known limitations of the SWT control. Some of these limitations need to be addressed by Microsoft (in particular support for getting/setting cookies) and they are making good progress.

Of course the biggest issue is that this is not a cross-platform solution. So what about MacOS and Linux?

Cross-platform Chromium

There was an attempt made over the past few years to create cross-platform Chromium support in SWT. This support was based on using Rust to wrap the Chromium framework with platform specific controls that would be accessible to SWT.

Unfortunately, this effort has recently been abandoned. My take is that the problem was ultimately a lack of developer support. Without strong developer interest and engagement, the effort was not going to succeed. The Eclipse Platform PMC is still open to the idea of a cross-platform Chromium control, perhaps in the form of a Nebula contribution. So if you’re interested in picking up this work and running with it, let them know.

Another possible solution is that Microsoft releases WebView2 controls for MacOS and Linux . Then the SWT support for this control could be made available for all Eclipse RCP deployment platforms.

Wrapping up

This is definitely early days for Chromium support in Eclipse RCP applications, but I see a clear path forward. My hope is that in the near future Eclipse RCP developers will have access to robust cross-platform Chromium support.

And once that happens, the opportunities for utilizing Eclipse RCP become very interesting. Eclipse RCP applications would be well-suited to host modular microservices in the UI (sometimes called Micro Frontends). And if these microservices were written using web-frameworks running on Chromium, they could easily be migrated to or co-hosted by other Chromium-based frameworks such as Electron.

But that’s a story for another day 🙂