Platform and Equinox API
Platform Changes |
|
CodeMining support with SourceViewer |
A code mining represents the content (ex: label, icons) that should be shown along with source text, like the number of references,
a way to run tests (with run/debug icons), etc. The main goal of code mining is to enable the developer to have a better understanding of the code and also help in writing better code.
A code mining is represented by The example CodeMiningDemo draws the Class references and implementations code minings:
|
CodeMining provider extension point |
The org.eclipse.ui.workbench.texteditor.codeMiningProviders extension point gives the capability to register a code mining provider org.eclipse.jface.text.codemining.ICodeMiningProvider in a text editor using ISourceViewerExtension5 .
Associating providers via this extension doesn't automatically enable code-mining, so clients are also supposed to use a reconciler or whatever event mechanism to invoke The GenericEditor Example displays the number of referenced projects:
This sample consumes the code mining provider ProjectReferencesCodeMiningProvider
which is registered with the <extension point="org.eclipse.ui.workbench.texteditor.codeMiningProviders"> <codeMiningProvider class="org.eclipse.ui.genericeditor.examples.dotproject.codemining.ProjectReferencesCodeMiningProvider" id="org.eclipse.ui.genericeditor.examples.dotproject.codemining.references" label="Project references"> <enabledWhen> <with variable="editorInput"> <adapt type="org.eclipse.core.resources.IFile"> <test property="org.eclipse.core.resources.contentTypeId" value="org.eclipse.ui.genericeditor.examples.dotproject" /> </adapt> </with> </enabledWhen> </codeMiningProvider> </extension> This code mining provider is updated with the <extension point="org.eclipse.ui.genericeditor.reconcilers"> <reconciler class="org.eclipse.jface.text.codemining.CodeMiningReconciler" contentType="org.eclipse.ui.genericeditor.examples.dotproject"> </reconciler> </extension> |
Inlined annotation support |
org.eclipse.jface.text.source.inlined.InlinedAnnotationSupport draws the content of the annotations in the StyledText without the actual payload text nor modifying the line numbers.
Each annotation takes care of placing the necessary space, vertically or horizontally, in the StyledText widget to draw the content.
The example InlinedAnnotationDemo draws:
|
Action for Inlined Annotations |
Inlined Annotation can define an action to execute when you click on the annotation with Consumer<MouseEvent> getAction(MouseEvent e) .
The example InlinedAnnotationDemo defines
an action to open the public ColorAnnotation extends LineContentAnnotation { ... @Override public Consumer<MouseEvent> getAction(MouseEvent e) { return ev -> { // Open the Color dialog when color annotation is clicked }; } }
|
Contribute highlight reconcilers to the Generic Editor |
The Generic Editor now supports a new extension point to override the default highlighter and add multiple org.eclipse.jface.text.reconciler.IReconciler for highlighting to provided content-types.
Reconcilers attached to this extension point that listen to the preference <extension point="org.eclipse.ui.genericeditor.highlightReconcilers"> <highlightReconciler class="org.eclipse.ui.genericeditor.examples.TagHighlightReconciler" contentType="org.eclipse.core.runtime.xml"/> </extension> |
Default debug hover contribution on Generic Editor |
The Debug framework contributes to the Generic Editor when the hover represented by an ITextSelection
can be adapted to an IVariable . So, in order to take advantage of debug details on hover in the Generic
Editor, you can simply use the org.eclipse.core.runtime.adpaters extension point and define an IAdapterFactory
from ITextSelection to IVariable to enable this feature.
If the current selection cannot be adapted (all adapter factories return null), the contribution to Generic Editor is ignored. The JDT project already contributes such an adapter. |
Contribute auto-edit strategies and reconcilers to the Generic Editor |
The Generic Editor now supports two new extension points to add an org.eclipse.jface.text.IAutoEditStrategy
or org.eclipse.jface.text.reconciler.IReconciler respectively for a provided content-type.Typical use cases for auto-edit strategies would be auto-indent, auto-closing braces or other syntax rules. <extension point="org.eclipse.ui.genericeditor.autoEditStrategies"> <autoEditStrategy class="org.eclipse.ui.genericeditor.demo.CloseTagAutoEditStrategy" contentType="org.eclipse.core.runtime.xml"/> </extension>Possible use cases for reconcilers would be code folding or a spell checker. <extension point="org.eclipse.ui.genericeditor.reconcilers"> <reconciler class="org.eclipse.ui.genericeditor.demo.TagFoldingReconciler" contentType="org.eclipse.core.runtime.xml"/> </extension> |
Generic Editor aggregates hover from multiple sources |
The hover included in the Generic Editor now aggregates the hover content from multiple
sources instead of picking only one.
This allows, for example, to contribute 3 distinct
hovers for problem details, code documentation and debug details via the
Hovers that return |
Support 'enabledWhen' for the all Generic Editor extension points |
All extension points targeting the Generic Edtor (autoEditStrategies , contentAssistProcessors , highlightReconcilers ,
hoverProviders , presentationReconcilers , reconcilers ) now allows an enabledWhen child elements for
contributions. This enableWhen is a Core Expression that controls whether the declared extension is enabled when insantiating the editor.
The evaluation context defines extra variables you can use in the expression: viewer , editor and editorInput .
This example shows how LSP4E contributes server highlight reconciler only for editor input supporting a language server: <extension point="org.eclipse.ui.genericeditor.highlightReconcilers"> <highlightReconciler class="org.eclipse.lsp4e.operations.highlight.HighlightReconciler" contentType="org.eclipse.core.runtime.text"> <enabledWhen> <with variable="editorInput"> <test property="org.eclipse.lsp4e.hasLanguageServer"> </test> </with> </enabledWhen> </highlightReconciler> </extension> |
Launch configuration prototypes |
A Launch configuration can now be based on a prototype.
A prototype seeds attributes in its associated launch configurations with the settings specified in the Prototype tab. Once a launch configuration has been created, you can override any initial settings from the prototype. You can also reset the settings of a launch configuration with the ones from its prototype. A launch configuration maintains a link to its prototype, but is a complete stand-alone launch configuration than can be launched, exported, shared, etc. Prototypes are already enabled for JDT and PDE launch configurations. Others projects have to enable prototypes with org.eclipse.debug.core.launchConfigurationTypes extension point:
<extension point="org.eclipse.debug.core.launchConfigurationTypes"> <launchConfigurationType allowPrototypes="true" delegate="org.eclipse.jdt.launching.sourcelookup.advanced.AdvancedJavaLaunchDelegate" delegateDescription="%localJavaApplicationDelegate.description" delegateName="%eclipseJDTLauncher.name" id="org.eclipse.jdt.launching.localJavaApplication" migrationDelegate="org.eclipse.jdt.internal.launching.JavaMigrationDelegate" modes="run, debug" name="%localJavaApplication" sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector" sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer"> </launchConfigurationType> </extension>and also implement org.eclipse.debug.ui.AbstractLaunchConfigurationTab.initializeAttributes() for their specifics tabs.
|
Dialog settings customization |
Platform now allows Eclipse product maintainers to specify initial dialog settings for
various bundles by providing the following:
|
Throttler |
UI updates in tight loops can degrade a system's performance, and users are also not capable of reading information that fast.
In such cases, class org.eclipse.jface.util.Throttler can now be used to limit the rate updates on the UI thread
with a specified time while executing the task wrapped in a Runnable .
An example use case is updates to a progress monitor, like in EGit's Import Project wizard. This wizard scans a directory
and reports any file found to the progress (actually a public class ProgressMonitorPart extends Composite implements IProgressMonitorWithBlocking { [...] private Throttler throttledUpdate; [...] throttledUpdate = new Throttler(fLabel.getDisplay(), Duration.ofMillis(100), this::updateLabel); [...] protected void queueUpdateLabel() { throttledUpdate.throttledExec(); } |
Configure workspace description to allow independent projects to build in parallel |
The IWorkspaceDescription has received a new API method setMaxConcurrentBuilds(int n)
which allows to configure the maximum number of threads/jobs that will be used in case workspace can
build independent projects in parallel.
At the moment, parallel builds with happen when under safe circumstances, depending on the scheduling rules involved
in Passing a value of The optimal value for throttling depends on your machine and workspace projects specificities. We do recommend to try relatively
low values (such as |
New API: org.eclipse.e4.core.di |
The package org.eclipse.e4.core.di in bundle org.eclipse.e4.core.di has been released as API.
This package contains the following mentionable types:
|
Removal of Update Manager API | The Update Manager API was dropped in favor of p2. All remaining references to the API have now finally been removed. The org.eclipse.update.* bundles are removed from all configurations. |
CSS Engine upgraded to use Batik 1.9 instead of 1.8 |
The Theme Engine in Platform UI was upgraded to use Batik 1.9 instead of 1.8.
The following Orbit bundle changes happened:
No code change is needed to adopt to the migration. |
SWT Changes |
|
Dropped support for XULRunner |
Eclipse/SWT has dropped support for XULRunner as a browser rendering engine on all platforms.
|
Webkit2 is now the default Browser renderer on Linux/GTK |
Preliminary support for Webkit2 on Linux/GTK was added in Eclipse Luna.
Webkit2 support is now complete and has replaced Webkit1 as the default renderer for the SWT Browser widget on Linux/GTK.
Webkit1 was known to crash at times. Webkit2 is stable and runs in a separate process, thus providing enhanced performance and is more secure. Webkit2 was also necessary because Webkit1 is no longer being provided on newer Linux distributions (e.g Fedora 27) To fallback to using Webkit1 (if needed), you can set the environment variable using: To inspect which version of Webkit you're running Eclipse under, set variable: See Webkit2 port bug for more details. |
New event SWT.OpenUrl added |
A new event type SWT.OpenUrl has been added to SWT to notify clients that an URL should be opened.
Listeners for OpenUrl event should be added to a Display. The event's text field contains the URL to be opened.
URLs can be passed to Eclipse in the same way in which file paths are passed from the command line (i.e, as arguments to the default action
|
New API getOffsetAtLocation(Point) added to StyledText |
The new method StyledText#getOffsetAtPoint(Point) is a replacement for
StyledText#getOffsetAtLocation(Point) . It behaves similar, except that it does
not throw an IllegalArgumentException when no character is at the given location,
but returns -1 instead.
Using the new method will result in better performance when used in tight loops. Especially the Show Whitespace editor feature benefits from using the new API.
The method |
Added new API in StyledText to customize different line spacing |
StyledText.setLineSpacingProvider(StyledTextLineSpacingProvider lineSpacingProvider) can be used to customize different line spacing by implementing the
org.eclipse.swt.custom.StyledTextLineSpacingProvider interface.
For an example, see Snippet369
which implements text.setLineSpacingProvider(lineIndex -> { String line = text.getLine(lineIndex).trim(); try { return Integer.parseInt(line); } catch(NumberFormatException e) { return null; } });
|
New API getAverageCharacterWidth added to FontMetrics |
A new method has been added in FontMetrics :
The method |
Lambda as Listener | Listener interfaces in SWT
were enhanced to provide static helper methods that accept
lambdas and method references as listeners. These methods are alternatives to using Adapter classes.
|
Datetime on Gtk now has support for localization |
Datetime on Gtk now has support for localized date format. A snippet to demonstrate can be found Snippet370 . |
Transparent color support on GTK3 | The SWT GTK3 port now includes support for transparent colors.
Previously, SWT Color on GTK only supported Red, Green and Blue (RGB) values
(all colors were opaque by default). Now, users can set alpha values to manipulate the transparency
property of SWT colors on GTK3.
The image below shows a red Canvas widget that is half transparent (alpha set to 0.5). |
Group widget text color stylable on Windows |
The Group widget text can now have a different color than the system default. Client can use Group#setForeground(Color)
to change the text color. Screen-shot for reference:
|
Set Button background color on Mac |
Button.setBackground() can now set the background color for a Button on Mac.
|
Background color for search box on Mac |
Text.setBackground(Color) can be used to set the background color of a Text widget with SWT.SEARCH style on Mac as well.
This already works on Windows and GTK.
|
New API Monitor#getZoom() added |
A new API Monitor.getZoom() has been added which returns the zoom value used by SWT for the Monitor.
The zoom value returned by the API is the zoom used by SWT that is controlled by the There are two use-cases of the API:
|
Equinox Changes |
|
P2 handles generic bundle requirements/capabilities |
As more OSGi technologies rely heavily on abstract dependencies to wire a consistent application it
became important for p2 to have first class handling of such dependencies. You are now able to use p2 to
provision "soft" bundle dependencies that cannot be expressed as Import-Package or
Require-Bundle manifest headers. Such dependencies are described by the
Require-Capability and Provide-Capability manifest headers, which p2 can now process.
For example, a consumer bundle may import the API package of an OSGi service ( |
Use SHA-256 to check artifact's data integrity |
To ensure data integrity of artifacts, alongside MD5, p2 now also generates and checks checksums using SHA-256 MessageDigest implementation, provided by any JRE. These checksums are stored in two new artifact's metadata properties:
org.eclipse.equinox.artifact.comparator.checksum.sha-256 as a comparator ID.
|
Support any MessageDigest implementation as artifact's checksum algorithm |
With the new extension point org.eclipse.equinox.p2.artifact.repository.artifactChecksums , it is now possible to contribute any MessageDigest implementation as a way to calculate and check artifact's checksums:
artifactChecksums extension point's documentation.
|