Platform and Equinox API
Platform Changes |
|
Extension points added for Generic Text Editor |
A new extensible Generic Editor has been added which makes it easier
to implement an editor for new languages or new content types. It reuses
the existing Eclipse editor infrastructure. The generic editor can be extended using
extension points instead of implementing an editor to supply required functionality.
The following example shows how to contribute features to the generic editor via extensions: <extension point="org.eclipse.ui.genericeditor.contentAssistProcessors"> <contentAssistProcessor class="org.eclipse.ui.genericeditor.examples.dotproject.NaturesAndProjectsContentAssistProcessor" contentType="org.eclipse.ui.genericeditor.examples.dotproject"> </contentAssistProcessor> </extension> <extension point="org.eclipse.ui.genericeditor.hoverProviders"> <hoverProvider class="org.eclipse.ui.genericeditor.examples.dotproject.NatureLabelHoverProvider" contentType="org.eclipse.ui.genericeditor.examples.dotproject" id="natureLabelHoverProvider"> </hoverProvider> </extension> <extension point="org.eclipse.ui.genericeditor.presentationReconcilers"> <presentationReconciler class="org.eclipse.ui.genericeditor.examples.dotproject.BlueTagsPresentationReconciler" contentType="org.eclipse.ui.genericeditor.examples.dotproject"> </presentationReconciler> </extension>
Those new extension points receive as arguments regular Platform classes (
The above example shows that it is relatively simple to supply the rules for syntax highlighting.
The generic editor picks-up those through the extension points. Here is the editor in action:
|
An extension point to associate existing editors and content-types |
The extension point org.eclipse.ui.editors can now receive a new editorContentTypeBinding
child element which allows to define binding of an existing editor for an existing content-type.
Here is an example: <extension point="org.eclipse.ui.editors"> <editorContentTypeBinding contentTypeId="org.eclipse.ui.genericeditor.examples.dotproject" editorId="org.eclipse.ui.genericeditor.GenericEditor"> </editorContentTypeBinding> </extension> |
CompositeImageDescriptor HiDPI-ready |
The ImageDescriptor and CompositeImageDescriptor classes in
org.eclipse.jface.resource are now fully ready for HiDPI images. In
Neon (4.6), only ImageDescriptor#createFromURL(URL)
supported high-resolution images.
Clients that use protected void drawCompositeImage(int width, int height) { // draw overlay in top-right corner: ImageData imageData = myImageDescriptor.getImageData(); drawImage(imageData, width - imageData.width, 0); }HiDPI-aware code: protected void drawCompositeImage(int width, int height) { // draw overlay in top-right corner: CachedImageDataProvider provider = createCachedImageDataProvider(myImageDescriptor); drawImage(provider, width - provider.getWidth(), 0); }
Hint: Use |
Update in API for decorating images |
The org.eclipse.jface.viewers.DecorationOverlayIcon class has received a new constructor that allows
to more easily define decorated images based on an ImageDescriptor rather than Image . This allows
to prevent API adopters to deal with creation and disposal of the underlying resource when using ImageDescriptor.
Example of API usage: ImageDescriptor descriptor = /*base image descriptor*/; return new DecorationOverlayIcon( descriptor, PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR), IDecoration.BOTTOM_LEFT); |
New API for controlling build order |
The org.eclipse.core.resources.builders extension point now allows extensions to influence the
order in which projects are built by supplying an implementation of
IDynamicReferenceProvider . This replaces the
IProjectDescription#setDynamicReferences(IProject[]) API, which is now deprecated.
|
Asynchronous content-assistant |
A new constructor
org.eclipse.jface.text.contentassist.ContentAssistant(boolean asynchronous)
was added. An asynchronous ContentAssistant triggers
computation of completion proposals in the background and doesn't block the thread invoking the completion. As a result, it will prevent the UI thread to freeze
when a completion proposal computer takes too long.
This supports the same API and methods as the usual
Another new API is
The generic and extensible editor has been switched to use this asynchronous |
Stable sorting in viewers based on ViewerComparator |
The org.eclipse.jface.viewers.ViewerComparator now ignores decorations from a DecoratingLabelProvider during its sorting.
For example, if the EGit team provider is used, it prepends "> " for changed files. This additional "> " is now ignored.
The goal of this change is to eliminate
For now, you can disable this fix by setting the system property |
Reduced performance impact of very frequent progress reporting from background jobs |
When bad code was calling IProgressMonitor#setTaskName(String) very frequently in a background job,
the execution was heavily slowed down due to this reporting.
A workaround has been added to the jobs framework that throttles processing of excessive task name updates.
Performance tests have shown 2-3 times faster execution times for pathologic examples.
|
Application model allows toolbar definitions for parts and perspectives |
The application model has been extended to support the definition of toolbars (via trimbars) for parts and perspectives.
This simplifies the implementation of a common requirement in RCP applications. You can now define toolbars specific to a perspective and
toolbars rendering within the part area via your custom renderer.
Currently, the default Eclipse renderers do not use these new elements. |
Separation of DI extension annotations and supplier |
The annotations specified in org.eclipse.e4.core.di.extensions and the corresponding ExtendedObjectSupplier implementations have been separated.
The annotations are still available in the org.eclipse.e4.core.di.extensions bundle. The ExtendedObjectSupplier implementations have beend moved
to the new org.eclipse.e4.core.di.extensions.supplier bundle. This makes it easier for platform adopters to change the default implementation by providing a
replacement for the supplier bundle.
For plug-in based products this means that the new Note: As part of the re-organization, |
@Service annotation available in DI extensions |
The @Service annotation has been added to org.eclipse.e4.core.di.extensions . You can use this annotation to get OSGi services injected by supporting additional service specific features
like getting services with higher service ranking injected automatically, to get the list of services injected for the given type, and to filter for a specific filter by providing an OSGi
LDAP filter.
public class MyPart { // highest ranked service @Inject @Service MyOsgiService service; } public class MyPart { // all services sorted by ranking @Inject @Service List<MyOsgiService> service; } public class MyPart { // get the highest ranked service that has // the component property connection=online set @Inject @Service(filterExpression="(connection=online)") MyOsgiService service; } |
Dependency injection for Eclipse 3.x views available |
You can now use dependency injection (di) in your Eclipse 3.x. views.
You can enable this for a view via the new inject flag in the org.eclipse.ui.views extension.
Example usage:
|
Declarative services implementation replaceable |
In platform bundles, the bundle dependencies to org.eclipse.osgi.services have been replaced with the necessary package imports.
Mostly org.osgi.service.event needed to be added to the imported packages. This was necessary to avoid a
uses constraint violation when replacing org.eclipse.equinox.ds with org.apache.felix.scr .
|
Imperative Expressions |
You can now define visible-when expressions for menu items and tool items in an Eclipse 4 fashion by using
ImperativeExpression s rather than CoreExpression s.
ImperativeExpressions reference a POJO class with a method being annotated with the new @Evaluate annotation.
public class TestExpression { @Evaluate public boolean isVisible(EPartService partService, @Optional @Named("myValueToBeChecked") String myValueToBeChecked) { return "expectedValue".equals(myValueToBeChecked) && !partService.getDirtyParts().isEmpty(); } }The tracking property causes to track the values which are injected so that the visible state will be evaluated on eclipse context changes, e.g, when the "myValueToBeChecked" value in the context is changed, the visibility check will be run once more. |
Screenshot from JUnit |
In bundle org.eclipse.test.performance , there's a new API to take a screenshot from a JUnit test:
|
Debugging test timeouts |
In bundle org.eclipse.test.performance,
there's a new API that helps debugging those pesky tests that are freezing / hanging / DNF ("Did not finish")
in a remote Hudson build, and you have no clue why, because they always pass locally.
If your tests are organized in a JUnit-4-style test suite using the @RunWith(Suite.class) annotation, you can just replace that line by @RunWith(TracingSuite.class)
This will log the start of each atomic test contained in the suite to |
Equinox Changes |
|
New Declarative Services Implementation supporting OSGi R6 |
The previous release of Equinox only supported the OSGi R5 specification for the Declarative Services specification.
With bug 501950 the Apache Felix Declarative Services implementation (org.apache.felix.scr ) is now used as the Declarative Services implementation in the Platform and Equinox.
This implementation fully supports the OSGi R6 Declarative Services specification.
The Equinox bundle (org.eclipse.equinox.ds ) is still included in order to configure and start the Felix SCR bundle but the Equinox Declarative Service implementation code is no longer shipped within the org.eclipse.equinox.ds bundle.
The OSGi R6 API for declarative services requires some additional packages (
The Equinox bundle
Note that |
Several plug-ins define Provided Capabilities metadata |
You can now rely on OSGi's Require-Capability metadata in your Eclipse-based application for
org.eclipse.equinox.event and org.eclipse.equinox.cm as they now provide
the corresponding osgi.service capability.
Additionally, p2 capabilities are specified to be able to configure non-code dependencies that can be interpreted
by the p2 resolver.
|
Non-modal Install dialog | The Install dialog available via Help > Install New Software... is now non-modal, so that you can do something else while waiting for the catalog to be fetched. |
Progress reporting in the installation dialog |
When you select an update site, the installation dialog now provides progress feedback during the download of the
software catalog.
|
Tracing honors -consoleLog |
When the -consoleLog runtime option is specified on the command line, the Eclipse debug tracing
framework will send trace messages to System.out too (typically back to the command shell, if any).
This is especially handy when debugging Eclipse from Eclipse with tracing enabled, so no extra trace file
needs to be opened to check tracing output, and tracing output appears together with all other debug output
in the Console view.
|
Source-incompatible change in org.eclipse.equinox.common requires Java 8 BREE for some dependant plug-ins |
org.eclipse.core.runtime.ListenerList
now overrides Java 8 default method Iterable#spliterator() and provides stream() and parallelStream()
methods. Thus it exposes Java 8 types in public API. This is a source-incompatible change that requires all plug-ins using
ListenerList to have a minimum BREE set to JavaSE-1.8 if they want to properly compile against Oxygen and forthcoming
versions (i.e. versions in the [3.9,4.0) range).
The typical compile error indicating that you should change your BREE is:
The type
Note that this change is only required when using org.eclipse.equinox.common within
the [3.0,4.0) range will continue to work as before.
|
SWT Changes |
|
SWT requires 1.8 Java runtime | The SWT projects are now compiled at 1.8 compliance level. As a result, a Java runtime of 1.8 or above is required to run SWT applications. |
Lambda as SelectionListener |
The SelectionListener interface in SWT was enhanced to provide the
SelectionListener#widgetSelectedAdapter(Consumer<SelectionEvent> c) and
SelectionListener#widgetDefaultSelectedAdapter(Consumer<SelectionEvent> c)
static helper methods that accept lambdas and method references as listeners.
Example for adding a selection listener to a button: import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter; // ... Button button = new Button(parent, SWT.PUSH); button.addSelectionListener(widgetSelectedAdapter(e -> {System.out.print("Hello");})); |
Lambda as KeyListener |
The KeyListener interface in SWT was enhanced to provide the
KeyListener#keyPressedAdapter(Consumer<KeyEvent> c) and
KeyListener#keyReleasedAdapter(Consumer<KeyEvent> c)
static helper methods that accept lambdas and method references as listeners.
|
New API Image#getImageData(int zoom) |
Platform-independent high-DPI support has been added to the org.eclipse.swt.graphics.Image class to get ImageData at specific zoom levels:
Note: this API is mainly intended to be used by custom implementations of |
New APIs for Table header colors |
Support for custom table header foreground and background colors has been added on Mac, Windows and Linux (GTK3) platforms.
APIs for Table header foreground color:
APIs for Table header background color:
|
New APIs for Tree header colors |
Support for custom tree header foreground and background colors has been added on Mac, Windows and Linux (GTK3) platforms.
APIs for Tree header foreground color:
APIs for Tree header background color:
|
Table and Tree header styling via CSS |
You can now style the SWT table and tree headers via the CSS engine.
Table, Tree { swt-header-color: #CCC; swt-header-background-color: #383D3F; } |
Apply GTK+ CSS at runtime |
GTK+ CSS can be applied at runtime via Widget#setData(String, Object)
using org.eclipse.swt.internal.gtk.css as key.
Example:
... will produce the effect on the right on hover:
Note: Works on GTK+ 3.20 or later only. |
Tweak the GTK+ theme |
You can now tweak the GTK+ theme by providing your own CSS file to extend the default look.
A custom CSS file is registered by a VM argument like this:
The following CSS snippet gives the effect below.
Note: Works on GTK+ 3.20 or later only. |
Button widget background and foreground color can be styled on Windows |
You can now style the background and foreground color of the SWT Button widget on Windows:
Note: Above implementation is a custom paint operation that applies to all Button types except SWT.ARROW on Windows.
|
SWT spies separated from Tools plug-in | The Sleak and Spy views are now available in a new plug-in, org.eclipse.swt.tools.spies. They were previously part of org.eclipse.swt.tools, which depends on JDT. With the new spies plug-in, it is now possible to use the spies without depending on JDT. This makes it especially suitable for inclusion in target definitions and Eclipse RCP applications. |
Image#getImageDataAtCurrentZoom() and Image#getBoundsInPixels() are deprecated |
The Image#getImageDataAtCurrentZoom() and Image#getBoundsInPixels() APIs didn't serve the purpose
in an environment having multiple monitors with different DPIs, hence they were deprecated.
|
AccessibleTableListener deprecated #getCaption(..) |
The AccessibleTableListener#getCaption(AccessibleTableEvent) method corresponds to the
IAccessibleTable2::caption method, which has been deprecated by the IA2 accessibility specification
implemented by SWT Accessibility. Instead, an IA2_RELATION_LABELED_BY relation should be used to create a
relation between the table and its caption.
|
AccessibleTableListener deprecated #getSummary(..) |
The AccessibleTableListener#getSummary(AccessibleTableEvent) method corresponds to the
IAccessibleTable2::summary method, which has been deprecated by the IA2 accessibility specification
implemented by SWT Accessibility. Instead, an IA2_RELATION_DESCRIBED_BY relation should be used
to create a relation between the table and its summary.
|
Composite#changed(Control[]) deprecated |
The Composite#changed(Control[]) method has never been used in the Eclipse Platform, and the
method never had a well-defined purpose. It is now deprecated. Calling it is now equivalent
to calling Composite.layout(Control[], SWT.DEFER) .
|