Community
Participate
Working Groups
In a theme plug-in, trying to import or use a resource into a CSS stylesheet throws a MalformedURLException at run-time when the '@import url()' is executed. Everything works with no errors when the plug-in is run/debugged into a second Eclipse instance and the package is build succesfully with no error or warning. eg. if there is a project structure like: > my.plugin.package.name > META-INF/ > MANIFEST.MF > resources/ > css/ > base-stylesheet.css > win-stylesheet.css > linux-stylesheet.css > ... > images/ > mytexture.png > ... > plugin.xml > ... And into 'linux-stylesheet.css' is imported 'base-stylesheet.css' and used 'mytexture.png': @import url("base-stylesheet.css"); #elemId { background-image: url(mytexture.png); } with a 'plugin.xml' like this: <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> <extension point="org.eclipse.e4.ui.css.swt.theme"> <theme basestylesheeturi="resources/css/linux-stylesheet.css" id="my.plugin.id" label="Theme Name" os="linux"> </theme> <theme ... </theme> <property name="applicationCSSResources" value="platform:/plugin/my.plugin.id/resources/images/"> </property> </extension> </plugin> if into CSS is used '@import url("platform:/plugin/my.plugin.id/resources/css/base-stylesheet.css")' where my.plugin.id is the Bundle-SymbolicName assigned in MANIFEST.MF we have the same error both when running/debugging the plugin and when using it after installing the jar. Probably during plugin execution the workspace directory is automatically assigned to platform:/plugin/org.eclipse.platform/ and cannot be changed and the stylesheets placed into the same plugin directory are unreacheble by the @import.
https://git.eclipse.org/r/#/c/20889/
Fixed with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=92ed79170250f3b070e129d54c165b31a9a430dd
Verified in Build id: I20140303-2000
Verified
This commit has probably introduced a bug. In my CSS I am refering to a plugin resource using absolute URL: "platform:/plugin/com.genutiec.myeclipse.product/splash.bmp" When this URL is provided to the OSGiResourceLocator, it resolves fine, because <if (!uri.startsWith("platform:/plugin/"))> blocks prepending startLocation. However when getInputStream is called (because it resolved fine), startLocation is prepended and IOException is thrown. A possible workaround would be to register another OSGiResourceLocator with startLocation set to "", however if it's not the first one on the list of locators, the exception is thrown anyways and no image loading happens. I think this bug should be reopened.
(In reply to Piotrek Tomiak from comment #5) > This commit has probably introduced a bug. Piotrek, please open a new bug with the description and how to reproduce, and we'll try and look at it in SR1. Please reference this bug. PW
(In reply to Paul Webster from comment #6) > Piotrek, please open a new bug with the description and how to reproduce, > and we'll try and look at it in SR1. Please reference this bug. Thanks for directions. Filed as bug #437939