Eclipse Project Neon (4.6) M6 - New and Noteworthy

Here are some of the more noteworthy things available in the Neon milestone build M6 which is now available for download.
We also recommend to read the Tips and Tricks, either via Help > Tips and Tricks... or online for Platform, JDT, and PDE.

Platform
SWT provides resolution-based auto-scaling SWT now automatically scales images on high-DPI monitors on Windows and Linux, similar to the Mac's Retina support on OS X. In the absence of high-resolution images, SWT will auto-scale the available images to ensure that SWT-based applications like Eclipse are scaled proportionately to the resolution of the monitor.

Screenshot with tiny icons 'Before' and a normal appearance 'After'

This feature can be disabled on Windows and GTK by setting this VM argument to false in eclipse.ini or on the command line after -vmargs:

-Dswt.enable.autoScale=false

Auto-scaling cannot be disabled on the Mac as it is provided by the OS.

Caveats: We're aware that some scaled images look bad at scale factors less than 200%. This will be improved in M7. Furthermore, we're working on support for high-DPI images in Platform UI, so that plug-in providers can add high-DPI icons without doing any code changes.

New Welcome theme 'Solstice' The Welcome/Intro introduces a new Solstice theme providing a new modern appearance. The Welcome also introduces a new quadrant-based root page, qroot, which supports a new command-driven section defined through the org.eclipse.ui.intro.quicklinks extension point. These quicklinks are intended to be populated by product owners.

Welcome Launchbar restored In Eclipse 3.x, the Go to Workbench button on the Welcome page would minimize the Welcome page to the window status bar. This behavior has been restored for Eclipse 4.6.

'word_selection' and 'line_selection' template variable with default values The 'word_selection' and 'line_selection' variables, supported in editor and code templates, now allow you to specify a default value to use if the current text selection is empty.
JDT
Ctrl+Shift+V invokes Open from Clipboard Ctrl+Shift+V has been assigned to invoke Open from Clipboard.

On GTK+ this key binding was previously assigned to the Display command as a workaround for Ctrl+Shift+D not working.

Clean Up to remove redundant type arguments A new option to remove redundant type arguments has been added under the "Unnecessary Code" group of the Clean Up profile.

Improved null analysis with generics The interplay of null annotations and generics has been improved in several regards.

The basic concepts had already been documented in the online help, but not all that was documented was actually checked by JDT's null analysis. With the changes outlined below, null analysis based on type annotations is even more capable than previous versions.

(1) The first batch of contributed improvements implements what we call "pessimistic analysis for free type variables", which affects implementors of generic types.

In order to allow clients to instantiate such a generic class with either a @NonNull or a @Nullable type as substitution for the "free type variable" <T>, the implementation of that class must account for the worst in both directions:

  • To anticipate a @NonNull type, each field typed to a free type variable must be initialized with a non-null value, and passing null where T is expected is illegal
  • To anticipate a @Nullable type, each dereference must be preceded by a null check.

At the bottom of each problem hover, you will find a link to the corresponding configuration option, should you like to change the severity of this diagnostic. Note that configurability is mainly given for smooth migration from previous JDT version; conceptually, problems detected by pessimistic analysis should be treated as errors, because they invalidate the null-guarantees given by a generic type.

configuration options for new diagnostics

(2) The second improvement concerns consumption of generic types from a library, more specifically: invocations of library methods whose return type is given by a free type variable.
If the library type is instantiated with a @NonNull type as the type argument, we generally want to interpret the mentioned return type as non-null, too. This is problematic only for some "legacy" methods, which may return null without declaring so. The most prominent example is java.util.Map.get(K) (see also the news entry on external annotations, which also demonstrates the clean solution to this issue).

The analysis cannot see whether absence of a null annotation for such a return type is intentional (in the above sense of "free type variables"), or an omission that should be fixed. For that reason a new warning has been implemented to alert about this situation.

In the above example, both fields list and map provide @NonNull String as a type argument, hence the return types of both get methods are interpreted as non-null. For List this is desired, for Map it is a bug.

The dilemma can be resolved by adding a (possibly empty) external annotation file (.eea) to each affected library class. By using an empty annotation file, the user signals that all types in this class should be interpreted verbatim (like in the List case - use with care). In the other case, the missing @Nullable annotation should be added as an external annotation (like in the Map case).

In a project that is not yet configured to use external annotations for the library in question, the warning is demoted to level "information". Generally, the severity of this problem is configured using the option right below the one mentioned above, titled Unsafe '@NonNull' interpretation of free type variable from library.

(3) Finally, a small utility class, org.eclipse.jdt.annotation.Checks, has been included in the bundle org.eclipse.jdt.annotation_2.1.0 containing helper methods for typical idioms for improving and documenting null safety.

New options in code formatter A few new options have been added in the formatter profile editor.

(1) In the Line Wrapping section, you can control the wrapping policy of 'for' loop headers.

(2) The Align fields in columns feature in the Indentation section can now be configured to recognize groups separated by empty lines and align them independently.

(3) In the New lines section, you can control if new lines should be added after annotations on enum constants.

PDE
Support for OSGi Declarative Services Annotations OSGi Declarative Services provide a powerful mechanism for developing complex, service-oriented applications. With proper tooling, annotations, which were added to Declarative Services in version 1.2, make it easy to generate and maintain the required component descriptor files.

When enabled, PDE automatically generates and updates Declarative Services component descriptor files from appropriately annotated Java source. This is done without requiring any additional builder to be configured in your project.

When you annotate your component implementation classes with @Component, and any reference bind methods with @Reference, PDE will validate your annotations and generate the corresponding component descriptor files. Any errors discovered during validation are highlighted and reported.

In addition, PDE will also maintain the project's MANIFEST.MF and build.properties file -- generated component descriptor files are automatically added to the manifest and included in the build.

To enable this feature, go to Preferences or Project Properties > Plug-in Development > DS Annotations and check Generate descriptors from annotated sources.

Updated OSGi Declarative Services Example The OSGi Declarative Services Example now uses annotations.

Instead of creating a Component Definition file for each component class and adding it to the manifest and build.properties, the wizard creates component classes annotated with the appropriate DS annotations, which are then used by PDE to automatically generate the corresponding component descriptor files.

Pagination control in Plug-in Image Browser In the Plug-in Image Browser, at the end of the view, there are pagination controls to move to the next page of images.

Tooltips for options in Tracing dialog In the Tracing tab of Eclipse launch configuration, the options now have tooltips which display more information about that option.

The information gets extracted from comments in the declaring bundle's .options file.
Platform Developers
APIs for high-DPI monitor support Platform-independent high-DPI support has been added to the Win32 and GTK ports. In the past, only the font size was adjusted on those two platforms, which lead to an inconsistent appearance of SWT applications across different platforms.

To shield existing clients from resolution differences, SWT now uses the Cocoa model on all three platforms. Existing SWT APIs keep using the well-known coordinate system in SWT points. In high-DPI environments, these SWT points are transparently scaled to native pixels.

To create DPI-aware org.eclipse.swt.graphics.Images, use these constructors that have already been provided in the Mars release:

  • Image(Device, ImageFileNameProvider)
  • Image(Device, ImageDataProvider)
Two new APIs have been added in Image to give you direct access to the pixel data on high-DPI monitors.
  • Image#getImageDataAtCurrentZoom(): Returns an ImageData that contains the full-resolution pixel data at the current OS zoom level
  • Image#getBoundsInPixels(): Returns the image dimensions in pixels at the current OS zoom level
SWT requires 1.7 Java runtime The SWT projects are now compiled at 1.7 compliance level. As a result, a Java runtime of 1.7 or above is required to run SWT applications.
Imports of the javax.annotation package no longer require a minimum version Plug-ins are no longer required to specify a minimum package version when importing the javax.annotation package. The Eclipse runtime will resolve all components to the same version (JVM or provided by the Eclipse Platform).

This avoids a common error in Eclipse RCP implementations in which @PostConstruct was resolved to different classes in the bundle classpath. This change is backwards compatible, i.e., a dependency with a minimum version still works correctly.

New factory method for data binding's ComputedValue An org.eclipse.core.databinding.observable.value.ComputedValue can compute custom values from other tracked getters inside its calculate method.

Before this change, you had to create a subclass of ComputedValue, but the new create method, which expects a Supplier<T> allows you to create an instance of ComputedValue by using a lambda expression.

Examples:

IObservableValue<Integer> listSizeObservable =
	ComputedValue.create(() -> observableList.size());
or
IObservableValue<String> fullNameObservable =
	ComputedValue.create(() -> personFirstNameObservable.getValue() + " "
		+ personLastNameObservable.getValue());

More details about tracked getters can be found in the org.eclipse.core.databinding.observable.ObservableTracker's getterCalled(IObservable) method. Almost every IObservable's get methods are tracked getters.

Change closeable attribute of MPart at runtime Calling the setCloseable method on an org.eclipse.e4.ui.model.application.ui.basic.MPart instance will now change the visibility of the close button for the corresponding part.

Shutdown started event for Eclipse 4 RCP applications When Eclipse 4 RCP applications are about to shut down, the org.eclipse.e4.ui.workbench.UIEvents.UILifeCycle.APP_SHUTDOWN_STARTED event will be fired now. Previously, this only worked for Eclipse RCP applications running in the compatibility mode, and in mixed mode applications which use both Eclipse 3 and 4 APIs.

The above features are just the ones that are new since the previous milestone build. Summaries for earlier Neon milestone builds: