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