kostmo
kostmo

Reputation: 6340

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?

Upvotes: 4

Views: 2026

Answers (1)

Alexey Romanov
Alexey Romanov

Reputation: 170713

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?

Upvotes: 8

Related Questions