2013-10-14 40 views
0

我按照this forum中的建議步驟操作,通過從org.eclipse.platform複製css和images文件夾來獲取不同操作系統的CSS主題。Eclipse RCP CSS樣式在導出後不起作用

當我從Eclipse啓動它時工作正常,但當我導出產品文件(無論是從Eclipse還是通過Maven)時,根本沒有CSS樣式。

我檢查了build.properties,並將css和images文件夾標記爲導出,所以我不明白爲什麼它沒有找到它們。

我上了3.x RCP工作軟遷移到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> 

我省略了從產品擴展,不相關的一些屬性。

+0

你在定義產品的plugin.xml中有什麼? –

+0

我已經用代碼更新了這個問題。 – nbz

+1

plugin.xml看起來不錯。檢查導出的產品插件是否包含css目錄。 –

回答

0

所以在greg-449的幫助下,我能夠識別出當RCP被導出時,它需要將包含css和images文件夾的插件打包爲一個目錄。

添加以下到我的Manifest.MF

Eclipse-BundleShape: dir 

當我出口,造型工作的罰款。我至少在Windows上測試過它,它似乎沒問題。還需要檢查其他操作系統。

+2

我認爲如果在'basestylesheeturi'值(至少這就是我所擁有的和它的工作原理)的開始處包含'platform:/ plugin/com.xyzide.rcp /',就可以在jar中工作。 –

+0

對不起,這可能是一個愚蠢的問題,但有什麼原因,我想保持它作爲一個罐子,而不是一個目錄? – nbz

+0

你說得對!我怎麼會這麼愚蠢......我回頭看看我的舊ApplicationCSS代碼,這就是我如何擁有它。我想我剛剛使用這個代碼直接論壇,並沒有意識到。你可以發表你的評論作爲答案,我會接受它。 – nbz

2

我認爲如果在basestylesheeturi值的開始處包含platform:/plugin/com.xyzide.rcp/,這將在jar中工作。

使用jar使用少一點的空間,但我注意到Eclipse安裝確實使用了一個目錄(這可能只是爲了更容易地訪問這些文件)。 Eclipse有時會將jar擴展到它的緩存中,但我認爲這不是爲CSS和圖像文件完成的。

+0

所以不幸的是,這似乎沒有工作,我不得不恢復到目錄設置。這可能與此有關 - http://www.eclipse.org/forums/index.php/t/457837/ – nbz

+0

可能。我不在我的樣式表中使用CSS導入。 –

+0

我在所有的操作系​​統上測試過它,它只能用於一個目錄中的軟件包....對不起,我將不得不不接受你的答案,但我一定會投它! – nbz