Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Problem with css theme switching

I solved my problem. The theme engine worked fine but it couldn’t find the css files because it didn’t knew where they are.

I forgot the applicationCSSResources property in my plugin.xml.









Christian Strotz


Von: e4-dev-bounces@xxxxxxxxxxx [mailto:e4-dev-bounces@xxxxxxxxxxx] Im Auftrag von Bogdan Gheorghe
Gesendet: Mittwoch, 4. Juli 2012 17:25
An: E4 Project developer mailing list
Betreff: Re: [e4-dev] Problem with css theme switching


Hi Christian -

Take a look at ThemeEngine.setTheme and put a breakpoint at the part where it tries to resolve the stylesheet URL. Is the resolved URL valid for your stylesheets?

- Bogdan


Christian Strotz <Christian.Strotz@xxxxxxxxxxxxx>


"'e4-dev@xxxxxxxxxxx'" <e4-dev@xxxxxxxxxxx>


07/04/2012 10:26 AM


[e4-dev] Problem with css theme switching

Sent by:



Hello together
In my e4 rcp app I use three different css styles. With the org.eclipse.e4.ui.css.swt.theme bundle it’s possible to switch between the themes.
What I have:
1.       In plugin.xml I use the extension point of org.eclipse.e4.ui.css.swt.theme to register my themes
<extension point="org.eclipse.e4.ui.css.swt.theme">
                    label="Default Theme">
                    label="Bright Theme">
                    label="Blue Theme">
2.  In I set that all css files will be exported and the org.eclipse.e4.ui.css.swt.theme is in the product configuration as dependency
3.  I defined some menus in Application.e4xmi to switch between the themes
4.  The handler to switch between the themes:
public final class SwitchThemeHandler {
             public void execute(IThemeEngine engine, @Named(XmiIDs.COMMANDPARAMETERS_THEME_ID) String themeId) {
                    engine.setTheme(themeId, true);
             public boolean canExecute(IThemeEngine engine, @Named(XmiIDs.COMMANDPARAMETERS_THEME_ID) String themeId) {
                    String activeThemeId = engine.getActiveTheme().getId();
                    return !activeThemeId.equals(themeId);
It works great if I start the product in eclipse. When I export the product I can properly run it without errors but there is no style active and I can’t switch between it. When I go into the exported plugin jar I can see my css files.
What is going wrong and how can I fix it?
Christian Strotz
e4-dev mailing list

Back to the top