nbz
nbz

Reputation: 3938

Eclipse RCP CSS styling does not work after export

I followed the suggested steps in this forum to get CSS themeing for the different OSs by copying the css and images folder from org.eclipse.platform.

It works fine when I launch it from Eclipse but when I export the product file (whether from Eclipse or via Maven), there is no CSS styling at all.

I have checked the build.properties and the css and images folder are marked for export so I do not understand why it is not finding them.

I am working on a 3.x RCP soft migrated into 4.x

<extension
     id="liteproduct"
     point="org.eclipse.core.runtime.products">
  <product
        application="com.xyzide.rcp.application"
        name="XYZ IDE">
     <property
         name="applicationXMI"
         value="com.xyzide.rcp/LegacyIDE.e4xmi">
   </property>
     <property
           name="cssTheme"
           value="com.xyzide.ui.css.theme.e4_default">
     </property>
  <property
         name="applicationCSSResources"
         value="platform:/plugin/com.xyzide.rcp/images/">
  </property>
  </product>

 <extension
point="org.eclipse.e4.ui.css.swt.theme">
    <theme
        basestylesheeturi="css/e4_default.css"
        id="com.xyzide.ui.css.theme.e4_default.noos"
        label="Default Theme">
        </theme>
    <theme
        basestylesheeturi="css/e4_classic_winxp.css"
        id="com.xyzide.ui.css.theme.e4_classic"
        label="Classic">
    </theme>
    <theme
        basestylesheeturi="css/e4_default_gtk.css"
        id="com.xyzide.ui.css.theme.e4_default"
        label="GTK"
        os="linux">
    </theme>
    <theme
        basestylesheeturi="css/e4_default_mac.css"
        id="com.xyzide.ui.css.theme.e4_default"
        label="Mac"
        os="macosx">
    </theme>
    <theme
        basestylesheeturi="css/e4_default_win7.css"
        id="com.xyzide.ui.css.theme.e4_default"
        label="Windows 7"
        os="win32"
        os_version="6.1">
    </theme>
    <theme
        basestylesheeturi="css/e4_default_winxp_blu.css"
        id="com.xyzide.ui.css.theme.e4_default"
        label="Windows XP Blue"
        os="win32">
    </theme>
    <theme
        basestylesheeturi="css/e4_default_winxp_olv.css"
        id="com.xyzide.ui.css.theme.e4_default.xpolive"
        label="Windows XP Olive"
        os="win32">
    </theme>
    <theme
        basestylesheeturi="css/e4_classic_win7.css"
        id="com.xyzide.ui.css.theme.e4_classic"
        label="Windows 7 Classic"
        os="win32"
        os_version="6.1">
    </theme>
    <theme
        basestylesheeturi="css/e4_default_gtk.css"
        id="com.xyzide.ui.css.theme.e4_default"
        label="Solaris"
        os="solaris">
    </theme>
    <theme
        basestylesheeturi="css/e4_default_gtk.css"
        id="com.xyzide.ui.css.theme.e4_default"
        label="AIX"
        os="aix">
    </theme>
    <theme
        basestylesheeturi="css/e4_classic_winxp.css"
        id="com.xyzide.ui.css.theme.e4_default"
        label="HPUX"
        os="hpux">
    </theme>
</extension>

I have omitted some properties from the product extension that were not relevant.

Upvotes: 0

Views: 1052

Answers (2)

greg-449
greg-449

Reputation: 111142

I think this will work in a jar if you include platform:/plugin/com.xyzide.rcp/ at the start of the basestylesheeturi values.

Using a jar uses a bit less space but I notice the Eclipse install does use a directory (which might just be to make it easier to access the files for this). Eclipse does sometimes expand jars in to its cache, but I don't think that is done for the CSS and image files.

Upvotes: 2

nbz
nbz

Reputation: 3938

So with greg-449's help, I was able to identify that when the RCP is exported, it needs to have the plugin containing the css and images folder packaged as a directory.

I added the following to my Manifest.MF

Eclipse-BundleShape: dir

And when I exported, the styling worked fine. I tested it on Windows at least and it seemed ok. Will need to check the other OSs as well.

Upvotes: 0

Related Questions