e(fx)clipse 1.2.0 is trying to get a better OSGi citizen and so we try to remove more and more Equinox/Eclipse specific stuff which means that we want to get rid of the Extension Registry in our/your code.
In 1.1.0 themes have been defined using the theme extension point org.eclipse.fx.ui.theme
where you’ve been able to:
- Define a theme
- Contribute Stylesheets to themes
In 1.2.0 we deprecated the extension point in favor of making Themes
and Stylesheets
OSGi-Services you e.g. contribute through declarative services.
There are 2 main advantages:
- We get dynamics for free so themes and stylesheets can be installed/updated/uninstalled in a running application
- You have much more control over contributing a
Stylesheet
e.g. whether it applies to a given theme
A disadvantage if you want to find one is that it is a bit more work to define the theme and looks like this
<?xml version="1.0" encoding"UTF-8"?> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.fx.code.compensator.app.default-theme"> <implementation class="org.eclipse.fx.code.compensator.app.DefaultTheme"/> <service> <provide interface="org.eclipse.fx.ui.services.theme.Theme"/> </service> <reference bind="registerStylesheet" cardinality="0..n" interface="org.eclipse.fx.ui.services.theme.Stylesheet" name="Stylesheet" policy="dynamic" unbind="unregisterStylesheet"/> </scr:component>
package org.eclipse.fx.code.compensator.app; import org.eclipse.fx.ui.services.theme.Theme; import org.eclipse.fx.ui.theme.AbstractTheme; import org.osgi.service.component.annotations.Component; public class DefaultTheme extends AbstractTheme { public DefaultTheme() { super("default", "Default Theme", DefaultTheme.class.getClassLoader().getResource("css/default.css")); } }
Pingback: e(fx)clipse 1.2.0 – RRobot learned to generate declarative services | Tomsondev Blog
Hi Tom,
great, it seams a step further to be more OSGi-ish.
But you should check your code-makro because the XML and the Java-Class are full of " and hence hard to read.
Regards
WhoCares
Ok i fixed it
Pingback: SWT to JavaFX migration - Eclipse RCP Cookbook - codecentric Blog
Pingback: Migrate E4 RCP from SWT to JavaFX using SWTonJavaFX | Christoph Keimel