Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to correctly register a CSS
How to correctly register a CSS [message #836439] Wed, 04 April 2012 13:43 Go to next message
Helmut Frohner is currently offline Helmut FrohnerFriend
Messages: 3
Registered: April 2012
Junior Member
Hello!

I am using RAP 1.4.0 with Eclipse 3.7.1 and I have a CSS located at:
'my.fragment/src/some/packages/My.default.css'
I registered it with a themeContribution to 'org.eclipse.rap.ui.themes' with themeId 'org.eclipse.rap.rwt.theme.Default' and file '/src/some/packages/My.default.css'.
This of course only works when I test it in Eclipse.

When built the classes and CSS are located in an own library. The path to the CSS file in my WAR looks like this:
'my.web.archive.war\WEB-INF\plugins\my.fragment_1.0.0\my_library.jar\some\packages\My.default.css'

This brings an exception when deploying it to Tomcat:

!ENTRY my.hostplugin 4 0 2012-04-04 10:24:55.156
!MESSAGE Could not register theme contribution for theme 'org.eclipse.rap.rwt.theme.Default' from file '/src/some/packages/My.default.css'.
!STACK 0
java.lang.IllegalArgumentException: Could not open resource /src/some/packages/My.default.css
at org.eclipse.rwt.internal.theme.css.CssFileReader.readStyleSheet(CssFileReader.java:52)
at org.eclipse.rap.ui.internal.servlet.EngineConfigWrapper.registerThemeContributions(EngineConfigWrapper.java:348)
at org.eclipse.rap.ui.internal.servlet.EngineConfigWrapper.init(EngineConfigWrapper.java:143)
...

I also tried to register it with '/some/packages/My.default.css' but this also didn't work.

Could there be a problem because the CSS is located in the 'my_library.jar' or because it is in a fragment?

How do I correctly register the CSS for source and binary builds?

Greetings,
Helmut
Re: How to correctly register a CSS [message #836617 is a reply to message #836439] Wed, 04 April 2012 17:51 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
Helmut,

if you register a themeContribution with an extension, put the theme
file in a folder (or the root) of the fragment/plug-in (but outside of a
source folder). Then reference it by its location relative to the
contributing fragment/plug-in.

Don't forget to reference the theme file in the build.properties.
Otherwise it will not be packed into the fragment at build time.

HTH
Rüdiger

On 04.04.2012 15:43, Helmut Frohner wrote:
> Hello!
>
> I am using RAP 1.4.0 with Eclipse 3.7.1 and I have a CSS located at:
> 'my.fragment/src/some/packages/My.default.css'
> I registered it with a themeContribution to 'org.eclipse.rap.ui.themes'
> with themeId 'org.eclipse.rap.rwt.theme.Default' and file
> '/src/some/packages/My.default.css'.
> This of course only works when I test it in Eclipse.
>
> When built the classes and CSS are located in an own library. The path
> to the CSS file in my WAR looks like this:
> 'my.web.archive.war\WEB-INF\plugins\my.fragment_1.0.0\my_library.jar\some\packages\My.default.css'
>
>
> This brings an exception when deploying it to Tomcat:
>
> !ENTRY my.hostplugin 4 0 2012-04-04 10:24:55.156
> !MESSAGE Could not register theme contribution for theme
> 'org.eclipse.rap.rwt.theme.Default' from file
> '/src/some/packages/My.default.css'.
> !STACK 0
> java.lang.IllegalArgumentException: Could not open resource
> /src/some/packages/My.default.css
> at
> org.eclipse.rwt.internal.theme.css.CssFileReader.readStyleSheet(CssFileReader.java:52)
>
> at
> org.eclipse.rap.ui.internal.servlet.EngineConfigWrapper.registerThemeContributions(EngineConfigWrapper.java:348)
>
> at
> org.eclipse.rap.ui.internal.servlet.EngineConfigWrapper.init(EngineConfigWrapper.java:143)
>
> ...
>
> I also tried to register it with '/some/packages/My.default.css' but
> this also didn't work.
>
> Could there be a problem because the CSS is located in the
> 'my_library.jar' or because it is in a fragment?
>
> How do I correctly register the CSS for source and binary builds?
>
> Greetings,
> Helmut
--
Rüdiger Herrmann
http://codeaffine.com
Re: How to correctly register a CSS [message #837104 is a reply to message #836617] Thu, 05 April 2012 09:21 Go to previous message
Helmut Frohner is currently offline Helmut FrohnerFriend
Messages: 3
Registered: April 2012
Junior Member
Hi Rüdiger,

thank you for your hint! Now it works.

Greetings,
Helmut
Previous Topic:RAP and CSS resource
Next Topic:Javascript Error when changing view using ViewStack
Goto Forum:
  


Current Time: Tue Apr 16 22:33:20 GMT 2024

Powered by FUDForum. Page generated in 2.94501 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top