To create an Eclipse plugin, I need to import/use some resources into a stylesheet. All the necessary files reside into the plugin package and are correctly build with no errors into the final .jar.
I have this folder/files in plugin package:
> my.plugin.package.name
> META-INF/
> MANIFEST.MF
> resources/
> css/
> base-stylesheet.css
> win-stylesheet.css
> linux-stylesheet.css
> ...
> images/
> mytexture.png
> ...
> plugin.xml
> ...
in win-stylesheet.css I want to import base-stylesheet.css and use mytexture.png, so into the CSS I do:
@import url("base-stylesheet.css");
#elemId {
background-image: url(../images/mytexture.png);
}
unfortunately, these gives a MalformedURLException, I noticed also that:
- using character " or ' or nothing to delimit the url string give the same error;
- using
@import url("/base-stylesheet.css")or@import url("./base-stylesheet.css")works perfecly when running/debugging the plugin into a second Eclipse instance but silently fails with the same error when the plugin jar is installed in Eclipse; - using
@import url("platform:/plugin/my.plugin.id/resources/css/base-stylesheet.css")or@import url("platform://plugin/my.plugin.id/resources/css/base-stylesheet.css")wheremy.plugin.idis the Bundle-SymbolicName assigned in MANIFEST.MF give the same error both when running/debugging the plugin and when using it after installing the jar.
I suspect that the workspace directory is automatically assigned to platform:/plugin/org.eclipse.platform/.
How can I solve it?