blob: fabcb09a9b2b1e345200ed528ca07af73c82a628 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="copyright" content="Copyright (c) Eclipse contributors and others 2015. This page is made available under license. For full details, see the LEGAL section in the documentation that contains this page."/>
<meta http-equiv="Content-Language" content="en-us"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" type="text/css"/>
<style type="text/css">
table.news td {border-top: solid thin black;}
table.news tr {vertical-align: top;}
table.news tr td.section {font-size: 20px; font-weight: bold;}
table.news tr td.title {vertical-align: top; width: 30%; font-weight: bold;}
table.news tr td.content {vertical-align: top; width: 70%;}
</style>
<title>Eclipse Platform What's New in Mars (SWT and Plug-in Developers)</title>
</head>
<body>
<h2>What's New in Mars (SWT and Plug-in Developers)</h2>
<p>Here are descriptions of some of the changes of interest to plug-in developers
made to the Eclipse <a href="#Platform">Platform</a>, <a href="#Equinox">Equinox</a> and
<a href="#SWT">SWT</a> for the Mars (4.5) release of Eclipse.
</p>
<p>
New features oriented towards end-users of the platform
can be viewed in the
<a href="../../org.eclipse.platform.doc.user/whatsNew/platform_whatsnew.html">What's New</a>
section of the Workbench User Guide.
</p>
<table class="news" border="0" cellpadding="10" cellspacing="0" width="80%">
<tbody>
<!-- ******************** Platform ********************** -->
<tr>
<td id="Platform" class="section" colspan="2"><h2>Platform Changes</h2></td>
</tr>
<tr id="Job-groups-api">
<td class="title">Job groups API</td>
<td class="content">
A JobGroup API (<code>org.eclipse.core.runtime.jobs.JobGroup</code>) has been added that makes it
easier to implement parallel algorithms in Eclipse.
<p>Job groups provide a simple way to manage a set of Eclipse Jobs that are responsible
for pieces of the same large task. The API supports throttling, joining, cancellation,
combined progress and error reporting for all of the jobs in the group. The job grouping
functionality can be used to implement performance critical algorithms using cooperating
jobs. More information can be found in
<b><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=432049">bug 432049</a></b>.</p>
</td>
</tr>
<tr id="jface-structuredselection">
<td class="title">Direct access to structured selection of a JFace Viewer</td>
<td class="content">
The JFace <code>StructuredViewer</code> class now has an API to access the <code>IStructuredSelection</code> directly.
Examples:
<pre> IStructuredSelection sel = viewer.getStructuredSelection();
ITreeSelection treeSel = treeViewer.getStructuredSelection();</pre>
Bye bye <code>(IStructuredSelection) viewer.getSelection()</code>, we won't miss you!
</td>
</tr>
<tr id="AbstractSelectionDialog">
<td class="title">New API: AbstractSelectionDialog</td>
<td class="content">
<code>org.eclipse.jface.dialogs.AbstractSelectionDialog</code> is an enhanced version of the existing
<code>org.eclipse.ui.dialogs.SelectionDialog</code>.
It has been added to the org.eclipse.jface bundle, where it is also available for Eclipse 4 RCP applications.
<p>The AbstractSelectionDialog API supports generics and varargs.
</p>
</td>
</tr>
<tr id="ant-version-upgrade">
<td class="title">Ant 1.9.4</td>
<td class="content">
Eclipse has adopted Ant version 1.9.4.
</td>
</tr>
<tr id="step-filter-ext-point">
<td class="title">New stepFilters extension point</td>
<td class="content">
The new <b>stepFilters</b> extension point allows clients to provide new step filters for existing debug models without having to extend those models.
<p>
To use the new extension point, clients will require a dependency on <code>org.eclipse.debug.core</code>. Clients can then access any contributed step filters
using the new API: <code>org.eclipse.debug.core.DebugPlugin.getStepFilters(String)</code>.
</p>
<p>
An example of the new extension point:
</p>
<pre>
&lt;extension point=&quot;org.eclipse.debug.core.stepFilters&quot;&gt;
&lt;stepFilter
class=&quot;com.example.ExampleStepFilter&quot;
modelIdentifier=&quot;com.example.debug.model&quot;&gt;
&lt;/stepFilter&gt;
&lt;/extension&gt;
</pre>
</td>
</tr>
<tr id="resource-notifications">
<td class="title">New debug option for resource change notifications</td>
<td class="content">
In order to help troubleshooting problems with resource change listeners,
a new debug option was added to print information about which event triggers which
listener. This option gives a better picture of the flow of all workspace
change events and how other plugins react to those changes. To enable the new
option, add
<pre>
org.eclipse.core.resources/debug=true
org.eclipse.core.resources/notifications=true</pre>
in your <a href="http://help.eclipse.org/topic/org.eclipse.pde.doc.user/guide/tools/launchers/tracing.htm">.options file</a>
or use the <b>General &gt; Tracing</b> preference page to
enable it.
</td>
</tr>
<tr id="i18n-for-cssbridge">
<td class="title">I18n support for CSS bridge</td>
<td class="content">
Internationalization and localization support for the CSS bridge has been added. More information can be found in <b><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=437902">bug 437902</a></b>
<p>
Example:
</p>
<p>
1. Modified files needed to enable the i18n support in the CSS bridge for the Polish locale:
</p>
<img src="images/i18n_for_cssbridge-required_mod_files.png" alt="Modified files for the i18n support"/>
<p>
2. Launch the Eclipse instance with the '-nl pl' command line arguments. Running CSS bridge with Polish locale:
</p>
<img src="images/i18n_for_cssbridge-colorAndFontDialog.png" alt="CSS bridge with polish locale"/>
</td>
</tr>
<tr id="runtime-locale-type-change">
<td class="title">Changed type of TranslationService.LOCALE</td>
<td class="content">
The type of the <code>LOCALE</code> value in the application context was changed from
<code>String</code> to <code>Locale</code> (for performance reasons).
<p>If you are injecting <code>org.eclipse.e4.core.services.translation.TranslationService.LOCALE</code> in your code, you
need to change the type from <code>String</code> to <code>Locale</code>.</p>
</td>
</tr>
<tr id="css-transparency">
<td class="title">CSS support for new COLOR-TRANSPARENT constant</td>
<td class="content">
The CSS engine now supports the COLOR-TRANSPARENT property. The implementation uses SWT's new SWT#COLOR_TRANSPARENT pseudo-color.
COLOR-TRANSPARENT allowed to simplify the dark theme significantly.
<!-- TODO: Could add a link to an API description, but not to a bug. -->
</td>
</tr>
<tr id="css-inherit-prop">
<td class="title">New 'inherit' value for CSS properties</td>
<td class="content">
When CSS property gets 'inherit' value then the parent's value will be applied. See more in <b><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=419377">bug 419377</a></b>
<p>
<img src="images/css-inherit-prop.png" alt="" />
</p>
</td>
</tr>
<tr id="css-section-prop">
<td class="title">New CSS properties for the Section title bar</td>
<td class="content">
The Forms Section title bar can now be styled with special CSS properties for a Section:
<p>
<img src="images/section_css.png" alt="CSS for Section"/>
</p>
<p>
By using the same color for the background-color-titlebar and
background-color-gradient-titlebar CSS property,
like in the sample above, you get a solid background color.
</p>
<p>For more information see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=431635">bug 431635</a>.</p>
</td>
</tr>
<tr id="css-section-multiple">
<td class="title">Support for multiple style sheet rules for the same selector</td>
<td class="content">
The CSS engines now scans all style sheets and combines all matching rules into a common style. This allows plug-ins to override previously defined styles:
<p>
<img src="images/css_override.png" alt="CSS override"/>
</p>
<p>For more information see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=458342">bug 458342</a>.</p>
</td>
</tr>
<tr id="help-service">
<td class="title">Provisional EHelpService service</td>
<td class="content">
Eclipse now provides the provisional help service <code>EHelpService</code> in the <code>IEclipseContext</code>.
<code>EHelpService</code> is a thin wrapper to the <code>WorkbenchHelpSystem</code> in the Eclipse IDE and allows customers to
provide their custom implementation in Eclipse RCP applications.
</td>
</tr>
<tr id="message_registry">
<td class="title">Message registry</td>
<td class="content">
Added support for binding control attributes for localization to a value of a messages class.
By using such a binding, the dynamic update of widgets due to locale changes at runtime (<i>Eclipse Translation Pattern</i>)
gets easier to implement, since the localized widgets (e.g. <code>Labels</code>, <code>Buttons</code>, etc.)
are managed by the message registry.
<p>
To use the message binding for a messages class named <code>MyMessages</code>, you need to create a specialized
<code>BaseMessageRegistry</code> class like shown below:
</p>
<pre>@Creatable
public class MyMessageRegistry extends BaseMessageRegistry&lt;MyMessages&gt; {
@Override
@Inject
public void updateMessages(@Translation MyMessages messages) {
super.updateMessages(messages);
}
}</pre>
<p>
It can then be used like this:
</p>
<pre>@Inject
MyMessageRegistry registry;
@PostConstruct
public void init(Composite parent) {
Label myFirstLabel = new Label(parent, SWT.WRAP);
Label mySecondLabel = new Label(parent, SWT.NONE);
Label myThirdLabel = new Label(parent, SWT.NONE);
// bind myFirstLabel via method reference
registry.register(myFirstLabel::setText, (m) -> m.firstLabelMessage);
// bind mySecondLabel via method name
registry.register(mySecondLabel, "setText", "secondLabelMe
ssage");
// bind myThirdLabel via property name
registry.registerProperty(myThirdLabel, "text", "thirdLabelMessage");
}</pre>
<p>
The <code>BaseMessageRegistry</code> supports bindings for Java version before Java 8.
</p>
</td>
</tr>
<tr id="e4tools-integration">
<td class="title">e4 tools integrated into Eclipse platform</td>
<td class="content">
Parts of the e4 tools have been integrated into the Eclipse platform project. Mainly the Eclipse 4 application
model editor and related wizards are now directly available via the Eclipse update site. The e4 project wizard has been
integrated into PDE, see the PDE section for more information.
<p>
<img src="images/updatesitee4tools.png" alt=""/>
</p>
</td>
</tr>
<tr id="xpath">
<td class="title">XPath expressions for parent element ID in Model Fragments</td>
<td class="content">
When specifying the target for a fragment contribution, you can now use an
XPath expression or a comma-separated list of element IDs instead of a single
element ID.
<p>The XPath expression uses JXPath internally, so it should reference attributes of the model object,
not the XML file.</p>
<p>These 2 samples are equivalent:</p>
<code>parentElementId="MyMenu1, MyMenu2"</code>
<br />
<code>parentElementId="xpath://*[@elementId='MyMenu1' or @elementId='MyMenu2']"</code>
<p>This feature opens up the possibility to:</p>
<ol>
<li>Add a fragment to multiple places in a model</li>
<li>Target a fragment to multiple application models</li>
<li>Specify attributes (such as tags) as the target</li>
</ol>
</td>
</tr>
<tr id="e4model-icons-displayed">
<td class="title">Icons are displayed in model editor and model spy</td>
<td class="content">
If an Icon URI is defined, it is now displayed in the model editor and in the model spy:
<p>
<img src="images/model-editor-icons.png" alt=""/>
</p>
</td>
</tr>
<tr id="default-darkthemecss-forms">
<td class="title">Better CSS support for Forms-based editors</td>
<td class="content">
CSS support for Forms-based editors has been improved. The dark theme included in the Eclipse SDK
takes advantages of that, as depicted in the following screenshot:
<p>
<img src="images/formheader.png" alt=""/>
</p>
</td>
</tr>
<tr id="default-darkthemecss-heapmonitor">
<td class="title">Heap Monitor can be styled, dark theme uses that</td>
<td class="content">
The heap monitor has been extended to allow to set its background color, and the dark theme uses that. The following
screenshot show the heap monitor after the change.
<p>
<img src="images/heap-after.png" alt=""/>
</p>
</td>
</tr>
<!-- ******************** Equinox ********************** -->
<tr>
<td id="Equinox" class="section" colspan="2"><h2>Equinox Changes</h2></td>
</tr>
<tr id="getAdapter">
<td class="title">IAdaptable#getAdapter(Class) generified</td>
<td class="content">
The <code>org.eclipse.core.runtime.IAdaptable</code> interface has been enhanced to return the requested type from
its <code>getAdapter</code> method:
<pre>public &lt;T&gt; T getAdapter(Class &lt;T&gt; adapter);</pre>
<p>Implementations of this method should also be updated. This has already been done
for some platform APIs like <code>org.eclipse.ui.part.WorkbenchPart</code>. Callers and implementers
of these APIs can see compile errors or warnings due to this binary-compatible change.</p>
<p>For more information, see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=442021#c25">bug 442021</a>.</p>
</td>
</tr>
<tr id="jetty9">
<td class="title">Updated to Jetty version 9</td>
<td class="content">
Updated to the Jetty version 9.2.3 to provide the servlet container for the Equinox Http Service implementation. Jetty 9 implements the Servlet 3.1 specification. Both Jetty 9 and Servlet 3.1 require Java 7. Java 7 is now required in order to run the Equinox Http Service and the Eclipse Help system.
</td>
</tr>
<tr id="http-white-board">
<td class="title">New Http Whiteboard implementation</td>
<td class="content">
<ul>
<li>New implementation of Http Whiteboard Draft specification. See <a href="http://www.osgi.org/Specifications/Drafts">Current Drafts</a>.</li>
<li>Simplify your web development by using whiteboard pattern to create assemblies of servlets, filters, context listeners and grouping them logically in shared contexts.</li>
<li>The implementation is a near feature complete implementation of the draft specification.</li>
<li>In addition to the Http Whiteboard specification, the Equinox Http Service implementation provides a complete imperative API in order to support the traditional direct registration programming model.</li>
<li>Supports Servlet 3.0 features.</li>
<li>Ongoing work will continue to provide more tests, improve support for Servlet 3.1 features and to improve stability and performance.</li>
</ul>
</td>
</tr>
<tr id="p2-native-dependencies">
<td class="title">Prompt for native dependencies</td>
<td class="content">
It is now possible with p2 to express dependencies on OS packages and prompt the user to install those when they are not installed.
<p><img src="images/os-prompt.png" alt="" /></p>
<p>This functionality can be enabled by a new touchpoint instruction. For example:</p>
<pre>org.eclipse.equinox.p2.touchpoint.natives.checkAndPromptNativePackage(distro:debian,package:handbrake,comparator:ge,version:0.9);</pre>
<p>At this point, the support is limited to Ubuntu.
<a href="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Equinox&amp;component=p2">Contributions</a> to add this support for other OS are welcomed.</p>
<p>Integration with Tycho is available from 0.23.0-SNAPSHOT and above.</p>
</td>
</tr>
<!-- *********************** SWT *********************** -->
<tr>
<td id="SWT" class="section" colspan="2"><h2>SWT Changes</h2></td>
</tr>
<tr id="menuitem-tooltip">
<td class="title">Added API to set tooltip for MenuItem</td>
<td class="content">
SWT now supports setting a tooltip on menu items via <code>MenuItem.setToolTipText()</code>.
<p>
For an example, see the <b>Menu</b> tab in the <a href="https://www.eclipse.org/swt/examples.php">ControlExample</a>.</p>
<p>
<img src="images/tooltip.png" alt="" />
</p>
</td>
</tr>
<tr id="date-time-on-gtk-spin-button">
<td class="title">The DateTime widget now uses GtkSpinButton on UNIX/Linux platforms</td>
<td class="content">
The DateTime widget has been re-implemented to use the GtkSpinButton widget for
<code>SWT.DATE</code> and <code>SWT.TIME</code> styles. The new look and feel is as illustrated below:
<p><b>GTK+ 2:</b></p>
<p>
<img src="images/gtk2-date-time.png" alt="" />
</p>
<p><b>GTK+ 3:</b></p>
<p>
<img src="images/gtk3-date-time.png" alt="" />
</p>
</td>
</tr>
<tr id="sleep-wakeup-deprecated-replaced">
<td class="title">New monitoring events added in place of SWT.Sleep and SWT.Wakeup</td>
<td class="content">
The <code>SWT.Sleep</code> and <code>SWT.Wakeup</code> events have been deprecated
in favor of the more generic events <code>SWT.PreExternalEventDispatch</code> and
<code>SWT.PostExternalEventDispatch</code>, respectively. Clients that were written
using the old event names should be updated to refer to the new events.
</td>
</tr>
<tr id="transparent-bg">
<td class="title">Transparent background for Control</td>
<td class="content">
SWT has added support to set a <code>Control</code>'s background as transparent. The <code>Color</code> class now supports specifying an alpha value (integer: 0 to 255) for transparency.
Calling <code>Control#setBackground(Color color)</code> with a transparent color (color with alpha value '0'), sets the control's background as transparent.
<p><b>List of new classes and APIs:</b></p>
<ul>
<li>Class: <code>org.eclipse.swt.graphics.RGBA</code></li>
<li>Constant: <code>SWT.COLOR_TRANSPARENT</code> - This is a default transparent color</li>
<li>Methods added in <code>org.eclipse.swt.graphics.Color</code></li>
<li><ul>
<li><code>public Color (Device device, int red, int green, int blue, int alpha)</code></li>
<li><code>public Color (Device device, RGB rgb, int alpha)</code></li>
<li><code>public Color (Device device, RGBA rgba)</code></li>
<li><code>public RGBA getRGBA </code>()</li>
<li><code>public int getAlpha ()</code></li>
</ul></li>
</ul>
<p><b>Note:</b></p>
<ul>
<li>Currently, SWT honors only extreme values for alpha i.e, '0'(transparent) or '255'(opaque).</li>
<li>Setting transparent background color fails for some controls on all platforms, they show the default background color instead. For e.g. Text, Combo.</li>
<li>Setting transparent background color for some controls works on GTK3 only, it fails on other platforms. For e.g. Table, Tree.</li>
</ul>
For an example on using the new APIs, see <a href="http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java">Snippet365</a>.
<p>
<b>Snippet365 in action</b> (Controls with <code>SWT.COLOR_TRANSPARENT</code> background and Shell with gradient background image)
</p>
<p>
<img src="images/transparent_control_background.png" alt="Transparent Background on Control widgets" />
</p>
</td>
</tr>
<tr id="high-dpi">
<td class="title">APIs for high-DPI monitor support</td>
<td class="content">
New APIs have been added to provide support for rendering high-resolution images on high-DPI monitors.
<p>
Two constructors have been added to the <code>Image</code> class. They accept
image-provider callbacks that allow clients to supply resolution-dependent versions
of images:
</p>
<pre>public interface ImageDataProvider {
public ImageData getImageData (int zoom);
}
public interface ImageFileNameProvider {
public String getImagePath (int zoom);
}</pre>
<p>
Depending on the user's monitor configuration, SWT will request images with the
corresponding zoom level. Here's an example that displays 3 original images,
followed by variants whose resolution changes depending your monitor's resolution:
<a href="http://git.eclipse.org/c/platform/eclipse.platform.swt.git/plain/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet367.java">Snippet367.java</a>.
</p>
<p>
Note that this is just the first step to support high-resolution images in
SWT and Eclipse-based applications. Work is underway to adopt the new APIs in
the platform. Futhermore, more work in SWT is required to properly
support drawing into high-resolution images via <code>GC</code>.
</p>
</td>
</tr>
<tr id="evaluate">
<td class="title">API to choose security context in Browser#evaluate()</td>
<td class="content">
A new API <code>Browser#evaluate(String script, boolean trusted)</code> has been added that allows the client to run
Javascript code in the Chrome security context or in the normal security context for <code>SWT.MOZILLA</code>
style browsers.
</td>
</tr>
<tr id="auto-text-direction">
<td class="title">BIDI: SWT Controls now support AUTO text direction</td>
<td class="content">
The auto (a.k.a. "contextual") text direction implies that the base text direction is derived from the direction
of the first strong (either LTR or RTL) bidi character. Auto text direction is the most appropriate choice when
the text content is not known in advance and, hence, it is not yet possible to decide which base direction value,
LTR or RTL, would be most suitable at run time.
<br />
Support for auto text direction has been introduced at the SWT Control level. Auto text direction can be applied
through the existing <code>Control#setTextDirection</code> API. The new value for auto direction is expressed as
the bitwise disjunction of (<code>SWT#LEFT_TO_RIGHT</code> | <code>SWT#RIGHT_TO_LEFT</code>) bit fields. When
applied onto a Composite control, the auto base direction (similarly to LTR and RTL ones) is inherited by the
child components.
<br />
For example:
<ul>
<li><code>org.eclipse.swt.widgets.Table.setTextDirection(SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);</code></li>
</ul>
Result:
<p>
<img src="images/auto-text-direction.png" alt=""/>
</p>
<b>Note:</b> Auto text direction is not yet supported:
<ul>
<li>in StyledText</li>
<li>upon Control creation (but only through <code>Control#setTextDirection</code> call once the Control has been created)</li>
</ul>
</td>
</tr>
<tr id="swt-tools">
<td class="title">SWT Tools</td>
<td class="content">
<a href="https://www.eclipse.org/swt/tools.php">SWT Tools</a> are now available in the Eclipse Platform p2 repository.
SWT Tools provides tools for developing SWT itself (JNIGen) but also general purpose tools like <b>Sleak</b>
(monitors the creation and disposal of SWT graphics resources) and <b>SWT Spy</b> (prints out information like style, layout and parent
about the widget under the cursor).
</td>
</tr>
</tbody>
</table>
</body>
</html>