0

I am using eclipse e4. I need to add an image for checkbox(checked and unchecked). I have tried adding the image in the following way in table viewer. I can see only red spots in place of the image.

I have used the following code snippet.

private void createCheckedImage() {
    Bundle bundle = FrameworkUtil.getBundle(ColumnLabelProvider.class);
    URL url = FileLocator.find(bundle, new Path("icons/checkbox_yes.png"), null);
    ImageDescriptor imageDcr = ImageDescriptor.createFromURL(url);
    CHECKED = imageDcr.createImage();
  }

I am not sure whether I am doing it correct. Can anyone suggest some ideas?

Acjb
  • 505
  • 1
  • 6
  • 21

1 Answers1

0

The answer to my question is the small mistake that I have done in FrameworkUtil.getBundle() method. I have added ColumnLabelProvider.class but It should be the class that I am using. My class name is StatisticsPart. So it should be like the following code snippet

private void createCheckedImage() {
    Bundle bundle = FrameworkUtil.getBundle(StatisticsPart.class);
    URL url = FileLocator.find(bundle, new Path("icons/checkbox_yes.png"), null);
    ImageDescriptor imageDcr = ImageDescriptor.createFromURL(url);
    CHECKED = imageDcr.createImage();
  }
Acjb
  • 505
  • 1
  • 6
  • 21