Search code examples
csseclipseeclipse-rcpe4

Eclipse 4 themes


I am migrating a 3.x eclipse RCP to e4.

I was able to successfully use eclipse's predefined themes. But I have done it by adding an extension to org.eclipse.e4.ui.css.swt.theme and copying all the css and images folder found in org.eclipse.ui.themes to my application.

I am not going to ever modify those themes I copied. So I was wondering if I can use the themes directly without copying the already made css files and images folder. This is also not future proof, if I ever upgrade eclipse platform where there was an update in the themes I would have to recopy the new theme resources.

What is the right way to do things? What is the e4 way?

Based on greg-449 answer I have added the following:

<property
           name="applicationCSS"
           value="platform:/plugin/com.example.rcp4/css/default.css">
</property>

Where default.css contains:

@import url("platform:/plugin/org.eclipse.ui.themes/css/e4_default_win7.css");

This works just fine. But now I am facing this look:

e4 styling


Solution

  • You can import existing CSS files in to your CSS using @import so you don't need to copy them.

    Something like:

    @import url("platform:/plugin/greg.music.e4.rcp/css/helvneue.css");
    

    In this platform:/plugin/greg.music.e4.rcp is selecting the plugin containing the css (a plugin with id greg.music.e4.rcp in this case). /css/helvneue.css is the path to the CSS within the plugin.