Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activator.getImageDescriptor(path) returns null even though plugin.xml makes use of identical path for icons

In a subclass of StyledCellLabelProvider, I have a line like this:

ImageDescriptor d = Activator.getImageDescriptor("/icons/sample.gif");

However, the variable d is always null. Strangely, the image shows up correctly in the upper left corner of a View when I specify the exact same path in plugin.xml:

  <view
        name="Message"
        allowMultiple="true"
        icon="/icons/sample.gif"
        class="com.myapp.views.EmailView"
        id="com.myapp.gui.emailView">
  </view>

The path of this image in my project is the standard location of <project>/icons/sample.gif, and the plugin source code is in <project>/src.

Frustratingly, the sample Plugin project "RCP Mail Template" uses (successfully) an identical function to obtain a reference to an ImageDescriptor:

ImageDescriptor d = Activator.getImageDescriptor("/icons/sample.gif");

Could there be something wrong with my plugin configuration that would cause images to not be found when referenced programmatically?

like image 906
kostmo Avatar asked Feb 22 '23 05:02

kostmo


1 Answers

But the static getImageDescriptor methods of your Activator class and "RCP Mail Template"'s Activator class are different. Perhaps you are using incorrect plugin ID there?

like image 162
Alexey Romanov Avatar answered Apr 29 '23 11:04

Alexey Romanov