How to use CellModel_Image correctly?

Hi,

I use a CellModel_Image in an Editor to project an png-file.

In the inspector, I set the path to my icon file using the ${module}-macro, like so:

image provider : <no image provider> 
image file : ${module}/icons/lock.png [...]
descent : <no descent>

This works fine and the macro is resolved correctly in my sandbox, meaning that the expanded path of "${module}/icons/lock.png" points to the correct file, e.g. this:

D:\my\path\to\workspace\my.language.namespace\icons\lock.png

In my RCP, however, the expanded path is "wrong", or at least not what I would expect, which means that java cannot find the resource "lock.png". The expanded path is something like this:

D:\rcp_installation\plugins\my.project.namespace\languages\my.plugin.namespace\my.language.namespace.jar!/META-INF

I do not know why it points to the META-INF directory or how I could avoid that. 

Note that the "icons" folder is deployed to the root of the jar file.

I do have a workaround in place, which basically expands the macro and checks if we are in the context of a "**.jar!/META-INF" folder and reacts accordingly, but this cannot be the correct way to have images work in both contexts, can it? 

What is the correct way to make sure that images are loaded correctly both in the context of the RCP and the context of my development environment?

Please sign in to leave a comment.