e(fx)clipse 1.2.0 – Themes are OSGi services

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">
     policy="dynamic" unbind="unregisterStylesheet"/>
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", 

5 thoughts on “e(fx)clipse 1.2.0 – Themes are OSGi services

  1. WhoCares January 26, 2015 / 9:39 am

    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.


    • Tom Schindl January 26, 2015 / 9:45 am

      Ok i fixed it

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s