Reputation: 4419
I want to use CSS styling for some widgets in only one plugin of my application.
The Plugin's plugin.xml contains:
<extension
point="org.eclipse.e4.ui.css.swt.theme">
<theme
basestylesheeturi="css/default.css"
id="my.app.id.css"
label="Planning Theme">
</theme>
</extension>
The Plugin.xml's extension tab didn't suggest the extension point, but after I entered it in the file, I could see the properties. One of which is "basestylesheeturi" and it allows me to browse for the file. So the file definitely exists.
@charset "ISO-8859-1";
#MYTESTLABEL{
color: blue;
}
Text {
color: COLOR-CYAN;
background-color: COLOR-WIDGET-BACKGROUND;
}
Button {
font: Verdana 24px;
border-color: #EEEE00;
border-width: 2;
}
But it isn't used by Eclipse. When I start my Application, I cannot see any styles from the css file. Setting colors to black or fonts to huge sizes... nothing has an effect. Even Syntax Errors in the css file won't result in an error message.
What can I do to ensure my plugin uses this css file for Texts, Buttons, etc.? Is my old Eclipse version maybe not supporting the extension point?
Version: Oxygen.3 Release (4.7.3)
EDIT
If I understand greg's answer correctly, I have to use both extension points (org.eclipse.core.runtime.product
and org.eclipse.e4.ui.css.swt.theme
). Additionally I added the css/default.css to the bin.includes section of the build.properties. The style is still not used.
There is a cssTheme already defined in another plugin.xml for the product by using those two extension points. From my understanding it should be possible to define a second theme only for a certain plugin.
It may be that I need to implement a ThemeSwitchHandler
as vogella describes here but it's unclear how to make use of it (how and when to call it).
Upvotes: 0
Views: 373
Reputation: 111142
That extension point just defines a theme, it doesn't tell e4 to use it.
For a pure e4 RCP you specify the theme to be used in the cssTheme
property of the org.eclipse.core.runtime.products
extension point which defines your product:
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
name="%product.name"
application="org.eclipse.e4.ui.workbench.swt.E4Application">
<property
name="cssTheme"
value="my.app.id.css">
</property>
... other properties
If there is already a theme defined in the RCP you can contribute an extra stylesheet file to the theme. For example:
<extension
point="org.eclipse.e4.ui.css.swt.theme">
<stylesheet
uri="css/e4-dark_pde_prefstyle.css">
<themeid
refid="org.eclipse.e4.ui.css.theme.e4_dark">
</themeid>
</stylesheet>
</extension>
Which adds an extra file to the standard Eclipse org.eclipse.e4.ui.css.theme.e4_dark
dark theme.
Upvotes: 1