What's New in Eclipse 4.16

Here are descriptions of some of the changes of interest to plug-in developers made to the Eclipse Platform and SWT for the 4.16 release of Eclipse.

New features oriented towards end-users of the platform can be viewed in the What's New section of the Workbench User Guide.

Platform Changes

BrowserViewer uses URISchemeHandler extensions The BrowserViewer now uses the extensions to org.eclipse.urischeme.uriSchemeHandlers. When clicking a hyperlink with a non-default supported web browser URI scheme, the extensions are checked and if one can handle the URI scheme, it will be triggered.

One example is Marketplace Client providing support for eclipse+mpc://... URIs. Using the BrowserViewer and clicking an eclipse+mpc://... link target will open the Marketplace Client wizard.

Handle eclipse+command:// URLs eclipse+command:// Link handler makes the Eclipse application start a command.

Such URLs have the form eclipse+command://commandId?param1Id=value&param2Id=value.
For example, to open a preference page: eclipse+command://org.eclipse.ui.window.preferences?preferencePageId=org.eclipse.ui.browser.preferencePage

This link handler must be activated from the Link handlers preference page to bind the Eclipse application with this URL scheme in the OS.

org.eclipse.e4.core.di.extensions APIs made public The dependency injection annotation APIs in org.eclipse.e4.core.di.extensions such as @EventTopic have been made an official API.

These APIs have already been commonly used by dependency injection in E4 RCP applications, but have only been marked as provisional APIs thus far. The provisional flag has now been removed.

Saferunner can return results SafeRunner now supports runnables that return a result.
T run(ISafeRunnableWithResult<T> code);

Example:

int result = SafeRunner.run(new ISafeRunnableWithResult <Integer >() {
     @Override
     public Integer runWithResult() throws Exception {
          return 42;
     }
     })

Using lambda:

int result = SafeRunner.run(() -> 42);
Active tab highlight CSS option The active tab can now be highlighted by using the swt-selected-tab-highlight CSS property. By default, the highlight is placed at the top of the tab, but it can be changed by using the boolean CSS property swt-selected-highlight-top.

Here's how it looks when enabled with the dark theme:

Example usage in CSS:
     # Set the selected tab highlight color 
     swt-selected-tab-highlight: white;
     # Set whether the highlight should be on top or bottom of the tab (default is true)
     swt-selected-highlight-top: false;
    
Added support for square CTabs Square tabs can be enabled in CSS by specifying an swt-corner-radius of 0.

SWT Changes

Support for Ligatures on Windows Ligatures are now supported by the StyledText widget on Windows. It was already supported on Linux and macOS.

Screenshot of ligatures drawn in StyledText and Text widgets on Windows 10:

Support for ligatures on Windows

Colors don't need to be disposed Starting from Eclipse 4.16, SWT no longer requires Colors to be disposed as they are not allocated any OS resources.
Minimum GTK version update Starting from Eclipse 4.16, SWT/GTK no longer supports versions of GTK older than 3.20.
Dark theme tweaks Windows Various tweaks were implemented to improve dark theme experience on Windows, where OS supported dark theme is not quite there yet:
  • Dark scrollbars (only on Win10)
  • Custom colors for Menu bar:

    For Example: dark menu can be enabled via setting below key/value pairs on the Display instance as shown below: display.setData("org.eclipse.swt.internal.win32.menuBarForegroundColor", new Color(display, 0xD0, 0xD0, 0xD0));
    display.setData("org.eclipse.swt.internal.win32.menuBarBackgroundColor", new Color(display, 0x30, 0x30, 0x30));
    display.setData("org.eclipse.swt.internal.win32.menuBarBorderColor", new Color(display, 0x50, 0x50, 0x50));

  • Custom color for Table header lines:

    For Example: table header line color for dark theme can be enabled via setting below key/value pair on the Display instance as shown below: display.setData("org.eclipse.swt.internal.win32.Table.headerLineColor", new Color(display, 0x50, 0x50, 0x50));

  • Dark theme compatible Control borders:

    For Example: dark border for below supported controls can be enabled via setting below key/value pair on the Display instance as shown below: display.setData("org.eclipse.swt.internal.win32.Canvas.use_WS_BORDER", true);
    display.setData("org.eclipse.swt.internal.win32.List.use_WS_BORDER", true);
    display.setData("org.eclipse.swt.internal.win32.Table.use_WS_BORDER", true);
    display.setData("org.eclipse.swt.internal.win32.Text.use_WS_BORDER", true);
    display.setData("org.eclipse.swt.internal.win32.Tree.use_WS_BORDER", true);

    Here's how dark Menu, Table header and Text border looks like in Eclipse:
    Support for dark menu, table header and text border on Windows
  • Custom color for disabled Label foreground color:

    For Example: disabled Label foreground color for dark theme can be enabled via setting below key/value pair on the display instance as shown below: display.setData("org.eclipse.swt.internal.win32.Label.disabledForegroundColor", new Color(display, 0x80, 0x80, 0x80));

    Here's how dark disabled Label looks like in Eclipse:
    Support for dark disabled label on Windows

On Windows 10 all the dark theme tweaks including the dark scrollbars can be disabled using the org.eclipse.swt.internal.win32.disableCustomThemeTweaks Java property.
For Example: add this VM argument in eclipse.ini or on the command line after -vmargs:

-Dorg.eclipse.swt.internal.win32.disableCustomThemeTweaks=true
Note: Once this Java property is set, all above display.setData() calls won't come into effect.
Support for dark scrollbars on Windows SWT now supports having dark scrollbars on Windows.

Dark scrollbars can be enabled via Display.setData() with the following key/value pair: display.setData("org.eclipse.swt.internal.win32.useDarkModeExplorerTheme", true);

Screenshot of dark-themed scrollbars on Windows 10:

Support for dark scrollbars on Windows

On Windows 10, all the dark theme tweaks including the dark scrollbars can be disabled using the org.eclipse.swt.internal.win32.disableCustomThemeTweaks Java property.
For Example: add this VM argument in eclipse.ini or on the command line after -vmargs:

-Dorg.eclipse.swt.internal.win32.disableCustomThemeTweaks=true
Note: Once this Java property is set, the above display.setData() call won't come into effect.
S-Leak SWT Tool has save options Add a save to file option for S-Leak. Two new buttons are added, save and save as.

When saving, there are some options to control saving:

  • save to incrementing file numbers to make it easier to capture multiple files without prompts
  • save the preview to png files cross referenced to the main text file
  • include stack traces if "Stack" is checked