Skip to main content

Platform and Equinox API

Platform Changes

Compare/merge files using Generic Editor extensions To leverage the extensions for Generic Editor (syntax highlighting, hover...) when comparing files, you can now simply associate the org.eclipse.ui.genericeditor.compareViewer to the desired file content-types. This will automatically add to the compare view most extensions contributed to the Generic Editor.
<extension point="org.eclipse.compare.contentMergeViewers">
   <contentTypeBinding
         contentMergeViewerId="org.eclipse.ui.genericeditor.compareViewer"
         contentTypeId="org.eclipse.wildwebdeveloper.parent"/>
</extension>
Extensible Quick Access content The Quick Access search (accessible with Ctrl+3 shortcut) now provides a new org.eclipse.ui.quickAccess extension point to contribute additional content.

Classes in package org.eclipse.ui.quickaccess have been made API for this use-case.

The following example shows how Run and Launch Configurations are made available in Quick Access:

<extension point="org.eclipse.ui.quickAccess">
   <computer class="org.eclipse.debug.internal.ui.quickaccess.RunQuickAccessProvider" name="%Run.name"/>
   <computer class="org.eclipse.debug.internal.ui.quickaccess.DebugQuickAccessProvider" name="%Debug.name"/>
</extension>

The computers implement the org.eclipse.ui.quickaccess.IQuickAccessComputer class, which is responsible for returning some org.eclipse.ui.quickaccess.QuickAccessElement.

Computers are only contributing when their host bundle is started, bundles will not be started automatically when querying Quick Access.

Type parameters on Beans and JFace databinding classes Type parameters have been added to relevant classes and methods in the org.eclipse.core.databinding.beans and org.eclipse.jface.databinding bundles. This makes code using these classes more explicit and clear and can help catching bugs in an early stage. These changes complete the effort to use generics to improve the databinding framework, which was started several years ago. If you use these databinding bundles you should be able to get rid of many raw type warnings which have been unavoidable for a long time.

Example:

// The BeanProperties.value method returns a IBeanValueProperty<Bean, String>
IObservableValue<String> nameModel =
    BeanProperties.value(Bean.class, "name", String.class).observe(bean);
// The WidgetProperties.text method returns a IWidgetValueProperty<Text, String>
IObservableValue<String> nameTarget = WidgetProperties.text().observe(textControl);

dataBindingContext.bindValue(nameTarget, nameModel);

The changes are fully binary compatible and no behaviour is changed.

Tips for using the typed databinding API

  • Using the UpdateValueStrategy.create method to create update strategies with a converter avoids the need to specify type arguments:
    dataBindingContext.bindValue(ageTarget, ageModel,
        UpdateValueStrategy.create(converter), null);
    
  • It is often easier to work out the types when sub-expressions are assigned to variables:
    UpdateValueStrategy<String, Integer> toModel = new UpdateValueStrategy><();
    toModel.setConverter(converter);
    toModel.setAfterConvertValidator(validator);
    dataBindingContext.bindValue(target, model, toModel, null);
    
  • New methods for creating typed versions of property objects have been added in some places:
    // Returns a IViewerValuePropert<Viewer, ModelObject>
    ViewerProperties.singleSelection(ModelObject.class)
    
  • Upgrading to Java 10 lets you use the var keyword, which avoids much of the verbosity of using property objects with type parameters:
    var text = WidgetProperties.text();
    

Note about typed property factory classes: To avoid causing compile errors for clients new versions of property factory classes that return typed property objects have been created. This applies for the following classes: WidgetProperties, ViewerProperties, BeanProperties and PojoProperties.

To start using these classes simply replace the import of the untyped factory classes by an import of the typed version.

Note about EMF Databinding: EMF Databinding has not been updated with type parameters. That can make it awkward to use EMF Databinding together with the generified databinding APIs. A good strategy for working around that is to create factory methods for EMF properties with generic types as their return values:

@SuppressWarnings("unchecked")
public static IValueProperty<ModelEObject, String> name(EditingDomain editingDomain) {
    return EMFEditProperties.value(editingDomain, ModelPackage.Literals.MODEL_EOBJECT__NAME);
}
ToolTip Support for CommonViewers It is now possible to provide tooltips to CommonViewers via ILabelProviders.

To do this, two steps are necessary:

  1. Enable tooltip support for the respective viewer by setting the option org.eclipse.ui.navigator.enableTooltipSupport to true in the extension declaration, as in
    <extension point="org.eclipse.ui.navigator.viewer">
      <viewer id="org.eclipse.ui.example.cnf.viewer">
        <!-- ... -->
        <options>
          <property
            name="org.eclipse.ui.navigator.enableTooltipSupport"
            value="true" />
        </options>
      </viewer>
    </extension>
    
  2. Contribute an ILabelProvider which also implements org.eclipse.jface.viewers.IToolTipProvider. The tooltip text can be provided by the method getToolTipText(Object element) following the same rules as getText(Object element). I.e., the non-null, non-empty string obtained from the highest-ranked label provider is used as the tooltip.

SWT Changes

New native implementation of ImageLoader on GTK The implementation of ImageLoader on GTK now uses the native GdkPixbuf API for image loading and saving.

Key highlights of the new ImageLoader on GTK:

  • Loading and saving images has native performance, with ~200% increase in loading time for JPEG files
  • Better GIF animation support
  • Support for more image formats
Display.Close and Display.Dispose events are now supported on GTK on logoff/shutdown This works on GNOME and XFCE (> 4.13) sessions. This brings Linux in line with Windows and Mac OS implementations:
  • Display.Close can set the Event.doit to false to send a "not ready" hint to the session manager. However, the session manager will usually ignore this hint and continue logoff/shutdown anyway. The time limit imposed by the session manager is 1 second, so it is not suitable for showing the user any UI.
  • Display.Dispose lets you run any final cleanup, such as saving settings on exit. Also, any code you have after a while (!xxx.isDisposed()) loop will run now. The time limit imposed by the session manager is 10 seconds.

Previous Up Next

Back to the top