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.

<property
             name="applicationCSSResources"
             value="platform:/plugin/…/css/">
</property>


greetings
Christian Strotz

Von: [email protected] [mailto:[email protected]] 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

From:

Christian Strotz 
<[email protected]<mailto:[email protected]>>

To:

"'[email protected]'" <[email protected]<mailto:[email protected]>>

Date:

07/04/2012 10:26 AM

Subject:

[e4-dev] Problem with css theme switching

Sent by:

[email protected]<mailto:[email protected]>


________________________________



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
[email protected]<mailto:[email protected]>
https://dev.eclipse.org/mailman/listinfo/e4-dev

_______________________________________________
e4-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/e4-dev

Reply via email to