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

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


From: Christian Strotz <Christian.Strotz@xxxxxxxxxxxxx>
To: "'e4-dev@xxxxxxxxxxx'" <e4-dev@xxxxxxxxxxx>
Date: 07/04/2012 10:26 AM
Subject: [e4-dev] Problem with css theme switching
Sent by: e4-dev-bounces@xxxxxxxxxxx





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">
             <theme
                    basestylesheeturi="css/default.css"
                    id="themes.default"
                    label="Default Theme">
             </theme>
             <theme
                    basestylesheeturi="css/bright.css"
                    id="themes.bright"
                    label="Bright Theme">
             </theme>
             <theme
                   basestylesheeturi="css/blue.css"
                    id="themes.blue"
                    label="Blue Theme">
             </theme>
</extension>
 
2.  In build.properties 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 {
             @Execute
             public void execute(IThemeEngine engine, @Named(XmiIDs.COMMANDPARAMETERS_THEME_ID) String themeId) {
                    engine.setTheme(themeId, true);
             }
 
             @CanExecute
             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?
 
greetings
Christian Strotz
 _______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev



Back to the top